1 /* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */
4 .type _longjmp,@function
5 .type longjmp,@function
8 mov %rsi,%rax /* val will be longjmp return */
11 inc %rax /* if val==0, val=1 per longjmp semantics */
13 mov (%rdi),%rbx /* rdi is the jmp_buf, restore regs from it */
19 mov 48(%rdi),%rdx /* this ends up being the stack pointer */
21 mov 56(%rdi),%rdx /* this is the instruction pointer */
22 jmp *%rdx /* goto saved address without altering rsp */