summaryrefslogtreecommitdiff
path: root/lib/Language/Elna/Architecture/RiscV.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2024-09-15 23:03:25 +0200
committerEugen Wissner <belka@caraus.de>2024-09-15 23:03:25 +0200
commitc9ff4f0a2a2cfa31964a307c08f9baa349565bbd (patch)
tree780fd5b416c9c8a54b0d7933a70a2d49e4c8d549 /lib/Language/Elna/Architecture/RiscV.hs
parentd29012d30e158edc28d4467b69a95b5a3c68f04d (diff)
downloadelna-c9ff4f0a2a2cfa31964a307c08f9baa349565bbd.tar.gz
Add call pseudo instruction
Diffstat (limited to 'lib/Language/Elna/Architecture/RiscV.hs')
-rw-r--r--lib/Language/Elna/Architecture/RiscV.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Language/Elna/Architecture/RiscV.hs b/lib/Language/Elna/Architecture/RiscV.hs
index 9964911..4ee516d 100644
--- a/lib/Language/Elna/Architecture/RiscV.hs
+++ b/lib/Language/Elna/Architecture/RiscV.hs
@@ -150,6 +150,7 @@ data RelocationType
data Instruction
= Instruction BaseOpcode Type
| RelocatableInstruction BaseOpcode RelocationType
+ | CallInstruction Text
deriving Eq
xRegister :: XRegister -> Word8
@@ -306,6 +307,10 @@ instruction :: Instruction -> ByteString.Builder.Builder
instruction = \case
(Instruction base instructionType) -> go base $ type' instructionType
(RelocatableInstruction base instructionType) -> go base $ relocationType instructionType
+ (CallInstruction _) -> foldMap instruction
+ [ Instruction Auipc $ U RA 0
+ , Instruction Jalr $ I RA JALR RA 0
+ ]
where
go base instructionType
= ByteString.Builder.word32LE