From c9ff4f0a2a2cfa31964a307c08f9baa349565bbd Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 15 Sep 2024 23:03:25 +0200 Subject: Add call pseudo instruction --- lib/Language/Elna/Architecture/RiscV.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/Language/Elna/Architecture') 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 -- cgit v1.2.3