From 67886b0c5a267d4d1cf45df4785b4e06eead9c27 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 30 May 2023 23:57:03 +0300 Subject: [PATCH] Kernel: Move V2P and P2V to Memory/Types.h --- kernel/arch/x86_64/PageTable.cpp | 4 ---- kernel/include/kernel/Memory/Types.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/kernel/arch/x86_64/PageTable.cpp b/kernel/arch/x86_64/PageTable.cpp index 88533b8fde..58a4945dc4 100644 --- a/kernel/arch/x86_64/PageTable.cpp +++ b/kernel/arch/x86_64/PageTable.cpp @@ -4,10 +4,6 @@ #include #include -#define KERNEL_OFFSET 0xFFFFFFFF80000000 -#define V2P(vaddr) (((vaddr_t)(vaddr)) - KERNEL_OFFSET) -#define P2V(paddr) (((paddr_t)(paddr)) + KERNEL_OFFSET) - #define CLEANUP_STRUCTURE(s) \ do { \ for (uint64_t i = 0; i < 512; i++) \ diff --git a/kernel/include/kernel/Memory/Types.h b/kernel/include/kernel/Memory/Types.h index 7d9f637e7e..0b5439f38f 100644 --- a/kernel/include/kernel/Memory/Types.h +++ b/kernel/include/kernel/Memory/Types.h @@ -1,5 +1,15 @@ #pragma once +#include + +#if ARCH(x86_64) + #define KERNEL_OFFSET 0xFFFFFFFF80000000 + #define V2P(vaddr) (((vaddr_t)(vaddr)) - KERNEL_OFFSET) + #define P2V(paddr) (((paddr_t)(paddr)) + KERNEL_OFFSET) +#else + #error +#endif + #define PAGE_SIZE 4096 #define PAGE_FLAG_MASK ((uintptr_t)0xFFF) #define PAGE_ADDR_MASK (~PAGE_FLAG_MASK)