summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorJean-Baptiste Boric <jblbeurope@gmail.com>2021-01-18 20:24:25 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-19 09:03:37 +0100
commit6677ab1ccd2c9f677782ff131889dab890fe53b0 (patch)
treeb4212b4d883f10fb04f99fd2c3a8c0ee241f12b8 /Kernel
parentcb29dca0293fd4c054d5b0fc7b717dbd37005f61 (diff)
downloadserenity-6677ab1ccd2c9f677782ff131889dab890fe53b0.zip
Boot: Fix undefined Multiboot behaviors
Both ESP and GDTR are left undefined by the Multiboot specification and OS images must not rely on these values to be valid. Fix the undefined behaviors so that booting with PXELINUX does not triple-fault the CPU.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Arch/i386/Boot/boot.S14
1 files changed, 7 insertions, 7 deletions
diff --git a/Kernel/Arch/i386/Boot/boot.S b/Kernel/Arch/i386/Boot/boot.S
index 4fce416868..d0ced81de4 100644
--- a/Kernel/Arch/i386/Boot/boot.S
+++ b/Kernel/Arch/i386/Boot/boot.S
@@ -194,10 +194,13 @@ start:
orl $0x80000000, %eax
movl %eax, %cr0
+ /* set up stack */
+ mov $stack_top, %esp
+ and $-16, %esp
+
/* jmp to an address above the 3GB mark */
- push %cs
- push $1f
- retf
+ movl $1f,%eax
+ jmp *%eax
1:
movl %cr3, %eax
movl %eax, %cr3
@@ -212,10 +215,7 @@ start:
addl $8, %edi
loop 1b
- /* set up initial stack and jump into C++ land */
- mov $stack_top, %esp
- and $-16, %esp
-
+ /* jump into C++ land */
addl $0xc0000000, %ebx
movl %ebx, multiboot_info_ptr