|
10 | 10 | from qiling.const import QL_ARCH |
11 | 11 | from qiling.exception import QlErrorArch, QlMemoryMappedError |
12 | 12 | from qiling.loader.loader import QlLoader, Image |
13 | | -from qiling.os.const import POINTER |
| 13 | +from qiling.os.const import PARAM_INTN, POINTER |
14 | 14 |
|
15 | 15 | from qiling.os.uefi import st, smst, utils |
16 | 16 | from qiling.os.uefi.context import DxeContext, SmmContext, UefiContext |
@@ -144,19 +144,10 @@ def call_function(self, addr: int, args: Sequence[int], ret: Optional[int]): |
144 | 144 | ret : return address; may be None |
145 | 145 | """ |
146 | 146 |
|
147 | | - # arguments gpr (ms x64 cc) |
148 | | - regs = ('rcx', 'rdx', 'r8', 'r9') |
149 | | - assert len(args) <= len(regs), f'currently supporting up to {len(regs)} arguments' |
| 147 | + types = (PARAM_INTN, ) * len(args) |
| 148 | + targs = tuple(zip(types, args)) |
150 | 149 |
|
151 | | - # set up the arguments |
152 | | - for reg, arg in zip(regs, args): |
153 | | - self.ql.reg.write(reg, arg) |
154 | | - |
155 | | - # if provided, set return address |
156 | | - if ret is not None: |
157 | | - self.ql.stack_push(ret) |
158 | | - |
159 | | - self.ql.reg.rip = addr |
| 150 | + self.ql.os.fcall.call_native(addr, targs, ret) |
160 | 151 |
|
161 | 152 | def unload_modules(self, context: UefiContext) -> bool: |
162 | 153 | """Invoke images unload callbacks, if set. |
|
0 commit comments