ptos/amd64+hal: Add virtual address space forking
Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
+12
-1
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user