Moved duplicate AutoDocs to central location.
[AROS.git] / arch / i386-all / posixc / siglongjmp.s
blobbc906c11817d999971444164d973319d09f11da8
1 /*
2 Copyright © 2015, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: POSIX.1-2008 function siglongjmp()
6 Lang: english
7 */
9 #include "aros/i386/asm.h"
11 .text
12 _ALIGNMENT
13 .globl AROS_CDEFNAME(siglongjmp)
14 _FUNCTION(AROS_CDEFNAME(siglongjmp))
16 .set FirstArg, 4 /* Skip return-address */
17 .set env, FirstArg
18 .set val, env+4
20 AROS_CDEFNAME(siglongjmp):
21 /* Fetch the address of the env-structure off the stack.
22 The address is stored in %eax which is not preserved
23 because it's contents are overwritten anyway by the
24 return code */
25 movl env(%esp),%eax
27 /* Read return value into %ebx and make sure it's not 0 */
28 movl val(%esp),%ebx
29 cmpl $0,%ebx
30 jne 1f
32 movl $1,%ebx
34 /* Restore stack pointer and all registers from env */
35 movl 28(%eax),%esp /* Restore original stack */
37 movl 0(%eax),%ecx
38 movl %ecx,retaddr(%esp) /* Restore return address */
40 pushl %ebx /* Save return value on new stack */
42 /* Restore all registers */
43 movl 4(%eax),%ebx /* %ebx */
44 movl 8(%eax),%ecx /* %ecx */
45 movl 12(%eax),%edx /* %edx */
46 movl 16(%eax),%esi /* %esi */
47 movl 20(%eax),%edi /* %edi */
48 movl 24(%eax),%ebp /* %ebp */
50 popl %eax /* Fetch return value */
51 ret