duskos

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

commit 1bc98dcabd2f6478a3d9ece945a017586ddf761e
parent 480b36119bf0270c844dde205202932e439ef388
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Tue, 27 Jun 2023 15:34:28 -0400

asm/armh: ARM High HAL first steps

test1-test8 pass in tests/asm/hal

Diffstat:
Mfs/asm/arm.fs | 3++-
Afs/asm/armh.fs | 16++++++++++++++++
Mfs/asm/hal.fs | 1+
Mfs/xcomp/arm/rpi/kernel.fs | 2++
4 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/fs/asm/arm.fs b/fs/asm/arm.fs @@ -99,7 +99,8 @@ $90 al) const mul) \ b19:16 Rn \ b21:20 Zeroes \ b22 8-bit if set -\ b24:23 Zeroes +\ b23 Inverted destination <>) +\ b24 Dereferenced source &) \ b25 Immediate if set \ b26 32-bit if set, 16-bit if unset \ b27 Zero diff --git a/fs/asm/armh.fs b/fs/asm/armh.fs @@ -0,0 +1,16 @@ +\ High HAL for arm +\ W=r9 A=r11 PSP=r10 RSP=13 +?f<< /asm/arm.fs + +: A>) ( halop -- halop ) $ffff0fff and rA 12 lshift or ; +: <>) ( halop -- halop ) $00800000 xor ; +: &) ( halop -- halop ) $01000000 xor ; + +: ldrr0, ( halop -- ) 16 rshift $f and ldr) r0 rd) swap rn) ,) ; +: haldst ( halop -- dst ) 12 rshift $f and ; + +: op doer , does> @ ( halop instr ) + over ldrr0, swap haldst rdn) r0 rm) f) ,) ; +sub) op -, + +: *, dup ldrr0, haldst mul) over rd) swap rs) r0 rm) ,) ; diff --git a/fs/asm/hal.fs b/fs/asm/hal.fs @@ -1,2 +1,3 @@ \ The HAL is provided by assemblers ARCH S" i386" s= [if] ?f<< /asm/i386h.fs [then] +ARCH S" arm" s= [if] ?f<< /asm/armh.fs [then] diff --git a/fs/xcomp/arm/rpi/kernel.fs b/fs/xcomp/arm/rpi/kernel.fs @@ -423,6 +423,8 @@ HALBASE rSP rn) xconst RSP) 0 le) xconst s<=) pc to lblhbank 0 le, +lblhbank xaddr HBANK + pc HALBASE $10 or le, \ b4 is set xcode m) ( a -- operand ) lblhbank r0 pc>reg,