mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:47:37 +00:00
Kernel: Avoid unnecessary jump in the boot code
The 32-bit boot code jumps to 0xc0000000 + entry address once page tables are set up. This is unnecessary for 64-bit mode because we'll do another far jump just moments later.
This commit is contained in:
parent
eb1935b62e
commit
9b431cbe42
1 changed files with 20 additions and 17 deletions
|
@ -522,23 +522,6 @@ pae_supported:
|
||||||
mov $stack_top, %esp
|
mov $stack_top, %esp
|
||||||
and $-16, %esp
|
and $-16, %esp
|
||||||
|
|
||||||
/* jmp to an address above the 3GB mark */
|
|
||||||
movl $1f,%eax
|
|
||||||
jmp *%eax
|
|
||||||
1:
|
|
||||||
movl %cr3, %eax
|
|
||||||
movl %eax, %cr3
|
|
||||||
|
|
||||||
/* unmap the 0-1MB range, which isn't used after jmp-ing up here */
|
|
||||||
movl $256, %ecx
|
|
||||||
movl $(boot_pd0_pt0 - KERNEL_BASE), %edi
|
|
||||||
xorl %eax, %eax
|
|
||||||
|
|
||||||
1:
|
|
||||||
movl %eax, 0(%edi)
|
|
||||||
addl $8, %edi
|
|
||||||
loop 1b
|
|
||||||
|
|
||||||
/* jump into C++ land */
|
/* jump into C++ land */
|
||||||
addl $KERNEL_BASE, %ebx
|
addl $KERNEL_BASE, %ebx
|
||||||
movl %ebx, multiboot_info_ptr
|
movl %ebx, multiboot_info_ptr
|
||||||
|
@ -556,8 +539,28 @@ pae_supported:
|
||||||
mov %ax, %es
|
mov %ax, %es
|
||||||
mov %ax, %fs
|
mov %ax, %fs
|
||||||
mov %ax, %gs
|
mov %ax, %gs
|
||||||
|
|
||||||
|
mov %cr3, %rax
|
||||||
|
mov %rax, %cr3
|
||||||
|
#else
|
||||||
|
/* jmp to an address above the 3GB mark */
|
||||||
|
movl $1f,%eax
|
||||||
|
jmp *%eax
|
||||||
|
1:
|
||||||
|
movl %cr3, %eax
|
||||||
|
movl %eax, %cr3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* unmap the 0-1MB range, which isn't used after jmp-ing up here */
|
||||||
|
movl $256, %ecx
|
||||||
|
movl $(boot_pd0_pt0 - KERNEL_BASE), %edi
|
||||||
|
xorl %eax, %eax
|
||||||
|
|
||||||
|
1:
|
||||||
|
movl %eax, 0(%edi)
|
||||||
|
addl $8, %edi
|
||||||
|
loop 1b
|
||||||
|
|
||||||
call init
|
call init
|
||||||
#if ARCH(X86_64)
|
#if ARCH(X86_64)
|
||||||
add $4, %rsp
|
add $4, %rsp
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue