forked from Bananymous/banan-os
Kernel: Move V2P and P2V to Memory/Types.h
This commit is contained in:
parent
e86050f343
commit
ed0dcacab3
|
@ -4,10 +4,6 @@
|
||||||
#include <kernel/Memory/kmalloc.h>
|
#include <kernel/Memory/kmalloc.h>
|
||||||
#include <kernel/Memory/PageTable.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) \
|
#define CLEANUP_STRUCTURE(s) \
|
||||||
do { \
|
do { \
|
||||||
for (uint64_t i = 0; i < 512; i++) \
|
for (uint64_t i = 0; i < 512; i++) \
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
#pragma once
|
#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_SIZE 4096
|
||||||
#define PAGE_FLAG_MASK ((uintptr_t)0xFFF)
|
#define PAGE_FLAG_MASK ((uintptr_t)0xFFF)
|
||||||
#define PAGE_ADDR_MASK (~PAGE_FLAG_MASK)
|
#define PAGE_ADDR_MASK (~PAGE_FLAG_MASK)
|
||||||
|
|
Loading…
Reference in New Issue