Skip to content

Commit e7b4b07

Browse files
authored
Merge pull request #342 from kabeor/syscall
Add freebsd Syscall
2 parents 4134149 + b84eee7 commit e7b4b07

File tree

2 files changed

+515
-18
lines changed

2 files changed

+515
-18
lines changed

examples/src/freebsd/syscall_dump.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env python3
2+
#
3+
# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
4+
# Built on top of Unicorn emulator (www.unicorn-engine.org)
5+
# The 'freebsd_syscall' can be download at 'https://github.com/freebsd/freebsd/blob/master/sys/kern/syscalls.master'.
6+
7+
import re
8+
9+
def is_number(s):
10+
try:
11+
float(s)
12+
return True
13+
except ValueError:
14+
pass
15+
16+
try:
17+
import unicodedata
18+
unicodedata.numeric(s)
19+
return True
20+
except (TypeError, ValueError):
21+
pass
22+
23+
return False
24+
25+
def read_file(f):
26+
line = f.readline()
27+
while line:
28+
if is_number(line[0]):
29+
index = re.findall(r"\d+\.?\d*", line)
30+
line = f.readline()
31+
if not is_number(line[0]) and line[0] != ';':
32+
name = line.split('(')[0]
33+
name = name.split(' ')[-1]
34+
# print(index[0], name)
35+
if name != '\n':
36+
print(" \""+name+"\": ("+index[0]+"),")
37+
else:
38+
continue
39+
line = f.readline()
40+
41+
if __name__ == '__main__':
42+
file = open('./freebsd_syscall')
43+
read_file(file)

0 commit comments

Comments
 (0)