ptos/amd64+hal: Add virtual address space forking

Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
2026-07-14 21:25:51 +00:00
parent 7fa508bdf3
commit 181b0fdf61
3 changed files with 55 additions and 1 deletions
+12 -1
View File
@@ -35,6 +35,9 @@ static USIZE PageSizeTable[] = {
[PAGESIZE_4K] = 0x1000
};
/* Kernel VAS */
static MMU_VAS KVas;
/* Bump pointer and vad tree */
static UPTR VallocBump = VALLOC_BASE;
static MM_VAD_TREE VadTree;
@@ -138,7 +141,15 @@ MmVmInit(VOID)
HalMmuReadVas(&VasCurrent);
MmVadTreeInit(&VadTree);
Status = HalMmuForkVas(&VasCurrent, &KVas);
if (PT_ERROR(Status)) {
KeBugCheck(
BUGCHECK_OOM,
"failed to allocate kernel vas\n"
);
}
HalMmuWriteVas(&KVas);
VirtualStart = VallocBump;
VallocBump += INITIAL_VALLOC_PAGES * PAGESIZE;
VirtualEnd = VallocBump;
@@ -152,7 +163,7 @@ MmVmInit(VOID)
PhysicalBase = PFN_TO_ADDRESS(Pfn);
Status = HalMmuMapPage(
&VasCurrent,
&KVas,
VirtualStart + Off,
PhysicalBase,
PAGE_READ| PAGE_WRITE,