duskos

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

commit 0e35d6bdffd914d09ec9770a9c3557756d1a6603
parent 2ccd6bf24511e13887e3fd70a6811ae65c09c126
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Sat, 20 Aug 2022 07:40:44 -0400

drv/pc/ata: implement tight loops in assembler

Diffstat:
Mfs/drv/pc/ata.fs | 23+++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/fs/drv/pc/ata.fs b/fs/drv/pc/ata.fs @@ -1,5 +1,6 @@ \ ATA driver ?f<< /lib/nfmt.fs +?f<< /asm/i386.fs $200 const ATASECSZ 0 value atabus \ 0=primary 1=secondary @@ -42,13 +43,27 @@ $ec const IDENTIFY dup 8 rshift _cyllo pc! 16 rshift _cylhi pc! ; +code _ ( dst port -- ) + dx bp 0 d) mov, di bp 4 d) mov, bp CELLSZ << i) add, + cx $100 i) mov, pc + 16b! ax dx in, + 16b! di 0 d) ax mov, + di inc, di inc, cx dec, + ( pc ) abs>rel jnz, ret, + : ata@ ( sec dst drv -- ) - drop swap _locate $20 ( read sectors ) _cmd pc! _wait ( dst ) - A>r >A $100 >r begin _data pw@ A> w! A+ A+ next r>A ; + drop swap _locate $20 ( read sectors ) _cmd pc! _wait ( dst ) _data _ ; + +code _ ( src port -- ) + dx bp 0 d) mov, di bp 4 d) mov, bp CELLSZ << i) add, + cx $100 i) mov, pc + 16b! ax di 0 d) mov, + 16b! ax dx out, + di inc, di inc, cx dec, + ( pc ) abs>rel jnz, ret, : ata! ( sec src drv -- ) - drop swap _locate $30 ( write sectors ) _cmd pc! _wait ( src ) - A>r >A $100 >r begin A> w@ _data pw! A+ A+ next r>A + drop swap _locate $30 ( write sectors ) _cmd pc! _wait ( src ) _data _ $e7 ( flush cache ) _cmd pc! _wait ; : .ata ( -- ) atabus . ':' emit atadrive . spc> ataidentify .x1 ;