Browse Source

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.
Jean-Baptiste Boric 4 năm trước cách đây
mục cha
commit
6677ab1ccd
1 tập tin đã thay đổi với 7 bổ sung7 xóa
  1. 7 7
      Kernel/Arch/i386/Boot/boot.S

+ 7 - 7
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