~vdupras/duskos

a0189ddbc8638e2a16885e73116680ee531ff334 — Virgil Dupras 20 days ago 2dc039b
asm/i386: have pspush, and pspop, macros take opmod arguments
5 files changed, 114 insertions(+), 128 deletions(-)

M fs/asm/i386.fs
M fs/comp/c/vm/i386.fs
M fs/doc/asm/i386.txt
M fs/xcomp/i386/kernel.fs
M fs/xcomp/i386/pc/kernel.fs
M fs/asm/i386.fs => fs/asm/i386.fs +4 -9
@@ 56,10 56,6 @@ create _bank $10 CELLSZ * allot
: bank@ ( opmod -- n ) bankid@ bank' @ ;
: newbankedop ( n -- opmod ) newbankid tuck bank' ! 20 lshift ;

\ MOD/RM constants
0 const AX         1 const CX          2 const DX          3 const BX
4 const SP         5 const BP          6 const SI          7 const DI

: r) $1c0 or 1 to+ _argcnt ;

: _ doer ( reg -- ) , does> @ ( reg ) $c0 or 1 to+ _argcnt ;


@@ 259,8 255,7 @@ $e2 op loop,     $e1 op loopz,   $e0 op loopnz,
: [esi] si 0 d) ;
: ps+, bp CELLSZ i) sub, ;
: ps-, bp CELLSZ i) add, ;
: pspush, ( regid -- ) ps+, [ebp] swap $100 or r) mov, ;
: pspushN, ( n -- ) ps+, [ebp] swap i) mov, ;
: pspop, ( regid -- ) $100 or r) [ebp] mov, ps-, ;
\ equivalent to r1 pspop, then r2 pspop,
: pspop2, ( r1 r2 -- ) $100 or r) bp CELLSZ d) mov, $100 or r) [ebp] mov, bp CELLSZ << i) add, ;
: pspush, ( opmod -- ) ps+, [ebp] swap mov, ;
: pspop, ( opmod -- ) [ebp] mov, ps-, ;
\ equivalent to op1 pspop, then op2 pspop,
: pspop2, ( op1 op2 -- ) bp CELLSZ d) mov, r) [ebp] mov, bp CELLSZ << i) add, ;

M fs/comp/c/vm/i386.fs => fs/comp/c/vm/i386.fs +3 -0
@@ 12,6 12,9 @@
$cb const USABLEREGS \ 11001011 = di si bx cx ax
0 value regused \ a bit mask of register used.

\ i386 register ID constants
0 const AX         1 const CX          2 const DX          7 const DI

: regusable? ( regid -- f ) USABLEREGS swap bit? ;
: regused? ( regid -- f ) regused swap bit? ;
: reguse ( regid -- )

M fs/doc/asm/i386.txt => fs/doc/asm/i386.txt +0 -12
@@ 37,18 37,6 @@ cr0 cr2 cr3
dr0 dr1 dr2 dr3 dr6 dr7
tr6 tr7

## Dynamic register operand

If you want to specify a register in a dynamic manner, you can use the uppercase
versions of those registers specified below (which are simple constants that
yield the values to be encoded in the opcode) and use the "opreg!" word. For
example:

create mylist DX c, SI c, BP c,
mylist 2 + c@ r) inc,

would result in the equivalent of "bp inc," being written

## Immediate operand

    i) ( imm -- )

M fs/xcomp/i386/kernel.fs => fs/xcomp/i386/kernel.fs +100 -100
@@ 41,56 41,56 @@ L1 forward!
lblidt m) lidt, sti,
forward16 jmp, to L1

xcode IDT L2 pspushN, ret,
xcode CALLSZ 5 pspushN, ret,
xcode BRSZ 5 pspushN, ret,
xcode ?BRSZ 14 pspushN, ret,
xcode IDT L2 i) pspush, ret,
xcode CALLSZ 5 i) pspush, ret,
xcode BRSZ 5 i) pspush, ret,
xcode ?BRSZ 14 i) pspush, ret,

xcode noop pc to lblret ret,

xcode (cell)
  ax pop,
  AX pspush,
  ax pspush,
  ret,

xcode (does)
  ax pop,
  bx ax mov,
  bx CELLSZ i) add,
  BX pspush,
  bx pspush,
  ax 0 d) jmp,

