delint
[AROS.git] / arch / x86_64-all / posixc / vfork_longjmp.s
blob875b220bbc28e4de8e028fccd85d88170986a4a6
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/x86_64/asm.h"
11 .text
12 _ALIGNMENT
13 .globl AROS_CDEFNAME(vfork_longjmp)
14 _FUNCTION(AROS_CDEFNAME(vfork_longjmp))
16 .set FirstArg, 8 /* Skip Return-Adress */
17 .set env, FirstArg
18 .set val, env+8
20 AROS_CDEFNAME(vfork_longjmp):
21 mov %rdi, %rax
22 /* Restore stack pointer and all registers from env */
23 mov 120(%rax),%rsp /* Restore original stack */
25 mov 0(%rax),%rcx
26 mov %rcx,retaddr(%rsp) /* Restore return address */
28 push %rsi /* Save return value on new stack */
30 /* Restore all registers */
31 mov 8(%rax),%rbx /* %ebx */
32 mov 16(%rax),%rcx /* %ecx */
33 mov 24(%rax),%rdx /* %edx */
34 mov 32(%rax),%rsi /* %esi */
35 mov 40(%rax),%rdi /* %edi */
36 mov 48(%rax),%rbp /* %ebp */
37 mov 56(%rax),%r8
38 mov 64(%rax),%r9
39 mov 72(%rax),%r10
40 mov 80(%rax),%r11
41 mov 88(%rax),%r12
42 mov 96(%rax),%r13
43 mov 104(%rax),%r14
44 mov 112(%rax),%r15
46 pop %rax /* Fetch return value */
47 ret