commit 9f3eee2a1b785ea9a645a210aaafa80d8229c99f
parent a512788c13cf1a37ba971d593afc49e92e31718b
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Tue, 20 Jun 2023 16:41:44 -0400
rpi hal: fix broken offset logic on 16b @, and !,
Diffstat:
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/fs/xcomp/arm/rpi/kernel.fs b/fs/xcomp/arm/rpi/kernel.fs
@@ -569,13 +569,18 @@ pc to L2 \ rTOP=operand
L1 abs>rel b) ,)
\ operand is 16b
-pc to L3 ( operand -- ) \ r0=base instr r1=off
+pc to L3 ( operand -- ) \ r0=base instr
orr) r0 rdn) $b0 i) ,) \ make into a ldrh/strh op
bic) r0 rdn) $04000000 i) ,)
orr) r0 rdn) $00400000 i) ,) \ immediate
- \ TODO: support offsets > 0xf
tst) rTOP rn) $8 i) ,) \ has offset?
- orr) nz) r0 rdn) r1 rm) ,) \ apply immediate offset
+ lblhbank r1 pc@>reg,
+ bic) nz) rTOP rdn) $3f i) ,) \ clear offset+imm flags
+ mov) nz) r2 rd) r1 rm) 4 lsl) ,) \ imm high nibble
+ and) nz) r1 rdn) $f i) ,)
+ and) nz) r2 rdn) $f00 i) ,)
+ orr) nz) r0 rdn) r1 rm) ,) \ apply low nibble
+ orr) nz) r0 rdn) r2 rm) ,) \ apply high nibble
L1 abs>rel b) ,)
pc to L4 ( operand -- ) \ r0=base instr