diff options
author | AlmuHS <almuhs@github.com> | 2019-05-18 17:51:11 +0200 |
---|---|---|
committer | AlmuHS <almuhs@github.com> | 2019-05-18 17:51:11 +0200 |
commit | 07527728ff3afe44109f7c5a9e40979ef856266e (patch) | |
tree | 6b80cfa61355bb746f3506eba6c83275f23b9ac7 /i386/i386/cpuboot.S | |
parent | 52718c4771f60393ac64ce52ea0e565208d76c3d (diff) |
undone experiment
Diffstat (limited to 'i386/i386/cpuboot.S')
-rw-r--r-- | i386/i386/cpuboot.S | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/i386/i386/cpuboot.S b/i386/i386/cpuboot.S index b15640c7..7ebd76f2 100644 --- a/i386/i386/cpuboot.S +++ b/i386/i386/cpuboot.S @@ -88,6 +88,50 @@ _apboot: movw %ax,%es movw %ax,%ss +#if PAE + //set_cr3((unsigned)_kvtophys(kernel_pmap->pdpbase)); + movl %cr3, %eax + movl %eax, _kvtophys(kernel_pmap->pdpbase) + movl %eax, %cr3 + +#ifndef MACH_HYP + if (!CPU_HAS_FEATURE(CPU_FEATURE_PAE)) + panic("CPU doesn't have support for PAE."); + //set_cr4(get_cr4() | CR4_PAE); + movl %cr4, %eax + orl CR4_PAE, %eax + movl %eax, %cr4 + +#endif /* MACH_HYP */ +#else + set_cr3((unsigned)_kvtophys(kernel_page_dir)); +#endif /* PAE */ +#ifndef MACH_HYP + /* Turn paging on. + * Also set the WP bit so that on 486 or better processors + * page-level write protection works in kernel mode. + */ + //set_cr0(get_cr0() | CR0_PG | CR0_WP); + movl %cr0, %eax + orl CR0_PG, %eax + orl CR0_WP, %eax + movl %eax, %cr0 + + //set_cr0(get_cr0() & ~(CR0_CD | CR0_NW)); + movl %cr0, %eax + andl ~(CR0_CD | CR0_NW), %eax + movl %eax, %cr0 + + + if (CPU_HAS_FEATURE(CPU_FEATURE_PGE)) + //set_cr4(get_cr4() | CR4_PGE); + movl %cr4, %eax + orl CR4_PGE, %eax + mov %eax, %cr4 + +#endif /* MACH_HYP */ + + movl stack_ptr, %esp addl $STACK_SIZE, %esp @@ -97,7 +141,6 @@ _apboot: pushl stack_ptr - call pmap_conf call cpu_ap_main cli @@ -132,5 +175,4 @@ apbootend: .globl dummyf dummyf: -ret - +ret
\ No newline at end of file |