mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-04 03:11:28 +00:00
c5e588e6e5
- Previous commits has been reported in the ChangeLog file - hg log has been lost (moved inside ChangeLog) - Old radare1 repository has removed all the libr
25 lines
669 B
C
25 lines
669 B
C
/* radare - LGPL - Copyright 2008-2009 pancake<nopcode.org> */
|
|
|
|
#include "r_vm.h"
|
|
#include "list.h"
|
|
|
|
void r_vm_stack_push(struct r_vm_t *vm, u64 _val)
|
|
{
|
|
// XXX determine size of stack here
|
|
// XXX do not write while emulating zomfg
|
|
u32 val = _val;
|
|
vm_reg_set(vm, vm_cpu.sp, vm_reg_get(vm, vm_cpu.sp)+4);
|
|
vm_mmu_write(vm, vm_reg_get(vm, vm_cpu.sp), &val, 4);
|
|
}
|
|
|
|
void r_vm_stack_pop(struct r_vm_t *vm, const char *reg)
|
|
{
|
|
u32 val = 0;
|
|
if (vm_mmu_read(vm_reg_get(vm, vm->cpu.sp), &val, 4))
|
|
return;
|
|
//printf("POP (%s)\n", reg);
|
|
vm_mmu_read(vm, vm_reg_get(vm, vm->cpu.sp), &val, 4);
|
|
vm_reg_set(vm, reg, val);
|
|
vm_reg_set(vm_cpu.sp, vm_reg_get(vm, vm->cpu.sp)-4);
|
|
}
|