kernel: initial vmm implementation

This commit is contained in:
Matheus
2023-04-16 20:47:41 -03:00
parent fac767129e
commit 30d64485fd
6 changed files with 357 additions and 1 deletions
+2
View File
@@ -7,12 +7,14 @@
#include <arch/msr.h>
#include <arch/ist.h>
#include <kernel/interrupt.h>
#include <kernel/vmm.h>
typedef struct {
uint64_t gdt[7];
ist_t ist;
long id;
isr_t isr[MAX_ISR_COUNT];
vmmcontext_t *vmmctx;
} cpu_t;
static inline cpu_t *_cpu() {
+6
View File
@@ -5,6 +5,11 @@
#include <stdint.h>
#include <stddef.h>
#define KERNELSPACE_START (void *)0xffff800000000000
#define KERNELSPACE_END (void *)0xffffffffffffffff
#define USERSPACE_START (void *)0x0000000000001000
#define USERSPACE_END (void *)0x00007fffffffffff
#define PAGE_SIZE 4096
#define ARCH_MMU_FLAG_READ (uint64_t)1
#define ARCH_MMU_FLAG_WRITE (uint64_t)2
@@ -20,6 +25,7 @@ void arch_mmu_unmap(pagetableptr_t table, void *vaddr);
void arch_mmu_remap(pagetableptr_t table, void *paddr, void *vaddr, mmuflags_t flags);
void arch_mmu_switch(pagetableptr_t table);
void *arch_mmu_getphysical(pagetableptr_t table, void *vaddr);
pagetableptr_t arch_mmu_newtable();
void arch_mmu_init();
#endif