diff --git a/ChangeLog b/ChangeLog index 7df7c4219..2fe222616 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-07-21 Bean + + * kern/i386/pc/startup.S (gate_a20_try_bios): Change test order for + a20. Run keyboard test last, as it will cause macbook to halt. + 2008-07-18 Pavel Roskin * kern/dl.c: Go back to using GRUB_CPU_SIZEOF_VOID_P. We cannot diff --git a/kern/i386/pc/startup.S b/kern/i386/pc/startup.S index 8f420ccdc..75c46adee 100644 --- a/kern/i386/pc/startup.S +++ b/kern/i386/pc/startup.S @@ -386,9 +386,32 @@ gate_a20_try_bios: popl %ebp call gate_a20_check_state cmpb %al, %dl - jnz gate_a20_try_keyboard_controller + jnz gate_a20_try_system_control_port_a ret +gate_a20_try_system_control_port_a: + /* + * In macbook, the keyboard test would hang the machine, so we move + * this forward. + */ + /* fourth, try the system control port A */ + inb $0x92 + andb $(~0x03), %al + testb %dl, %dl + jz 6f + orb $0x02, %al +6: 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 + jnz gate_a20_try_keyboard_controller +7: ret + gate_a20_flush_keyboard_buffer: inb $0x64 andb $0x02, %al @@ -425,30 +448,11 @@ gate_a20_try_keyboard_controller: outb $0x64 call gate_a20_flush_keyboard_buffer - call gate_a20_check_state - cmpb %al, %dl - jnz gate_a20_try_system_control_port_a - ret - -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 - - /* 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 /* everything failed, so restart from the beginning */ jnz gate_a20_try_bios -7: ret + ret gate_a20_check_state: /* iterate the checking for a while */