Skip to content

Commit c363487

Browse files
committed
fix aarch64 32-bit mode arguments
1 parent 9f1c5ef commit c363487

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

panda/python/core/pandare/arch.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,25 @@ def __init__(self, panda):
385385
self.reg_retval = {"default": "X0",
386386
"syscall": "X0",
387387
"linux_kernel": "X0"}
388+
self.arm32 = ArmArch(panda)
389+
390+
def arm32_dec(f, name):
391+
def wrap(*args, **kwargs):
392+
# first check that we have an arg
393+
if len(args) > 0:
394+
# double check that it's a cpustate
395+
cpu = args[0]
396+
if "_cffi_backend" in str(type(cpu)):
397+
# check if we're in arm32 mode
398+
if cpu.env_ptr.aarch64 == 0:
399+
func = getattr(self.arm32, name)
400+
return func(*args, **kwargs)
401+
return f(*args, **kwargs)
402+
return wrap
403+
404+
for attr in dir(self):
405+
if callable(getattr(self, attr)) and not attr.startswith('_'):
406+
setattr(self, attr, arm32_dec(getattr(self, attr), attr))
388407

389408
def get_pc(self, cpu):
390409
'''

0 commit comments

Comments
 (0)