]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/src/asm/make_x86_64_sysv_macho_gas.S
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / context / src / asm / make_x86_64_sysv_macho_gas.S
1 /*
2 Copyright Oliver Kowalke 2009.
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at
5 http://www.boost.org/LICENSE_1_0.txt)
6 */
7
8 /****************************************************************************************
9 * *
10 * ---------------------------------------------------------------------------------- *
11 * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
12 * ---------------------------------------------------------------------------------- *
13 * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
14 * ---------------------------------------------------------------------------------- *
15 * | R12 | R13 | R14 | R15 | *
16 * ---------------------------------------------------------------------------------- *
17 * ---------------------------------------------------------------------------------- *
18 * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
19 * ---------------------------------------------------------------------------------- *
20 * | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
21 * ---------------------------------------------------------------------------------- *
22 * | RBX | RBP | RIP | EXIT | *
23 * ---------------------------------------------------------------------------------- *
24 * *
25 ****************************************************************************************/
26
27 .text
28 .globl _make_fcontext
29 .align 8
30 _make_fcontext:
31 /* first arg of make_fcontext() == top of context-stack */
32 movq %rdi, %rax
33
34 /* shift address in RAX to lower 16 byte boundary */
35 movabs $-16, %r8
36 andq %r8, %rax
37
38 /* reserve space for context-data on context-stack */
39 /* on context-function entry: (RSP -0x8) % 16 == 0 */
40 leaq -0x40(%rax), %rax
41
42 /* third arg of make_fcontext() == address of context-function */
43 movq %rdx, 0x30(%rax)
44
45 /* compute abs address of label finish */
46 leaq finish(%rip), %rcx
47 /* save address of finish as return-address for context-function */
48 /* will be entered after context-function returns */
49 movq %rcx, 0x38(%rax)
50
51 ret /* return pointer to context-data */
52
53 finish:
54 /* exit code is zero */
55 xorq %rdi, %rdi
56 /* exit application */
57 call __exit
58 hlt