duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit 4233cb64177d65225be7103509a11905b43befde
parent 7a600617da64d1cbd324239190519fa1b12017db
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Sun,  6 Nov 2022 12:26:57 -0500

drv/pc/a20: add A20 enabling method through PS/2

This has been tested on real hardware with A20 initially not enabled.

Diffstat:
Mfs/drv/pc/a20.fs | 20+++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/fs/drv/pc/a20.fs b/fs/drv/pc/a20.fs @@ -1,12 +1,26 @@ \ A20 line unlocking +?f<< /asm/i386.fs \ Is A20 line enabled? : a20? $7dfe @ $107dfe @ <> ; -\ TODO: add A20 mitigation. In QEMU, the line is already active, so I can't -\ verify tweaks I would write here. +code _wait pc al $64 i) in, al 2 i) test, abs>rel jnz, ret, +code _wait2 pc al $64 i) in, al 1 i) test, abs>rel jz, ret, +: _cmd ( n -- ) ['] _wait abs>rel call, al i) mov, al $64 i) out, ; +code _unlockThroughPS2 + cli, $ad _cmd $d0 _cmd + ' _wait2 abs>rel call, + al $60 i) in, ax push, + $d1 _cmd + ' _wait abs>rel call, + ax pop, al 2 i) or, al $60 i) out, + $ae _cmd + ' _wait abs>rel call, + sti, ret, 32 $400 $400 * * const MEMTOP \ 32 MB ought to be enough for anybody -: a20$ a20? not if abort" A20 line can't be activated" then +: a20$ + a20? not if _unlockThroughPS2 then + a20? not if abort" A20 line can't be activated" then $100000 to here MEMTOP HEREMAX ! ;