xcode (s)
  si pop,          \ addr of str
  SI pspush,
  si pspush,
  ax ax xor,
  lodsb,           \ len
  si ax add,       \ ret to PC right after str
  si jmp,

xcode herestart
  HERESTART pspushN,
  HERESTART i) pspush,
  ret,

pc HEREMAX ,
xcode HEREMAX
  ( pc ) pspushN,
  ( pc ) i) pspush,
  ret,

pc to lblhere HERESTART ,
xcode HERE
  lblhere pspushN,
  lblhere i) pspush,
  ret,

pc to lblsysdict 0 , 0 c, \ 1b zero len field. see doc/arch
xcode sysdict
  lblsysdict pspushN,
  lblsysdict i) pspush,
  ret,

pc to lblcompiling 0 ,
xcode compiling
  ax lblcompiling m) mov,
  AX pspush,
  ax pspush,
  ret,

xcode quit


@@ 110,12 110,12 @@ xcode exit
  ret,

xcode execute
  AX pspop,
  ax pspop,
  ax jmp,

xcode dup ( a -- a a )
  ax [ebp] mov,
  AX pspush,
  ax pspush,
  ret,

xcode ?dup ( a -- a? a )


@@ 132,7 132,7 @@ xcode swap ( a b -- b a )

xcode over ( a b -- a b a )
  ax bp CELLSZ d) mov,
  AX pspush,
  ax pspush,
  ret,

xcode rot ( a b c -- b c a )


@@ 145,7 145,7 @@ xcode rot ( a b c -- b c a )
  ret,

xcode nip ( a b - b )
  AX pspop,
  ax pspop,
  [ebp] ax mov,
  ret,



@@ 154,7 154,7 @@ xcode tuck ( a b -- b a b )
  bx bp CELLSZ d) mov,
  [ebp] bx mov,
  bp CELLSZ d) ax mov,
  AX pspush,
  ax pspush,
  ret,

xcode rot> ( a b c -- c a b )


@@ 170,7 170,7 @@ xcode scnt
  ax PSTOP i) mov,
  ax bp sub,
  ax 16b) 2 i) shr, \ div by 4, preserve neg
  AX pspush,
  ax pspush,
  ret,

xcode rcnt


@@ 178,7 178,7 @@ xcode rcnt
  ax sp sub,
  ax 16b) 2 i) shr, \ div by 4, preserve neg
  ax dec,           \ ignore this call
  AX pspush,
  ax pspush,
  ret,

xcode 1+


@@ 190,17 190,17 @@ xcode 1-
  ret,

xcode +
  AX pspop,
  ax pspop,
  [ebp] ax add,
  ret,

xcode -
  AX pspop,
  ax pspop,
  [ebp] ax sub,
  ret,

xcode *
  AX pspop,
  ax pspop,
  [ebp] mul,
  [ebp] ax mov,
  ret,


@@ 214,39 214,39 @@ xcode /mod ( a b -- r q )
  ret,

xcode <<c
  0 pspushN,
  0 i) pspush,
  bp CELLSZ d) 1 i) shl,
  [ebp] setc,
  ret,

xcode >>c
  0 pspushN,
  0 i) pspush,
  bp CELLSZ d) 1 i) shr,
  [ebp] setc,
  ret,

xcode lshift ( n u -- n )
  CX pspop,
  cx pspop,
  [ebp] cl shl,
  ret,

xcode rshift ( n u -- n )
  CX pspop,
  cx pspop,
  [ebp] cl shr,
  ret,

xcode and
  AX pspop,
  ax pspop,
  [ebp] ax and,
  ret,

xcode or
  AX pspop,
  ax pspop,
  [ebp] ax or,
  ret,

xcode xor
  AX pspop,
  ax pspop,
  [ebp] ax xor,
  ret,



@@ 265,7 265,7 @@ xcode not
  ret,

xcode <
  AX pspop,
  ax pspop,
  [ebp] ax sub,
  [ebp] 0 i) mov,
  [ebp] setc,


@@ 293,36 293,36 @@ xcode @ ( a -- n )
  ret,

xcode c!
  AX BX pspop2, \ ax=a bx=n
  ax bx pspop2, \ ax=a bx=n
  ax 0 d) bl mov,
  ret,

pc 0 , EMETA_8B ,
  xwordlbl c! absjmp,
