summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlmuHS <almuhs@github.com>2019-05-05 17:14:45 +0200
committerAlmuHS <almuhs@github.com>2019-05-05 17:14:45 +0200
commitf5ddb41d7cf82bc4900f29030320f488580fedbf (patch)
tree5fec005f60cbba83280781eafc1cea29f282a2e0
parent4a3c2034436a02bd4f6e4178e370e882aa12e5e6 (diff)
experiment: try to enable pagging
-rw-r--r--i386/i386/cpuboot.S16
-rw-r--r--i386/i386/mp_desc.c11
2 files changed, 27 insertions, 0 deletions
diff --git a/i386/i386/cpuboot.S b/i386/i386/cpuboot.S
index e19e7a5c..544a1329 100644
--- a/i386/i386/cpuboot.S
+++ b/i386/i386/cpuboot.S
@@ -100,6 +100,22 @@ _apboot:
call cpu_ap_main
cli
+ /* Initialize pagging */
+ mov kernel_page_dir, %eax
+ add KERNELBASE,%eax
+ mov %eax, %cr3
+
+ mov %cr0,%eax
+ or $0x80010000,%eax
+
+ mov %eax,%cr0
+ mov %cr0,%eax
+ and $0x9fffffff,%eax
+ mov %eax,%cr0
+ mov %cr4,%eax
+ or $0x80,%al
+ mov %eax,%cr4
+
.align 0x10
gdt_descr_tmp:
.short 0x8*3 - 1
diff --git a/i386/i386/mp_desc.c b/i386/i386/mp_desc.c
index 1c8ca47d..eff54c87 100644
--- a/i386/i386/mp_desc.c
+++ b/i386/i386/mp_desc.c
@@ -346,6 +346,16 @@ cpu_setup()
break;
}
+#if 0
+
+#ifdef MACH_PV_PAGETABLES
+ for (i = 0; i < PDPNUM; i++)
+ pmap_set_page_readonly_init((void*) kernel_page_dir + i * INTEL_PGBYTES);
+#if PAE
+ pmap_set_page_readonly_init(kernel_pmap->pdpbase);
+#endif /* PAE */
+#endif /* MACH_PV_PAGETABLES */
+
#if PAE
set_cr3((unsigned)_kvtophys(kernel_pmap->pdpbase));
#ifndef MACH_HYP
@@ -367,6 +377,7 @@ cpu_setup()
set_cr4(get_cr4() | CR4_PGE);
#endif /* MACH_HYP */
+#endif
//slave_main(i);
printf("cpu %d enabled\n", cpu_number());