commit e2605403a50c63f77b37966679e3b198c15df7dd
parent 1533c040200b91f424200009a2511f54ac757947
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Tue, 27 Jun 2023 16:59:27 -0400
asm/nbank: new unit extracted from asm/i386
Diffstat:
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/fs/asm/i386.fs b/fs/asm/i386.fs
@@ -1,5 +1,6 @@
?f<< /lib/endian.fs
?f<< /asm/label.fs
+?f<< /asm/nbank.fs
\ "opcode+mod" structure (very close to i386 structure)
\ b2:0 regid
@@ -25,7 +26,7 @@
: regid@ 7 and ;
: mod@ 6 rshift 3 and ;
: modrm@ $c7 and ;
-: bankid@ 20 rshift $f and ;
+:realias bankid@ 20 rshift $f and ;
: sib@ 24 rshift ;
: imm? $8000 and bool ;
: 8b? bi $100 and not | $ff00 and $8300 = or ;
@@ -47,19 +48,6 @@
: _err asm$ abort" asm error" ;
: _assert not if _err then ;
-\ Number bank
-\ Immediate and displacement can take up to 32b and we want our arguments to
-\ have a predictable size on PS (1 item each). We can't just leave that extra
-\ number there. Having a single global value is limiting in terms of "macro-
-\ ability", so we have a rolling bank of 16 numbers down below.
-create _bank $10 CELLSZ * allot
-0 value _bankidx
-: newbankid to1+ _bankidx _bankidx $f and ;
-: bank' ( id -- a ) CELLSZ * _bank + ;
-: bank@ ( opmod -- n ) bankid@ bank' @ ;
-: oldbank! ( n -- ) drop ; \ realiased in i386h
-: newbankedop ( n -- opmod ) dup oldbank! newbankid tuck bank' ! 20 lshift ;
-
: r) $1c0 or to1+ _argcnt ;
: _ doer ( reg -- ) , does> @ ( reg ) $c0 or to1+ _argcnt ;
diff --git a/fs/asm/nbank.fs b/fs/asm/nbank.fs
@@ -0,0 +1,17 @@
+\ Number bank for use in assemblers and HALs
+\ Immediate and displacement can take up to 32b and we want our arguments to
+\ have a predictable size on PS (1 item each). We can't just leave that extra
+\ number there. Having a single global value is limiting in terms of "macro-
+\ ability", so we have a rolling bank of 16 numbers down below.
+create _bank $10 CELLSZ * allot
+0 value _bankidx
+: newbankid to1+ _bankidx _bankidx $f and ;
+: bank' ( id -- a ) CELLSZ * _bank + ;
+\ This needs to be realiased by the unit using the bank
+alias abort bankid@ ( opmod -- id )
+: bank@ ( opmod -- n ) bankid@ bank' @ ;
+\ This alias is to give the opportunity to HALs to update their kernel-level
+\ number bank (single) at the same time as the High HAL number bank. This word
+\ is realiased in High HAL units.
+alias drop oldbank! ( n -- )
+: newbankedop ( n -- opmod ) dup oldbank! newbankid tuck bank' ! 20 lshift ;