From 55b476b828e551a75975468ffe15d08a32b10fb1 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 15 May 2010 13:10:38 +0800 Subject: [PATCH] Slight memory organisation changes --- Kernel/arch/x86_64/include/mm_virt.h | 14 ++++++++------ Kernel/arch/x86_64/mm_virt.c | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Kernel/arch/x86_64/include/mm_virt.h b/Kernel/arch/x86_64/include/mm_virt.h index a5abc71a..86081f38 100644 --- a/Kernel/arch/x86_64/include/mm_virt.h +++ b/Kernel/arch/x86_64/include/mm_virt.h @@ -21,10 +21,11 @@ * 8000 00000000 - 8000 7FFFFFFF 31 2 GiB Identity Map * 8000 80000000 - 9000 00000000 ~44 16 TiB Kernel Heap * 9000 00000000 - 9800 00000000 43 8 TiB Module Space - * 9800 00000000 - 9900 00000000 40 1 TiB Per-Process Data - * 9900 00000000 - 9A00 00000000 40 1 TiB Kernel VFS + * 9800 00000000 - 9A00 00000000 41 2 TiB Kernel VFS * A000 00000000 - B000 00000000 44 16 TiB Kernel Stacks * D000 00000000 - E000 00000000 44 16 TiB Hardware Mappings + * E000 00000000 - E080 00000000 39 512 GiB Per-Process Data + * E080 00000000 - E100 00000000 39 512 GiB Kernel Supplied User Code * FE00 00000000 - FE80 00000000 39 512 GiB Fractal Mapping (PML4 510) * FE80 00000000 - FF00 00000000 39 512 GiB Temp Fractal Mapping */ @@ -39,15 +40,16 @@ #define MM_KHEAP_MAX (KERNEL_BASE|(0x8001##00000000)) #define MM_MODULE_MIN (KERNEL_BASE|(0x9000##00000000)) #define MM_MODULE_MAX (KERNEL_BASE|(0x9800##00000000)) -#define MM_PPD_BASE (KERNEL_BASE|(0x9800##00000000)) -#define MM_PPD_CFG MM_PPD_BASE -#define MM_PPD_VFS (KERNEL_BASE|(0x9880##00000000)) -#define MM_KERNEL_VFS (KERNEL_BASE|(0x9900##00000000)) +#define MM_KERNEL_VFS (KERNEL_BASE|(0x9800##00000000)) #define MM_KSTACK_BASE (KERNEL_BASE|(0xA000##00000000)) #define MM_KSTACK_TOP (KERNEL_BASE|(0xC000##00000000)) #define MM_HWMAP_BASE (KERNEL_BASE|(0xD000##00000000)) #define MM_HWMAP_TOP (KERNEL_BASE|(0xE000##00000000)) +#define MM_PPD_BASE (KERNEL_BASE|(0xE000##00000000)) +#define MM_PPD_CFG MM_PPD_BASE +#define MM_PPD_VFS (KERNEL_BASE|(0xE008##00000000)) +#define MM_USER_CODE (KERNEL_BASE|(0xE080##00000000)) #define MM_LOCALAPIC (KERNEL_BASE|(0xFD00##00000000)) #define MM_FRACTAL_BASE (KERNEL_BASE|(0xFE00##00000000)) diff --git a/Kernel/arch/x86_64/mm_virt.c b/Kernel/arch/x86_64/mm_virt.c index 4cce4854..b7814219 100644 --- a/Kernel/arch/x86_64/mm_virt.c +++ b/Kernel/arch/x86_64/mm_virt.c @@ -266,3 +266,19 @@ void MM_FreeTemp(tVAddr VAddr) Log_KernelPanic("MM", "TODO: Implement MM_FreeTemp"); return ; } + + +// --- Address Space Clone -- +tPAddr MM_Clone(void) +{ + tPAddr ret; + + // #1 Create a copy of the PML4 + ret = MM_AllocPhys(); + if(!ret) return 0; + + // #2 Alter the fractal pointer + // #3 Set Copy-On-Write to all user pages + // #4 Return + +} -- 2.20.1