[FREELDR]

Move EnableA20 to realmode code, remove DisableA20

svn path=/trunk/; revision=52225
This commit is contained in:
Timo Kreuzer
2011-06-14 08:10:59 +00:00
parent cbeac4750e
commit 2d003a9075
3 changed files with 12 additions and 67 deletions
+3 -61
View File
@@ -211,69 +211,11 @@ inrmode:
ret
/*
* Needed for enabling the a20 address line
*/
.code16
empty_8042:
.word 0x00eb,0x00eb // jmp $+2, jmp $+2
in al, HEX(64)
cmp al, HEX(ff) // legacy-free machine without keyboard
jz empty_8042_ret // controllers on Intel Macs read back 0xFF
test al, 2
jnz empty_8042
empty_8042_ret:
ret
/*
* Enable the A20 address line (to allow access to over 1mb)
*/
EXTERN(_EnableA20)
.code32
PUBLIC _EnableA20
_EnableA20:
ret
pusha
call switch_to_real
.code16
call empty_8042
mov al, HEX(D1) // command write
out HEX(64), al
call empty_8042
mov al, HEX(DF) // A20 on
out HEX(60), al
call empty_8042
call switch_to_prot
.code32
popa
ret
/*
* Disable the A20 address line
*/
EXTERN(_DisableA20)
.code32
pusha
call switch_to_real
.code16
call empty_8042
mov al, HEX(D1) // command write
out HEX(64), al
call empty_8042
mov al, HEX(DD) // A20 off
out HEX(60), al
call empty_8042
call switch_to_prot
.code32
popa
ret
/* Multiboot support
*
@@ -3,21 +3,21 @@ Empty8042:
.word 0x00eb,0x00eb // jmp $+2, jmp $+2
in al, 0x64
cmp al, 0xff // legacy-free machine without keyboard
jz empty_8042_ret // controllers on Intel Macs read back 0xFF
jz Empty8042_ret // controllers on Intel Macs read back 0xFF
test al, 0x02
jnz x86_16_Empty8042
empty_8042_ret:
jnz Empty8042
Empty8042_ret:
ret
EnableA20:
pusha
call x86_16_Empty8042
call Empty8042
mov al, 0xD1 // command write
out 0x64, al
call x86_16_Empty8042
call Empty8042
mov al, 0xDF // A20 on
out 0x60, al
call x86_16_Empty8042
call Empty8042
popa
ret
@@ -27,6 +27,9 @@ RealModeEntryPoint:
/* Setup the stack */
mov sp, word ptr ds:stack16
/* Enable A20 address line */
call EnableA20
/* Get address of optional header */
mov eax, dword ptr ds:[FREELDR_PE_BASE + IMAGE_DOS_HEADER_e_lfanew]
add eax, FREELDR_PE_BASE + 4 + IMAGE_FILE_HEADER_SIZE