diff options
| author | serpilliere <serpilliere@users.noreply.github.com> | 2017-04-06 14:36:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-04-06 14:36:01 +0200 |
| commit | 049abdc867f533ba270cbdfff839caefb9b162b9 (patch) | |
| tree | 419067643408bed0acc81529791f714150ddf644 /miasm2/arch/arm/jit.py | |
| parent | b1ed94019554b25d4d8924594f8868318e8a8c4a (diff) | |
| parent | b535f6e26e354ca61307f8153b862385ba9d2a04 (diff) | |
| download | miasm-049abdc867f533ba270cbdfff839caefb9b162b9.tar.gz miasm-049abdc867f533ba270cbdfff839caefb9b162b9.zip | |
Merge pull request #515 from commial/feature/calling-conv-systemv
Feature/calling conv systemv
Diffstat (limited to 'miasm2/arch/arm/jit.py')
| -rw-r--r-- | miasm2/arch/arm/jit.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/miasm2/arch/arm/jit.py b/miasm2/arch/arm/jit.py index 70c708e1..545d60de 100644 --- a/miasm2/arch/arm/jit.py +++ b/miasm2/arch/arm/jit.py @@ -34,11 +34,7 @@ class jitter_arml(jitter): @named_arguments def func_args_stdcall(self, n_args): - args = [] - for i in xrange(min(n_args, 4)): - args.append(self.cpu.get_gpreg()['R%d' % i]) - for i in xrange(max(0, n_args - 4)): - args.append(self.get_stack_arg(i)) + args = [self.get_arg_n_stdcall(i) for i in xrange(n_args)] ret_ad = self.cpu.LR return ret_ad, args @@ -48,13 +44,25 @@ class jitter_arml(jitter): self.cpu.R0 = ret_value return True + def func_prepare_stdcall(self, ret_addr, *args): + for index in xrange(min(len(args), 4)): + setattr(self.cpu, 'R%d' % index, args[index]) + for index in xrange(4, len(args)): + self.vm.set_mem(self.cpu.SP + 4 * (index - 4), pck32(args[index])) + self.cpu.LR = ret_addr + def get_arg_n_stdcall(self, index): if index < 4: - arg = self.cpu.get_gpreg()['R%d' % index] + arg = getattr(self.cpu, 'R%d' % index) else: arg = self.get_stack_arg(index-4) return arg + func_args_systemv = func_args_stdcall + func_ret_systemv = func_ret_stdcall + func_prepare_systemv = func_prepare_stdcall + get_arg_n_systemv = get_arg_n_stdcall + def init_run(self, *args, **kwargs): jitter.init_run(self, *args, **kwargs) self.cpu.PC = self.pc |