Re: [PATCH] fix i486 boot failure due to stale %ds

From: H. Peter Anvin
Date: Sun Nov 04 2007 - 18:55:09 EST


Mikael, can you try this patch (rev 3) on your 486?

-hpa diff --git a/arch/x86/boot/pmjump.S b/arch/x86/boot/pmjump.S
index 2e55923..d93a0c2 100644
--- a/arch/x86/boot/pmjump.S
+++ b/arch/x86/boot/pmjump.S
@@ -28,17 +28,21 @@
* void protected_mode_jump(u32 entrypoint, u32 bootparams);
*/
protected_mode_jump:
- xorl %ebx, %ebx # Flag to indicate this is a boot
movl %edx, %esi # Pointer to boot_params table
- movl %eax, 2f # Patch ljmpl instruction
+ movl %eax, 3f # Patch ljmpl instruction
jmp 1f # Short jump to flush instruction q.
-
1:
+
movw $__BOOT_DS, %cx
+ xorl %ebx, %ebx # Per protocol
+ xorl %ebp, %ebp # Per protocol
+ xorl %edi, %edi # Per protocol

movl %cr0, %edx
orb $1, %dl # Protected mode (PE) bit
movl %edx, %cr0
+ jmp 2f # Short jump to serialize
+2:

movw %cx, %ds
movw %cx, %es
@@ -48,7 +52,7 @@ protected_mode_jump:

# Jump to the 32-bit entrypoint
.byte 0x66, 0xea # ljmpl opcode
-2: .long 0 # offset
+3: .long 0 # offset
.word __BOOT_CS # segment

.size protected_mode_jump, .-protected_mode_jump