1/* 2 * Copyright 2012, Alex Smith, alex@alex-smith.me.uk. 3 * Distributed under the terms of the MIT License. 4 */ 5 6#include "setjmp_internal.h" 7 8 9/* int __siglongjmp(jmp_buf buffer, int value) */ 10FUNCTION(siglongjmp): 11FUNCTION(longjmp): 12FUNCTION(_longjmp): 13 // Restore new callee-save registers. 14 movq JMP_REGS_R15(%rdi), %r15 15 movq JMP_REGS_R14(%rdi), %r14 16 movq JMP_REGS_R13(%rdi), %r13 17 movq JMP_REGS_R12(%rdi), %r12 18 movq JMP_REGS_BX(%rdi), %rbx 19 movq JMP_REGS_BP(%rdi), %rbp 20 21 // Restore new stack pointer and push return address. 22 movq JMP_REGS_SP(%rdi), %rsp 23 movq JMP_REGS_IP(%rdi), %rax 24 push %rax 25 26 // __longjmp_return restores the signal mask and sets the return value. 27 call __longjmp_return@PLT 28 ret 29FUNCTION_END(siglongjmp) 30 31 32#pragma weak longjmp=siglongjmp 33