Skip to content

Commit f52d620

Browse files
committed
update posix syscall make it more os specific
1 parent 715afb3 commit f52d620

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

qiling/os/posix/posix.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,12 @@ def load_syscall(self, intno=None):
128128
self.syscall_name = self.syscall_map.__name__
129129
else:
130130
self.syscall_name = map_syscall(self.ql, self.syscall)
131-
132-
import qiling.os.posix.syscall
133-
import qiling.os.linux.syscall
134-
import qiling.os.macos.syscall
135-
import qiling.os.freebsd.syscall
136-
137-
if self.syscall_name not in dir(qiling.os.posix.syscall) \
138-
and self.syscall_name not in dir(qiling.os.linux.syscall) \
139-
and self.syscall_name not in dir(qiling.os.macos.syscall) \
140-
and self.syscall_name not in dir(qiling.os.freebsd.syscall):
131+
_ostype_str = ostype_convert_str(self.ql.ostype)
132+
_posix_syscall = ql_get_module_function(f"qiling.os.posix", "syscall")
133+
_os_syscall = ql_get_module_function(f"qiling.os.{_ostype_str.lower()}", "syscall")
134+
135+
if self.syscall_name not in dir(_posix_syscall) \
136+
and self.syscall_name not in dir(_os_syscall):
141137

142138
syscall_name_str = self.syscall_name
143139
self.syscall_map = None

qiling/os/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def _parse_param(param):
201201
fpass = f' (PASSTHRU)' if passthru else ''
202202

203203
#TODO: Old code from demigod, ready to cleanup
204-
if self.ql.ostype in QL_OS_POSIX and self.ql.loader.is_driver == True:
204+
if self.ql.ostype in QL_OS_POSIX and self.ql.loader.is_driver:
205205
log = '0x%0.2x: %s(' % (address, function_name)
206206
for each in params:
207207
value = params[each]

0 commit comments

Comments
 (0)