Move vmm fully into hal
This commit is contained in:
@ -1,53 +0,0 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "bitmap/bitmap.h"
|
||||
#include "spinlock/spinlock.h"
|
||||
#include "bootinfo/bootinfo.h"
|
||||
#include "vmm.h"
|
||||
#include "kprintf.h"
|
||||
#include "util/util.h"
|
||||
#include "hal/hal.h"
|
||||
#include "pmm/pmm.h"
|
||||
|
||||
VirtMem VIRT_MEM;
|
||||
|
||||
void vmm_map_kern_page(uint64_t virtaddr, uint64_t physaddr, uint32_t flags) {
|
||||
spinlock_acquire(&VIRT_MEM.spinlock);
|
||||
#if defined(__x86_64__)
|
||||
hal_vmm_map_page(KERNEL_CR3, virtaddr, physaddr, flags);
|
||||
#endif
|
||||
spinlock_release(&VIRT_MEM.spinlock);
|
||||
}
|
||||
|
||||
void vmm_unmap_kern_page(uint64_t virtaddr, uint64_t physaddr) {
|
||||
spinlock_acquire(&VIRT_MEM.spinlock);
|
||||
#if defined(__x86_64__)
|
||||
hal_vmm_unmap_page(KERNEL_CR3, virtaddr, physaddr);
|
||||
#endif
|
||||
spinlock_release(&VIRT_MEM.spinlock);
|
||||
}
|
||||
|
||||
void vmm_map_kern_range(void *virtstart, void *physstart, size_t size, uint32_t flags) {
|
||||
spinlock_acquire(&VIRT_MEM.spinlock);
|
||||
#if defined(__x86_64__)
|
||||
hal_vmm_map_range(KERNEL_CR3, virtstart, physstart, size, flags);
|
||||
#endif
|
||||
spinlock_release(&VIRT_MEM.spinlock);
|
||||
}
|
||||
|
||||
void vmm_unmap_kern_range(void *virtstart, void *physstart, size_t size) {
|
||||
spinlock_acquire(&VIRT_MEM.spinlock);
|
||||
#if defined(__x86_64__)
|
||||
hal_vmm_unmap_range(KERNEL_CR3, virtstart, physstart, size);
|
||||
#endif
|
||||
spinlock_release(&VIRT_MEM.spinlock);
|
||||
}
|
||||
|
||||
void vmm_init(void) {
|
||||
spinlock_init(&VIRT_MEM.spinlock);
|
||||
|
||||
hal_vmm_init();
|
||||
|
||||
LOG("vmm", "init\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user