aboutsummaryrefslogtreecommitdiff
path: root/X64.hs
diff options
context:
space:
mode:
Diffstat (limited to 'X64.hs')
-rw-r--r--X64.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/X64.hs b/X64.hs
index 222d1cd..a577a75 100644
--- a/X64.hs
+++ b/X64.hs
@@ -48,6 +48,7 @@ data Ins
| JMP String
| JCC CondCode String
| RET
+ | INT3
deriving (Show, Eq)
type Func = (String, [Ins])
@@ -104,6 +105,7 @@ verify (Asm funcs) = mapM_ (\(_, inss) -> mapM_ goI inss) funcs
goI (JMP s) = when (null s) $ Left "Empty jump target"
goI (JCC _ s) = when (null s) $ Left "Empty jcc target"
goI RET = return ()
+ goI INT3 = return ()
ckReg (XReg _ _) = return ()
ckReg _ = Left "Argument is not a Reg"
@@ -252,6 +254,7 @@ instance Stringifiable Ins where
stringify (JMP s) = "jmp " ++ s
stringify (JCC cc s) = "j" ++ stringify cc ++ " " ++ s
stringify RET = "ret"
+ stringify INT3 = "int3"
instance Stringifiable Asm where
stringify (Asm funcs) = intercalate "\n" $ map goF funcs
@@ -305,6 +308,7 @@ xrefMapM f (POP (RegMem x)) = POP <$> (RegMem <$> f x)
xrefMapM _ i@(JMP _) = return i
xrefMapM _ i@(JCC _ _) = return i
xrefMapM _ i@RET = return i
+xrefMapM _ i@INT3 = return i
xrefMap :: (XRef -> XRef) -> Ins -> Ins
xrefMap f i = runIdentity $ xrefMapM (return . f) i