Skip to content

Commit bced2a8

Browse files
committed
Fix x86_64 syscall numbers being wrong.
What we had so far was for 32-bit x86 only. Fixed where we got the info from via gregose/syscall-table#3.
1 parent 16bdb2b commit bced2a8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/HaTrace.hs

+5-5
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ printX86Regs = print
141141

142142
printX86_64Regs :: X86_64Regs -> IO ()
143143
printX86_64Regs r =
144-
case parseSyscall r of
144+
case parseSyscallX86_64 r of
145145
Nothing -> putStrLn $ "Unknown syscall number: " ++ show (orig_rax r)
146146
Just sc -> print sc
147147

@@ -150,9 +150,9 @@ data Syscall
150150
| Write
151151
deriving (Show, Eq)
152152

153-
parseSyscall :: X86_64Regs -> Maybe Syscall
154-
parseSyscall X86_64Regs {..} =
153+
parseSyscallX86_64 :: X86_64Regs -> Maybe Syscall
154+
parseSyscallX86_64 X86_64Regs {..} =
155155
case orig_rax of
156-
0x3 -> Just Read
157-
0x4 -> Just Write
156+
0 -> Just Read
157+
1 -> Just Write
158158
_ -> Nothing

0 commit comments

Comments
 (0)