pc nextmeta ! ( pc ) , EMETA_16B ,
  AX BX pspop2, \ ax=a bx=n
  ax bx pspop2, \ ax=a bx=n
  ax 0 d) 16b) bx mov,
  ret,
xcode ! ( n a -- )
  AX BX pspop2, \ ax=a bx=n
  ax bx pspop2, \ ax=a bx=n
  ax 0 d) bx mov,
  ret,

pc 0 , EMETA_8B ,
  AX BX pspop2, \ ax=a bx=n
  ax bx pspop2, \ ax=a bx=n
  ax 0 d) bl add,
  ret,
pc nextmeta ! ( pc ) , EMETA_16B ,
  AX BX pspop2, \ ax=a bx=n
  ax bx pspop2, \ ax=a bx=n
  ax 0 d) 16b) bx add,
  ret,
xcode +! ( n a -- )
  AX BX pspop2, \ ax=a bx=n
  ax bx pspop2, \ ax=a bx=n
  ax 0 d) bx add,
  ret,

xcode c,
  AX pspop,    \ ax=n
  ax pspop,    \ ax=n
pc to lblcwrite \ al=c preserves bx
  si lblhere m) mov,
  [esi] al mov,


@@ 332,13 332,13 @@ pc to lblcwrite \ al=c preserves bx
pc 0 , EMETA_8B ,
  xwordlbl c, absjmp,
pc nextmeta ! ( pc ) , EMETA_16B ,
  AX pspop,    \ ax=n
  ax pspop,    \ ax=n
  si lblhere m) mov,
  [esi] 16b) ax mov,
  lblhere m) 2 i) add,
  ret,
xcode ,
  AX pspop,    \ ax=n
  ax pspop,    \ ax=n
pc to lblwrite \ ax=n
  si lblhere m) mov,
  [esi] ax mov,


@@ 353,7 353,7 @@ xcode pc@ ( port -- n8 )
  ret,

xcode pc! ( n8 port -- )
  DX AX pspop2,
  dx ax pspop2,
  al dx out,
  ret,



@@ 365,7 365,7 @@ xcode pw@ ( port -- n16 )
  ret,

xcode pw! ( n16 port -- )
  DX AX pspop2,
  dx ax pspop2,
  ax 16b) dx out,
  ret,



@@ 377,20 377,20 @@ xcode p@ ( port -- n32 )
  ret,

xcode p! ( n32 port -- )
  DX AX pspop2,
  dx ax pspop2,
  ax dx out,
  ret,

xcode move ( src dst u -- )
  CX pspop,
  DI SI pspop2,
  cx pspop,
  di si pspop2,
  cx cx test,
  lblret abs>rel jz,
  rep, movsb,
  ret,

xcode move, ( src u -- )
  CX SI pspop2,
  cx si pspop2,
  cx cx test,
  lblret abs>rel jz,
pc to lblmovewrite \ esi=a ecx=u


@@ 400,7 400,7 @@ pc to lblmovewrite \ esi=a ecx=u
  ret,

xcode []= ( a1 a2 u -- f )
  CX DI pspop2,
  cx di pspop2,
  si [ebp] mov,
  ax ax xor,
  repz, cmpsb,


@@ 409,7 409,7 @@ xcode []= ( a1 a2 u -- f )
  ret,

xcode align4 ( n -- )
  AX pspop,
  ax pspop,
  ax lblhere m) add,
  ax 3 i) and,
  lblret abs>rel jz,


@@ 419,20 419,20 @@ xcode align4 ( n -- )

pc to lbl[rcnt] 0 ,
xcode [rcnt]
  lbl[rcnt] pspushN,
  lbl[rcnt] i) pspush,
  ret,

pc 2 nc, $83 $c4 ( XX ) \ sp XX i) add,
xcode r+, ( n -- )
  ( pc ) 2 movewrite,
  AX pspop,
  ax pspop,
  lbl[rcnt] m) ax add,
  lblcwrite absjmp,

pc 2 nc, $83 $c5 ( XX ) \ bp XX i) add,
xcode p+, ( n -- )
  ( pc ) 2 movewrite,
  AX pspop,
  ax pspop,
  lblcwrite absjmp,

pc 3 nc, $58 $ff $d0 \ ax pop, ax call,


@@ 446,8 446,8 @@ xcode rtype xwordlbl (abort) absjmp,
\ through boot<.
pc ," boot failure"
xcode abort
  ( pc ) pspushN,
  12 pspushN,
  ( pc ) i) pspush,
  12 i) pspush,
  wcall, rtype
  0 jmp,



