summaryrefslogtreecommitdiff
path: root/Libraries/LibBareMetal
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-08 10:36:51 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-08 13:06:51 +0100
commitb1058b33fb32cb398d1723eb6fe59c27dc7967cc (patch)
tree49f0e5af7b7e37afd80a6dedf655917bf51ed915 /Libraries/LibBareMetal
parentb98d8ad5b01c41efff24faffe94918435194257a (diff)
downloadserenity-b1058b33fb32cb398d1723eb6fe59c27dc7967cc.zip
AK: Add global FlatPtr typedef. It's u32 or u64, based on sizeof(void*)
Use this instead of uintptr_t throughout the codebase. This makes it possible to pass a FlatPtr to something that has u32 and u64 overloads.
Diffstat (limited to 'Libraries/LibBareMetal')
-rw-r--r--Libraries/LibBareMetal/Memory/PhysicalAddress.h12
-rw-r--r--Libraries/LibBareMetal/Memory/VirtualAddress.h14
2 files changed, 13 insertions, 13 deletions
diff --git a/Libraries/LibBareMetal/Memory/PhysicalAddress.h b/Libraries/LibBareMetal/Memory/PhysicalAddress.h
index 02594b3389..e982cece9b 100644
--- a/Libraries/LibBareMetal/Memory/PhysicalAddress.h
+++ b/Libraries/LibBareMetal/Memory/PhysicalAddress.h
@@ -32,15 +32,15 @@
class PhysicalAddress {
public:
PhysicalAddress() {}
- explicit PhysicalAddress(uintptr_t address)
+ explicit PhysicalAddress(FlatPtr address)
: m_address(address)
{
}
- PhysicalAddress offset(uintptr_t o) const { return PhysicalAddress(m_address + o); }
- uintptr_t get() const { return m_address; }
- void set(uintptr_t address) { m_address = address; }
- void mask(uintptr_t m) { m_address &= m; }
+ PhysicalAddress offset(FlatPtr o) const { return PhysicalAddress(m_address + o); }
+ FlatPtr get() const { return m_address; }
+ void set(FlatPtr address) { m_address = address; }
+ void mask(FlatPtr m) { m_address &= m; }
bool is_null() const { return m_address == 0; }
@@ -58,7 +58,7 @@ public:
bool operator<=(const PhysicalAddress& other) const { return m_address <= other.m_address; }
private:
- uintptr_t m_address { 0 };
+ FlatPtr m_address { 0 };
};
inline const LogStream& operator<<(const LogStream& stream, PhysicalAddress value)
diff --git a/Libraries/LibBareMetal/Memory/VirtualAddress.h b/Libraries/LibBareMetal/Memory/VirtualAddress.h
index 92dfb6698d..2c82cb0d40 100644
--- a/Libraries/LibBareMetal/Memory/VirtualAddress.h
+++ b/Libraries/LibBareMetal/Memory/VirtualAddress.h
@@ -32,23 +32,23 @@
class VirtualAddress {
public:
VirtualAddress() {}
- explicit VirtualAddress(uintptr_t address)
+ explicit VirtualAddress(FlatPtr address)
: m_address(address)
{
}
explicit VirtualAddress(const void* address)
- : m_address((uintptr_t)address)
+ : m_address((FlatPtr)address)
{
}
bool is_null() const { return m_address == 0; }
bool is_page_aligned() const { return (m_address & 0xfff) == 0; }
- VirtualAddress offset(uintptr_t o) const { return VirtualAddress(m_address + o); }
- uintptr_t get() const { return m_address; }
- void set(uintptr_t address) { m_address = address; }
- void mask(uintptr_t m) { m_address &= m; }
+ VirtualAddress offset(FlatPtr o) const { return VirtualAddress(m_address + o); }
+ FlatPtr get() const { return m_address; }
+ void set(FlatPtr address) { m_address = address; }
+ void mask(FlatPtr m) { m_address &= m; }
bool operator<=(const VirtualAddress& other) const { return m_address <= other.m_address; }
bool operator>=(const VirtualAddress& other) const { return m_address >= other.m_address; }
@@ -63,7 +63,7 @@ public:
VirtualAddress page_base() const { return VirtualAddress(m_address & 0xfffff000); }
private:
- uintptr_t m_address { 0 };
+ FlatPtr m_address { 0 };
};
inline VirtualAddress operator-(const VirtualAddress& a, const VirtualAddress& b)