diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-08-26 23:16:00 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-08-26 23:16:15 +0200 |
commit | aa049227c17f15ad22092f1fcab4410bbf3521ba (patch) | |
tree | 7046e62ff530746754e19d07d4e8bc7d7a42ea22 /X64.hs | |
parent | b2c5ef755bc7a2c736c5f52c4753dde66c04c3aa (diff) |
Cleanup and features
debugger, bitwise ops, bounds checking, hex literals,
better typing of some optimisations, makefile fix, exit function.
Diffstat (limited to 'X64.hs')
-rw-r--r-- | X64.hs | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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 |