Skip to content

Commit 141ec4d

Browse files
authored
Merge pull request #799 from ucgJhe/dev
add syscall and fix typo
2 parents c524717 + d2aa292 commit 141ec4d

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

qiling/os/posix/syscall/time.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,25 @@ def ql_syscall_time(ql, *args, **kw):
1717
regreturn = int(time.time())
1818
return regreturn
1919

20+
def ql_syscall_clock_nanosleep_time64(ql, nanosleep_clk_id, nanosleep_flags, nanosleep_req, nanosleep_rem, *args, **kw):
21+
def _sched_sleep(cur_thread):
22+
gevent.sleep(tv_sec)
23+
24+
n = ql.pointersize
25+
26+
tv_sec = ql.unpack(ql.mem.read(nanosleep_req, n))
27+
tv_sec += ql.unpack(ql.mem.read(nanosleep_req + n, n)) / 1000000000
28+
29+
if ql.os.thread_management == None:
30+
time.sleep(tv_sec)
31+
else:
32+
ql.emu_stop()
33+
ql.os.thread_management.cur_thread.sched_cb = _sched_sleep
34+
th = ql.os.thread_management.cur_thread
35+
36+
regreturn = 0
37+
return regreturn
38+
2039

2140
def ql_syscall_nanosleep(ql, nanosleep_req, nanosleep_rem, *args, **kw):
2241
def _sched_sleep(cur_thread):

qltool

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ def handle_examples(parser: argparse.ArgumentParser):
136136
__ql_examples = f"""Examples:
137137
138138
With code:
139-
{prog} code --os linux --arch arm --format hex -f examples/codes/linarm32_tcp_reverse_shell.hex
140-
{prog} code --os linux --arch x86 --format asm -f examples/codes/lin32_execve.asm
139+
{prog} code --os linux --arch arm --format hex -f examples/shellcodes/linarm32_tcp_reverse_shell.hex
140+
{prog} code --os linux --arch x86 --format asm -f examples/shellcodes/lin32_execve.asm
141141
142142
With binary file:
143143
{prog} run -f examples/rootfs/x8664_linux/bin/x8664_hello --rootfs examples/rootfs/x8664_linux

0 commit comments

Comments
 (0)