source: trunk/libs/newlib/src/newlib/libc/machine/x86_64/setjmp.S @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.1 KB
Line 
1/*
2 * ====================================================
3 * Copyright (C) 2007 by Ellips BV. All rights reserved.
4 *
5 * Permission to use, copy, modify, and distribute this
6 * software is freely granted, provided that this notice
7 * is preserved.
8 * ====================================================
9 */
10
11 /*
12 **  jmp_buf:
13 **   rbx rbp r12 r13 r14 r15 rsp rip
14 **   0   8   16  24  32  40  48  56
15 */
16
17  #include "x86_64mach.h"
18
19  .global SYM (setjmp)
20  .global SYM (longjmp)
21  SOTYPE_FUNCTION(setjmp)
22  SOTYPE_FUNCTION(longjmp)
23
24SYM (setjmp):
25  movq    rbx,  0 (rdi)
26  movq    rbp,  8 (rdi)
27  movq    r12, 16 (rdi)
28  movq    r13, 24 (rdi)
29  movq    r14, 32 (rdi)
30  movq    r15, 40 (rdi)
31  leaq    8 (rsp), rax
32  movq    rax, 48 (rdi)
33  movq    (rsp), rax
34  movq    rax, 56 (rdi)
35  movq    $0, rax
36  ret
37
38SYM (longjmp):
39  movq    rsi, rax        /* Return value */
40
41  movq     8 (rdi), rbp
42
43  __CLI
44  movq    48 (rdi), rsp
45  pushq   56 (rdi)
46  movq     0 (rdi), rbx
47  movq    16 (rdi), r12
48  movq    24 (rdi), r13
49  movq    32 (rdi), r14
50  movq    40 (rdi), r15
51  __STI
52
53  ret
Note: See TracBrowser for help on using the repository browser.