@@ 456,7 456,7 @@ xcode boot<
  si lblbootptr m) mov,
  ax [esi] 8b) movzx,
  lblbootptr m) inc,
  AX pspush,
  ax pspush,
  ret,

\ where "word" feeds itself


@@ 465,17 465,17 @@ xcode in< xwordlbl boot< absjmp,

pc to lblnextword 0 ,
xcode NEXTWORD
  lblnextword pspushN,
  lblnextword i) pspush,
  ret,

pc to lblcurword $20 allot0
xcode curword
  lblcurword pspushN,
  lblcurword i) pspush,
  ret,

pc to L1 ( word_eof )
  ax ax xor,
  AX pspush,
  ax pspush,
  ret,

pc \ we have a nonzero lblnextword


@@ 486,7 486,7 @@ pc \ we have a nonzero lblnextword
  cl inc,
  di lblcurword i) mov,
  rep, movsb,
  lblcurword pspushN,
  lblcurword i) pspush,
  ret,

xcode maybeword ( -- str-or-0 )


@@ 494,7 494,7 @@ xcode maybeword ( -- str-or-0 )
  ( pc ) abs>rel jnz,
pc ( loop1 )
  wcall, in<
  AX pspop,
  ax pspop,
  ax ax test,
  L1 ( word_eof ) abs>rel js,
  ax SPC 1+ i) cmp, \ is ws?


@@ 506,7 506,7 @@ pc ( loop2 )
  bx push,
  wcall, in<
  bx pop,
  AX pspop,
  ax pspop,
  ax ax test,
  forward js, to L1 ( stoploop )
  ax SPC 1+ i) cmp, \ is ws?


@@ 514,7 514,7 @@ pc ( loop2 )
L1 forward! ( stoploop )
  bx lblcurword 1+ i) sub,
  lblcurword m) bl mov,
  lblcurword pspushN,
  lblcurword i) pspush,
  ret,

pc ," word expected"


@@ 525,13 525,13 @@ xcode word
  cx 13 i) mov,
  si swap ( pc ) i) mov,
pc to lblerrmsg \ exc=sl esi=sa
  SI pspush,
  CX pspush,
  si pspush,
  cx pspush,
  wcall, rtype
  xwordlbl abort absjmp,

xcode findmeta ( id ll -- ll-or-0 )
  AX pspop,
  ax pspop,
  bx [ebp] mov,
pc to L1
  ax ax test,


@@ 546,7 546,7 @@ forward! forward!

pc to lblmod 0 ,
xcode MOD
  lblmod pspushN,
  lblmod i) pspush,
  ret,

xcode findmod ( w -- w )


@@ 555,9 555,9 @@ xcode findmod ( w -- w )
  ax [ebp] mov,
  ax 9 i) sub,
  bx lblmod m) mov,
  BX pspush, AX pspush,
  bx pspush, ax pspush,
  wcall, findmeta
  AX pspop,
  ax pspop,
  ax ax test,
  forward8 jz,
    lblmod m) 0 i) mov,


@@ 567,7 567,7 @@ xcode findmod ( w -- w )
  ret,

xcode find ( str 'dict -- word-or-0 )
  DX pspop,
  dx pspop,
pc to lblfind
  si [ebp] mov,
  cx [esi] 8b) movzx,


@@ 600,9 600,9 @@ L1 forward! ( skip1 )

pc ,"  word not found"
xcode (wnf)
  lblcurword 1+ pspushN,
  lblcurword 1+ i) pspush,
  cx lblcurword m) 8b) movzx,
  CX pspush,
  cx pspush,
  wcall, rtype
  cx 15 i) mov,
  si swap ( pc ) i) mov,


@@ 628,7 628,7 @@ xcode ' ( "name" -- w )
  ax ax xor,
  al si 1 d) mov,
  [ebp] ax mov,
  1 pspushN,
  1 i) pspush,
  ret,

0 align4 pc to lblparseh ( str  -- n? f ) \ esi=sa ecx=sl


@@ 656,7 656,7 @@ L2 forward! \ parse ok
  si inc,
  ( pc ) abs>rel loop, ( loop )
  [ebp] ax mov,
  1 pspushN,
  1 i) pspush,
  ret,

0 align4 pc to lblparseud ( str  -- n? f ) \ esi=sa ecx=sl


@@ 675,7 675,7 @@ pc ( loop )
  si inc,
  ( pc ) abs>rel loop, ( loop )
  [ebp] ax mov,
  1 pspushN,
  1 i) pspush,
  ret,

xcode parse ( str -- n? f )


@@ 721,7 721,7 @@ pc

xcode ,"
  wcall, "<
  AX pspop,
  ax pspop,
  ax ax test,
  lblret abs>rel js,
  xwordlbl ," i) push,


@@ 729,7 729,7 @@ xcode ,"

pc to lblnextmeta 0 ,
xcode nextmeta
  lblnextmeta pspushN,
  lblnextmeta i) pspush,
  ret,

pc 6 nc, $83 $ed $04 $c7 $45 $00 ( XX ) \ bp 4 i) sub, [ebp] XX i) mov,


@@ 747,7 747,7 @@ pc to lblrelwr \ ax=abs addr
  lblwrite absjmp,

xcode execute,
  BX pspop,
  bx pspop,
  lblcallwr absjmp,

xcode exit,


@@ 756,25 756,25 @@ xcode exit,

xcode branch,
  al $e9 ( jmp ) i) mov, lblcwrite abscall,
  AX pspop,
  ax pspop,
  lblrelwr abscall,
  ax lblhere m) mov,
  ax 4 i) sub,
  AX pspush,
  ax pspush,
  ret,

pc 10 nc, $8b $45 $00 $83 $c5 $04 $85 $c0 $0f $84 \ AX pspop, ax ax test, XX jz,
pc 10 nc, $8b $45 $00 $83 $c5 $04 $85 $c0 $0f $84 \ ax pspop, ax ax test, XX jz,
xcode ?branch,
  ( pc ) 10 movewrite,
  AX pspop,
  ax pspop,
  lblrelwr abscall,
  ax lblhere m) mov,
  ax 4 i) sub,
  AX pspush,
  ax pspush,
  ret,

xcode branch!
  AX BX pspop2, \ ax=a bx=n
  ax bx pspop2, \ ax=a bx=n
  bx ax sub,    \ displacement
  bx 4 i) sub,  \ ... from *after* call/jmp op
  ax 0 d) bx mov,


@@ 812,37 812,37 @@ xcode [A]+,

pc to L1 \ 8b A@
  ax di 0 d) 8b) movzx,
  AX pspush,
  ax pspush,
  ret,
pc 0 , EMETA_8B ,
  bx L1 i) mov, lblcallwr absjmp,
pc to L1 \ 16b A@
  ax di 0 d) movzx,
  AX pspush,
  ax pspush,
  ret,
pc nextmeta ! ( pc ) , EMETA_16B ,
  bx L1 i) mov, lblcallwr absjmp,
pc to L1 \ A@
  ax di 0 d) mov,
  AX pspush,
  ax pspush,
  ret,
xcode A@,
  bx L1 i) mov, lblcallwr absjmp,

pc to L1 \ 8b A!
  AX pspop,
  ax pspop,
  di 0 d) al mov,
  ret,
pc 0 , EMETA_8B ,
  bx L1 i) mov, lblcallwr absjmp,
pc to L1 \ 16b A!
  AX pspop,
  ax pspop,
  di 0 d) 16b) ax mov,
  ret,
pc nextmeta ! ( pc ) , EMETA_16B ,
  bx L1 i) mov, lblcallwr absjmp,
pc to L1 \ A!
  AX pspop,
  ax pspop,
  di 0 d) ax mov,
  ret,
xcode A!,


@@ 873,19 873,19 @@ xcode A@!,
  bx L1 i) mov, lblcallwr absjmp,

pc to L1 \ 8b A+!
  AX pspop,
  ax pspop,
  di 0 d) al add,
  ret,
pc 0 , EMETA_8B ,
  bx L1 i) mov, lblcallwr absjmp,
pc to L1 \ 16b A+!
  AX pspop,
  ax pspop,
  di 0 d) 16b) ax add,
  ret,
pc nextmeta ! ( pc ) , EMETA_16B ,
  bx L1 i) mov, lblcallwr absjmp,
pc to L1 \ A+!
  AX pspop,
  ax pspop,
  di 0 d) ax add,
  ret,
xcode A+!,


@@ 894,42 894,42 @@ xcode A+!,
pc to L1 \ 8b [A]@
  ax di 0 d) mov,
  ax ax 0 d) 8b) movzx,
  AX pspush,
  ax pspush,
  ret,
pc 0 , EMETA_8B ,
  bx L1 i) mov, lblcallwr absjmp,
pc to L1 \ 16b [A]@
  ax di 0 d) mov,
  ax ax 0 d) movzx,
  AX pspush,
  ax pspush,
  ret,
pc nextmeta ! ( pc ) , EMETA_16B ,
  bx L1 i) mov, lblcallwr absjmp,
pc to L1 \ [A]@
  ax di 0 d) mov,
  ax ax 0 d) mov,
  AX pspush,
  ax pspush,
  ret,
xcode [A]@,
  bx L1 i) mov, lblcallwr absjmp,

pc to L1 \ 8b [A]!
  bx di 0 d) mov,
  AX pspop,
  ax pspop,
  bx 0 d) al mov,
  ret,
pc 0 , EMETA_8B ,
  bx L1 i) mov, lblcallwr absjmp,
pc to L1 \ 16b [A]!
  bx di 0 d) mov,
  AX pspop,
  ax pspop,
  bx 0 d) 16b) ax mov,
  ret,
pc nextmeta ! ( pc ) , EMETA_16B ,
  bx L1 i) mov, lblcallwr absjmp,
pc to L1 \ [A]!
  bx di 0 d) mov,
  AX pspop,
  ax pspop,
  bx 0 d) ax mov,
  ret,
xcode [A]!,


@@ 952,7 952,7 @@ xcode stack?
  lblerrmsg absjmp,

pc to L2 \ find in sys dict
  lblcurword pspushN,
  lblcurword i) pspush,
  dx lblsysdict m) mov,
  lblfind abscall,
  [ebp]z?


@@ 965,7 965,7 @@ pc to L1 \ execute imm word

xcode compword ( str -- )
  wcall, parse
  AX pspop,
  ax pspop,
  ax ax test,
  xwordlbl litn abs>rel jnz, \ literal: jump to litn
  \ not a literal, find and compile


@@ 981,12 981,12 @@ xcode runword ( str -- ) pc w>e lblsysdict pc>addr !
  lblcompiling m) -1 i) test,
  xwordlbl compword abs>rel jnz,
  wcall, parse
  AX pspop,
  ax pspop,
  ax ax test,
  xwordlbl noop abs>rel jnz, \ literal: nothing to do
  \ not a literal, find and execute
  L2 abscall,
  AX pspop,
  ax pspop,
  ax call,
  xwordlbl stack? absjmp,


M fs/xcomp/i386/pc/kernel.fs => fs/xcomp/i386/pc/kernel.fs +7 -7
@@ 23,17 23,17 @@ pc to L4 \ segment with ffff limits
0 to realmode

xcode int13h ( drv head cyl sec dst -- )
  BX pspop,
  AX pspop, cl al mov, \ sec
  AX pspop, ch al mov, \ cyl
  AX pspop, dh al mov, \ head
  AX pspop, dl al mov, \ drive
  bx pspop,
  ax pspop, cl al mov, \ sec
  ax pspop, ch al mov, \ cyl
  ax pspop, dh al mov, \ head
  ax pspop, dl al mov, \ drive
  cli, $18 L4 jmpfar,

pc to L1 \ back to protected mode!
  \ we still need to push di, bx and ax
  dx $10 i) mov, ds dx mov, ss dx mov, es dx mov, gs dx mov, fs dx mov,
  BX pspush, AX pspush,
  bx pspush, ax pspush,
  lblidt m) lidt, sti,
  \ restore PIC masks
  ax pop, al $a1 i) out, al ah mov, al $21 i) out,


@@ 58,7 58,7 @@ xcode int10h ( cx/dx bx ax -- bx ax )
  \ save PIC masks and disable PIC for duration of int10h
  al $21 i) in, ah al mov, al $a1 i) in, ax push,
  al $ff i) mov, al $21 i) out, al $a1 i) out,
  AX pspop, BX pspop, CX pspop, cli, $18 L4 jmpfar,
  ax pspop, bx pspop, cx pspop, cli, $18 L4 jmpfar,

\ To avoid lockups, we map all PIC IRQs on boot to words that acknowledge those
\ IRQs. The rest of PIC initialization is done in /drv/pc/pic.fs