1570af302Sopenharmony_ci/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */ 2570af302Sopenharmony_ci.global _longjmp 3570af302Sopenharmony_ci.global longjmp 4570af302Sopenharmony_ci.type _longjmp,@function 5570af302Sopenharmony_ci.type longjmp,@function 6570af302Sopenharmony_ci_longjmp: 7570af302Sopenharmony_cilongjmp: 8570af302Sopenharmony_ci xor %eax,%eax 9570af302Sopenharmony_ci cmp $1,%esi /* CF = val ? 0 : 1 */ 10570af302Sopenharmony_ci adc %esi,%eax /* eax = val + !val */ 11570af302Sopenharmony_ci mov (%rdi),%rbx /* rdi is the jmp_buf, restore regs from it */ 12570af302Sopenharmony_ci mov 8(%rdi),%rbp 13570af302Sopenharmony_ci mov 16(%rdi),%r12 14570af302Sopenharmony_ci mov 24(%rdi),%r13 15570af302Sopenharmony_ci mov 32(%rdi),%r14 16570af302Sopenharmony_ci mov 40(%rdi),%r15 17570af302Sopenharmony_ci mov 48(%rdi),%rsp 18570af302Sopenharmony_ci jmp *56(%rdi) /* goto saved address without altering rsp */ 19