Documented GVF_SAVE_VAR alongside other flags, and removed a query/doubt
[AROS.git] / arch / i386-all / posixc / vfork_longjmp.s
blob3585ad8ebef5b9f87cfcc748267851dfd287e174
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /* This function works the same as longjmp() except it lacks the argument
7 check. It's used only by vfork() implementation. */
9 #include "aros/i386/asm.h"
11 .text
12 _ALIGNMENT
13 .globl AROS_CDEFNAME(vfork_longjmp)
14 _FUNCTION(AROS_CDEFNAME(vfork_longjmp))
16 .set FirstArg, 4 /* Skip Return-Adress */
17 .set env, FirstArg
18 .set val, env+4
20 AROS_CDEFNAME(vfork_longjmp):
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
26 movl val(%esp),%ebx
28 /* Restore stack pointer and all registers from env */
29 movl 28(%eax),%esp /* Restore original stack */
31 movl 0(%eax),%ecx
32 movl %ecx,retaddr(%esp) /* Restore return address */
34 pushl %ebx /* Save return value on new stack */
36 /* Restore all registers */
37 movl 4(%eax),%ebx /* %ebx */
38 movl 8(%eax),%ecx /* %ecx */
39 movl 12(%eax),%edx /* %edx */
40 movl 16(%eax),%esi /* %esi */
41 movl 20(%eax),%edi /* %edi */
42 movl 24(%eax),%ebp /* %ebp */
44 popl %eax /* Fetch return value */
45 ret