提交 94496468 创建 作者: Frans Kaashoek's avatar Frans Kaashoek

Use 4Mbyte pages during boot

上级 843eecfc
...@@ -39,6 +39,11 @@ multiboot_header: ...@@ -39,6 +39,11 @@ multiboot_header:
# Multiboot entry point. Machine is mostly set up. # Multiboot entry point. Machine is mostly set up.
.globl multiboot_entry .globl multiboot_entry
multiboot_entry: multiboot_entry:
# Turn on page size extension for 4Mbyte pages
movl %cr4, %eax
orl $(CR4_PSE), %eax
movl %eax, %cr4
# Set page directory
movl $(V2P_WO(bootpgdir)), %eax movl $(V2P_WO(bootpgdir)), %eax
movl %eax, %cr3 movl %eax, %cr3
# Turn on paging. # Turn on paging.
......
...@@ -50,6 +50,10 @@ start32: ...@@ -50,6 +50,10 @@ start32:
movw %ax, %fs movw %ax, %fs
movw %ax, %gs movw %ax, %gs
# Turn on page size extension for 4Mbyte pages
movl %cr4, %eax
orl $(CR4_PSE), %eax
movl %eax, %cr4
# Use bootpgdir as our initial page table # Use bootpgdir as our initial page table
movl (start-12), %eax movl (start-12), %eax
movl %eax, %cr3 movl %eax, %cr3
...@@ -58,7 +62,7 @@ start32: ...@@ -58,7 +62,7 @@ start32:
orl $(CR0_PE|CR0_PG|CR0_WP), %eax orl $(CR0_PE|CR0_PG|CR0_WP), %eax
movl %eax, %cr0 movl %eax, %cr0
# Switch to the stack allocated by entryothers() # Switch to the stack allocated by enterothers()
movl (start-4), %esp movl (start-4), %esp
# Call mpboot() # Call mpboot()
call *(start-8) call *(start-8)
......
差异被折叠。
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#define CR0_CD 0x40000000 // Cache Disable #define CR0_CD 0x40000000 // Cache Disable
#define CR0_PG 0x80000000 // Paging #define CR0_PG 0x80000000 // Paging
#define CR4_PSE 0x00000010 // Page size extension
#define SEG_KCODE 1 // kernel code #define SEG_KCODE 1 // kernel code
#define SEG_KDATA 2 // kernel data+stack #define SEG_KDATA 2 // kernel data+stack
#define SEG_KCPU 3 // kernel per-cpu data #define SEG_KCPU 3 // kernel per-cpu data
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论