81ebb948ed
Signed-off-by: Chloe M. <chloe@mensia.org>
36 lines
723 B
C
36 lines
723 B
C
/*
|
|
* Copyright (c) 2026, Chloe M.
|
|
* Provided under the BSD-3 clause.
|
|
*
|
|
* Description: Virtual memory manager
|
|
* Author: Chloe M.
|
|
*/
|
|
|
|
#include <mm/vmm.h>
|
|
#include <hal/mmu.h>
|
|
#include <ex/trace.h>
|
|
#include <ke/knot.h>
|
|
|
|
#define DTRACE(Fmt, ...) \
|
|
TRACE("[ VMM ]: " Fmt, ##__VA_ARGS__)
|
|
|
|
static MMU_VAS KernelVas;
|
|
|
|
VOID
|
|
MmInitVmm(VOID)
|
|
{
|
|
MMU_VAS OldVas;
|
|
ST_STATUS Status;
|
|
|
|
DTRACE("breeding kvas from bootstrap instance...\n");
|
|
HalMmuReadVas(&OldVas);
|
|
Status = HalMmuForkVas(&OldVas, &KernelVas);
|
|
|
|
if (Status != STATUS_SUCCESS) {
|
|
KeKnot(KNOT_OOM, "could not fork bootstrap vas\n");
|
|
}
|
|
|
|
HalMmuWriteVas(&KernelVas);
|
|
DTRACE("ah!~... [ok @ %p]\n", VAS_BASE(&KernelVas));
|
|
}
|