From a47271ebdc1d87213c4ba9429a2c440922015b41 Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Tue, 25 Oct 2022 18:34:38 +0200 Subject: 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. --- Kernel/Arch/CPU.h | 7 +++++++ Kernel/Arch/aarch64/CPU.h | 2 -- Kernel/Arch/x86/CPU.h | 6 ------ Kernel/Arch/x86/RegisterState.h | 2 +- Kernel/Arch/x86/VGA/IOArbiter.cpp | 2 +- Kernel/Arch/x86/common/CPU.cpp | 2 +- 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 +#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 #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 #include +#include #include -#include #include 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 +#include #include -#include #include #include 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 -#include +#include #include #include -- cgit v1.2.3