1/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */ 2.global _longjmp 3.global longjmp 4.type _longjmp,@function 5.type longjmp,@function 6_longjmp: 7longjmp: 8 xor %eax,%eax 9 cmp $1,%esi /* CF = val ? 0 : 1 */ 10 adc %esi,%eax /* eax = val + !val */ 11 mov (%rdi),%rbx /* rdi is the jmp_buf, restore regs from it */ 12 mov 8(%rdi),%rbp 13 mov 16(%rdi),%r12 14 mov 24(%rdi),%r13 15 mov 32(%rdi),%r14 16 mov 40(%rdi),%r15 17 mov 48(%rdi),%rsp 18 jmp *56(%rdi) /* goto saved address without altering rsp */ 19