9boot a20 gate

This commit is contained in:
cinap_lenrek 2011-04-12 23:43:22 +00:00
parent 68a2c676b5
commit 09f65c50f8
3 changed files with 69 additions and 9 deletions

67
sys/src/boot/pc/a20.s Normal file
View file

@ -0,0 +1,67 @@
#include "x16.h"
#undef ORB
TEXT a20(SB), $0
CALL rmode16(SB)
STI
LWI(0x2401, rAX)
BIOSCALL(0x15)
JC _biosfail
CLI
CALL16(pmode32(SB))
RET
_biosfail:
LWI((0x0E00|'!'), rAX)
BIOSCALL(0x10);
CLI
CALL16(pmode32(SB))
CALL a20wait(SB)
MOVL $0x64, DX
MOVB $0xAD, AL
OUTB
CALL a20wait(SB)
MOVL $0x64, DX
MOVB $0xD0, AL
OUTB
CALL a20wait2(SB)
MOVL $0x60, DX
INB
PUSHL AX
CALL a20wait(SB)
MOVL $0x64, DX
MOVB $0xD1, AL
OUTB
CALL a20wait(SB)
MOVL $0x60, DX
POPL AX
ORB $2, AL
OUTB
CALL a20wait(SB)
MOVL $0x64, DX
MOVB $0xAE, AL
OUTB
TEXT a20wait(SB), $0
_a20wait:
MOVL $0x64, DX
INB
TESTB $1, AL
JZ _a20wait2
RET
TEXT a20wait2(SB), $0
_a20wait2:
MOVL $0x64, DX
INB
TESTB $2, AL
JNZ _a20wait
RET

View file

@ -111,13 +111,6 @@ _pret32:
ANDL $0xFFFF, AX
RET
TEXT a20(SB), $0
CALL rmode16(SB)
STI
LWI(0x2401, rAX)
BIOSCALL(0x15)
JMP _pret32
#ifdef PXE
TEXT pxecallret(SB), $0

View file

@ -36,7 +36,7 @@ pbs: pbs.$O
$LD -o $target -H3 -T0x0600 -l $prereq
ls -l $target
9boot&: l%.$O %.$O sub.$O
9boot&: l%.$O %.$O sub.$O a20.$O
$LD -o $target -H3 -T0x7c00 -l $prereq
ls -l $target
@ -59,7 +59,7 @@ test.iso: 9bootiso
touch tmp/baz
touch tmp/386aaa
mkdir tmp/386
cp /386/9bootiso tmp/386
cp 386/9bootiso tmp/386
cp /386/9pc tmp/386
cp /386/9pcload tmp/386
cp /386/9pcf tmp/386