summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimon Kruiper <timonkruiper@gmail.com>2022-10-25 18:34:38 +0200
committerGunnar Beutner <gunnar@beutner.name>2022-10-26 20:01:45 +0200
commita47271ebdc1d87213c4ba9429a2c440922015b41 (patch)
tree63dacc127f3ab4f857ac36c8e0cf23669353728d
parent5cc190ad706bf650043552c50ac8c503f16b1590 (diff)
downloadserenity-a47271ebdc1d87213c4ba9429a2c440922015b41.zip
Kernel: Move PAGE_MASK define to the shared CPU.h header
These are the same for both x86 and aarch64 for now. Also update some include paths to use the generic CPU.h header.
-rw-r--r--Kernel/Arch/CPU.h7
-rw-r--r--Kernel/Arch/aarch64/CPU.h2
-rw-r--r--Kernel/Arch/x86/CPU.h6
-rw-r--r--Kernel/Arch/x86/RegisterState.h2
-rw-r--r--Kernel/Arch/x86/VGA/IOArbiter.cpp2
-rw-r--r--Kernel/Arch/x86/common/CPU.cpp2
6 files changed, 10 insertions, 11 deletions
diff --git a/Kernel/Arch/CPU.h b/Kernel/Arch/CPU.h
index 57cbc72199..73b384be85 100644
--- a/Kernel/Arch/CPU.h
+++ b/Kernel/Arch/CPU.h
@@ -9,6 +9,13 @@
#include <AK/Platform.h>
+#define PAGE_MASK (~(FlatPtr)0xfffu)
+
+#define LSW(x) ((u32)(x)&0xFFFF)
+#define MSW(x) (((u32)(x) >> 16) & 0xFFFF)
+#define LSB(x) ((x)&0xFF)
+#define MSB(x) (((x) >> 8) & 0xFF)
+
#if ARCH(X86_64) || ARCH(I386)
# include <Kernel/Arch/x86/CPU.h>
#elif ARCH(AARCH64)
diff --git a/Kernel/Arch/aarch64/CPU.h b/Kernel/Arch/aarch64/CPU.h
index 6769c61db0..61a89b042c 100644
--- a/Kernel/Arch/aarch64/CPU.h
+++ b/Kernel/Arch/aarch64/CPU.h
@@ -6,8 +6,6 @@
#pragma once
-#define PAGE_MASK (~(FlatPtr)0xfffu)
-
namespace Kernel {
void drop_to_exception_level_1();
diff --git a/Kernel/Arch/x86/CPU.h b/Kernel/Arch/x86/CPU.h
index e3f944d7cc..4bc1a50490 100644
--- a/Kernel/Arch/x86/CPU.h
+++ b/Kernel/Arch/x86/CPU.h
@@ -18,7 +18,6 @@ VALIDATE_IS_X86()
/* Map IRQ0-15 @ ISR 0x50-0x5F */
#define IRQ_VECTOR_BASE 0x50
#define GENERIC_INTERRUPT_HANDLERS_COUNT (256 - IRQ_VECTOR_BASE)
-#define PAGE_MASK (~(FlatPtr)0xfffu)
namespace Kernel {
@@ -36,11 +35,6 @@ inline u32 get_iopl_from_eflags(u32 eflags)
DescriptorTablePointer const& get_gdtr();
DescriptorTablePointer const& get_idtr();
-#define LSW(x) ((u32)(x)&0xFFFF)
-#define MSW(x) (((u32)(x) >> 16) & 0xFFFF)
-#define LSB(x) ((x)&0xFF)
-#define MSB(x) (((x) >> 8) & 0xFF)
-
constexpr FlatPtr page_base_of(FlatPtr address)
{
return address & PAGE_MASK;
diff --git a/Kernel/Arch/x86/RegisterState.h b/Kernel/Arch/x86/RegisterState.h
index 42af83a5a1..b69315c547 100644
--- a/Kernel/Arch/x86/RegisterState.h
+++ b/Kernel/Arch/x86/RegisterState.h
@@ -9,8 +9,8 @@
#include <AK/Types.h>
#include <LibC/sys/arch/i386/regs.h>
+#include <Kernel/Arch/CPU.h>
#include <Kernel/Arch/x86/ASM_wrapper.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <AK/Platform.h>
VALIDATE_IS_X86()
diff --git a/Kernel/Arch/x86/VGA/IOArbiter.cpp b/Kernel/Arch/x86/VGA/IOArbiter.cpp
index 3b6fc3c60b..cf558150ce 100644
--- a/Kernel/Arch/x86/VGA/IOArbiter.cpp
+++ b/Kernel/Arch/x86/VGA/IOArbiter.cpp
@@ -5,8 +5,8 @@
*/
#include <AK/Try.h>
+#include <Kernel/Arch/CPU.h>
#include <Kernel/Arch/Delay.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Arch/x86/IO.h>
#include <Kernel/Arch/x86/VGA/IOArbiter.h>
diff --git a/Kernel/Arch/x86/common/CPU.cpp b/Kernel/Arch/x86/common/CPU.cpp
index c334ffc584..635613d5c6 100644
--- a/Kernel/Arch/x86/common/CPU.cpp
+++ b/Kernel/Arch/x86/common/CPU.cpp
@@ -5,7 +5,7 @@
*/
#include <AK/Assertions.h>
-#include <Kernel/Arch/x86/CPU.h>
+#include <Kernel/Arch/CPU.h>
#include <Kernel/Panic.h>
#include <Kernel/Process.h>