summaryrefslogtreecommitdiff
path: root/Kernel/Arch/i386/CPU.h
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 /Kernel/Arch/i386/CPU.h
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 'Kernel/Arch/i386/CPU.h')
-rw-r--r--Kernel/Arch/i386/CPU.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/Kernel/Arch/i386/CPU.h b/Kernel/Arch/i386/CPU.h
index c9f59e3e40..80a08ebd79 100644
--- a/Kernel/Arch/i386/CPU.h
+++ b/Kernel/Arch/i386/CPU.h
@@ -33,7 +33,7 @@
#define PAGE_SIZE 4096
#define GENERIC_INTERRUPT_HANDLERS_COUNT 128
-#define PAGE_MASK ((uintptr_t)0xfffff000u)
+#define PAGE_MASK ((FlatPtr)0xfffff000u)
namespace Kernel {
@@ -451,24 +451,24 @@ struct [[gnu::aligned(16)]] FPUState
u8 buffer[512];
};
-inline constexpr uintptr_t page_base_of(uintptr_t address)
+inline constexpr FlatPtr page_base_of(FlatPtr address)
{
return address & PAGE_MASK;
}
-inline uintptr_t page_base_of(const void* address)
+inline FlatPtr page_base_of(const void* address)
{
- return page_base_of((uintptr_t)address);
+ return page_base_of((FlatPtr)address);
}
-inline constexpr uintptr_t offset_in_page(uintptr_t address)
+inline constexpr FlatPtr offset_in_page(FlatPtr address)
{
return address & (~PAGE_MASK);
}
-inline uintptr_t offset_in_page(const void* address)
+inline FlatPtr offset_in_page(const void* address)
{
- return offset_in_page((uintptr_t)address);
+ return offset_in_page((FlatPtr)address);
}
u32 read_cr3();