Kernel: Move V2P and P2V to Memory/Types.h

This commit is contained in:
Bananymous 2023-05-30 23:57:03 +03:00
parent e86050f343
commit ed0dcacab3
2 changed files with 10 additions and 4 deletions

View File

@ -4,10 +4,6 @@
#include <kernel/Memory/kmalloc.h>
#include <kernel/Memory/PageTable.h>
#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++) \

View File

@ -1,5 +1,15 @@
#pragma once
#include <kernel/Arch.h>
#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)