Skip to content

Commit

Permalink
fix aarch64 32-bit mode arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
lacraig2 committed Oct 23, 2024
1 parent 9f1c5ef commit c363487
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions panda/python/core/pandare/arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,25 @@ def __init__(self, panda):
self.reg_retval = {"default": "X0",
"syscall": "X0",
"linux_kernel": "X0"}
self.arm32 = ArmArch(panda)

def arm32_dec(f, name):
def wrap(*args, **kwargs):
# first check that we have an arg
if len(args) > 0:
# double check that it's a cpustate
cpu = args[0]
if "_cffi_backend" in str(type(cpu)):
# check if we're in arm32 mode
if cpu.env_ptr.aarch64 == 0:
func = getattr(self.arm32, name)
return func(*args, **kwargs)
return f(*args, **kwargs)
return wrap

for attr in dir(self):
if callable(getattr(self, attr)) and not attr.startswith('_'):
setattr(self, attr, arm32_dec(getattr(self, attr), attr))

def get_pc(self, cpu):
'''
Expand Down

0 comments on commit c363487

Please sign in to comment.