From ad2dc00309bec424d330659788b4c0d4a90c6bd6 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Fri, 25 Oct 2013 11:03:39 +0200 Subject: [PATCH] * grub-core/boot/i386/pc/startup_raw.S (grub_gate_a20): Remove argument. We don't disable Gate A20 in this code. --- ChangeLog | 5 ++++ grub-core/boot/i386/pc/startup_raw.S | 43 +++++++++------------------- 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7188f4e00..783b416a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-10-25 Vladimir Serbinenko + + * grub-core/boot/i386/pc/startup_raw.S (grub_gate_a20): Remove + argument. We don't disable Gate A20 in this code. + 2013-10-25 Vladimir Serbinenko * grub-core/boot/i386/qemu/boot.S: Ensure that A20 is enabled. diff --git a/grub-core/boot/i386/pc/startup_raw.S b/grub-core/boot/i386/pc/startup_raw.S index 06dec8c06..279674030 100644 --- a/grub-core/boot/i386/pc/startup_raw.S +++ b/grub-core/boot/i386/pc/startup_raw.S @@ -100,7 +100,6 @@ LOCAL (codestart): /* The ".code32" directive takes GAS out of 16-bit mode. */ .code32 - incl %eax cld call grub_gate_a20 @@ -124,7 +123,7 @@ LOCAL (codestart): .text /* - * grub_gate_a20(int on) + * grub_gate_a20(void) * * Gate address-line 20 for high memory. * @@ -134,12 +133,10 @@ LOCAL (codestart): */ grub_gate_a20: - movl %eax, %edx - gate_a20_test_current_state: /* first of all, test if already in a good state */ call gate_a20_check_state - cmpb %al, %dl + testb %al, %al jnz gate_a20_try_bios ret @@ -149,18 +146,15 @@ gate_a20_try_bios: call prot_to_real .code16 - movw $0x2400, %ax - testb %dl, %dl - jz 1f - incw %ax -1: int $0x15 + movw $0x2401, %ax + int $0x15 DATA32 call real_to_prot .code32 popl %ebp call gate_a20_check_state - cmpb %al, %dl + testb %al, %al jnz gate_a20_try_system_control_port_a ret @@ -172,20 +166,13 @@ gate_a20_try_system_control_port_a: /* fourth, try the system control port A */ inb $0x92 andb $(~0x03), %al - testb %dl, %dl - jz 6f orb $0x02, %al -6: outb $0x92 + outb $0x92 - /* When turning off Gate A20, do not check the state strictly, - because a failure is not fatal usually, and Gate A20 is always - on some modern machines. */ - testb %dl, %dl - jz 7f call gate_a20_check_state - cmpb %al, %dl + testb %al, %al jnz gate_a20_try_keyboard_controller -7: ret + ret gate_a20_flush_keyboard_buffer: inb $0x64 @@ -211,11 +198,8 @@ gate_a20_try_keyboard_controller: andb $0x02, %al jnz 4b - movb $0xdd, %al - testb %dl, %dl - jz 5f - orb $0x02, %al -5: outb $0x60 + movb $0xdf, %al + outb $0x60 call gate_a20_flush_keyboard_buffer /* output a dummy command (USB keyboard hack) */ @@ -224,7 +208,7 @@ gate_a20_try_keyboard_controller: call gate_a20_flush_keyboard_buffer call gate_a20_check_state - cmpb %al, %dl + testb %al, %al /* everything failed, so restart from the beginning */ jnz gate_a20_try_bios ret @@ -234,7 +218,7 @@ gate_a20_check_state: movl $100, %ecx 1: call 3f - cmpb %al, %dl + testb %al, %al jz 2f loop 1b 2: @@ -263,9 +247,8 @@ gate_a20_check_state: pushl %ebx addl $0x100000, %ebx movb (%ebx), %ch - /* this result is 1 if A20 is on or 0 if it is off */ + /* this result is 0 if A20 is on or 1 if it is off */ subb %ch, %al - xorb $1, %al /* restore the original */ popl %ebx movb %cl, (%ebx)