[GIT PULL] x86 setup: correct booting on 486DX4

From: H. Peter Anvin
Date: Sun Nov 04 2007 - 17:58:19 EST


Hi Linus; please pull:

git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-x86setup.git for-linus

H. Peter Anvin (1):
x86 setup: correct booting on 486DX4

arch/x86/boot/pmjump.S | 32 +++++++++++++++++++++-----------
1 files changed, 21 insertions(+), 11 deletions(-)

[Full diff and log follows]

commit ac3b37b78c5f0f0be0b476a35370650f7bad482f
Author: H. Peter Anvin <hpa@xxxxxxxxx>
Date: Sun Nov 4 14:33:41 2007 -0800

x86 setup: correct booting on 486DX4

Apparently, the 486DX4 does not correctly serialize a mov to %cr0, so
we really do need the far jump immediately afterwards. This means
losing the nice separation between 16- and 32-bit code, but c'est la
vie.

Also pass %ebx = %edi = %ebp = 0 to support future extension of the
32-bit boot protocol.

Signed-off-by: H. Peter Anvin <hpa@xxxxxxxxx>

diff --git a/arch/x86/boot/pmjump.S b/arch/x86/boot/pmjump.S
index 2e55923..17e6dec 100644
--- a/arch/x86/boot/pmjump.S
+++ b/arch/x86/boot/pmjump.S
@@ -28,27 +28,37 @@
* 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
+
+ xorl %edx, %edx
+ movw %cs, %dx
+ shll $4, %edx # Patch ljmpl instruction
+ addl %edx, 2f
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
+
+ .byte 0x66, 0xea # ljmpl opcode
+2: .long 3f # Offset
+ .word __BOOT_CS # Segment

- movw %cx, %ds
- movw %cx, %es
- movw %cx, %fs
- movw %cx, %gs
- movw %cx, %ss
+ .code32
+3:
+ movl %ecx, %ds
+ movl %ecx, %es
+ movl %ecx, %fs
+ movl %ecx, %gs
+ movl %ecx, %ss

# Jump to the 32-bit entrypoint
- .byte 0x66, 0xea # ljmpl opcode
-2: .long 0 # offset
- .word __BOOT_CS # segment
-
+ jmpl *%eax
+
.size protected_mode_jump, .-protected_mode_jump
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/