Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void doSomething(void) {
- int a = 1, b = 2, c = 3, d = 4, e = 5;
- void *stackp = NULL;
- #ifdef _ARM_ARCH_H
- __asm__("mov %[address],r9" : [address]"=r" (stackp)); //r9 is the rfp
- #else
- __asm__("mov %%ebp,%[address]" : [address]"=a" (stackp));
- stackp -= 2 * sizeof(int); // two 32-bit values on stack, self && _cmd even though unused for a simple C func?
- stackp -= 6 * sizeof(int); // position at start of stack vars addr range
- #endif
- memset(stackp, 0, 6*sizeof(int));
- NSLog(@"a:%d, b:%d, c:%d, d:%d, e:%d", a, b, c, d, e); // should print all ZEROs
- }
Add Comment
Please, Sign In to add comment