revert between 56095 -> 55830 in arch
[AROS.git] / arch / x86_64-all / posixc / siglongjmp.s
blobbbc2375f6764a2ddfa0f5f099acd942ff198d0a8
1 /*
2 Copyright © 2015, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: ANSI C function siglongjmp()
6 Lang: english
7 */
9 #include "aros/x86_64/asm.h"
11 .text
12 _ALIGNMENT
13 .globl AROS_CDEFNAME(siglongjmp)
14 _FUNCTION(AROS_CDEFNAME(siglongjmp))
16 .set FirstArg, 8 /* Skip Return-Adress */
17 .set env, FirstArg
18 .set val, env+8
20 AROS_CDEFNAME(siglongjmp):
22 mov %rdi, %rax
23 /* Make sure return value is not 0 */
24 cmp $0,%rsi
25 jne 1f
27 mov $1,%rsi
29 /* Restore stack pointer and all registers from env */
30 mov 120(%rax),%rsp /* Restore original stack */
32 mov 0(%rax),%rcx
33 mov %rcx,retaddr(%rsp) /* Restore return address */
35 push %rsi /* Save return value on new stack */
37 /* Restore all registers */
38 mov 8(%rax),%rbx /* %ebx */
39 mov 16(%rax),%rcx /* %ecx */
40 mov 24(%rax),%rdx /* %edx */
41 mov 32(%rax),%rsi /* %esi */
42 mov 40(%rax),%rdi /* %edi */
43 mov 48(%rax),%rbp /* %ebp */
44 mov 56(%rax),%r8
45 mov 64(%rax),%r9
46 mov 72(%rax),%r10
47 mov 80(%rax),%r11
48 mov 88(%rax),%r12
49 mov 96(%rax),%r13
50 mov 104(%rax),%r14
51 mov 112(%rax),%r15
53 pop %rax /* Fetch return value */
54 ret