Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ARM ONLY
- // Define jmp_buf
- typedef int[10] jmp_buf;
- // longjmp(jmp_buf env, int value)
- // Prototype
- void longjmp(jmp_buf env, int value) __attribute__ ((naked));
- void longjmp(jmp_buf env, int value) __attribute__ ((naked)) {
- __asm__ __volatile__ {
- "ldmia r0,{r4-r11,sp-lr}"
- "movs r0,r1"
- "moveq r0,#1"
- "bx lr"
- }
- }
- // longjmp(jmp_buf env, int value)
- // Prototype
- int setjmp(jmp_buf env) __attribute__ ((naked));
- int setjmp(jmp_buf env) __attribute__ ((naked)) {
- __asm __volatile__ {
- "stmia r0, {r4-r11,sp-lr}"
- "mov r0, #0"
- "bx lr"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment