NOTE => NOTES
[AROS.git] / arch / i386-all / clib / vfork.s
blob7ab0feeb1e5afe6c6996a590c6866b49f92c0b19
1 /*
2 Copyright © 2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: POSIX function vfork(), i386 version
6 Lang: english
7 */
8 #include "aros/i386/asm.h"
10 .text
11 _ALIGNMENT
12 .globl AROS_CDEFNAME(vfork)
13 _FUNCTION(AROS_CDEFNAME(vfork))
14 .set bufsize, 8*4
15 .set stack, 7*4
17 AROS_CDEFNAME(vfork):
18 lea (-bufsize)(%esp), %esp /* _JMPLEN + 1 longs on the stack
19 it's our temporary jmp_buf */
20 push %esp
21 call setjmp /* fill jmp_buf on the stack with
22 current register values */
23 pop %esp
24 mov bufsize(%esp), %eax /* set return address in jmp_buf */
25 mov %eax, retaddr(%esp) /* to this function call return
26 address */
27 lea bufsize(%esp), %eax /* set stack value in jmp_buf */
28 /* to stack value from before */
29 mov %eax, stack(%esp) /* this function call */
31 mov %esp, %eax
32 push %ebp
33 mov %esp, %ebp
34 push %eax
35 call __vfork /* __vfork call won't return */