]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/src/asm/ontop_x86_64_sysv_macho_gas.S
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / context / src / asm / ontop_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 _ontop_fcontext
29 .align 8
30 _ontop_fcontext:
31 pushq %rbp /* save RBP */
32 pushq %rbx /* save RBX */
33 pushq %r15 /* save R15 */
34 pushq %r14 /* save R14 */
35 pushq %r13 /* save R13 */
36 pushq %r12 /* save R12 */
37
38 /* store RSP (pointing to context-data) in RAX */
39 movq %rsp, %rax
40
41 /* restore RSP (pointing to context-data) from RDI */
42 movq %rdi, %rsp
43
44 popq %r12 /* restrore R12 */
45 popq %r13 /* restrore R13 */
46 popq %r14 /* restrore R14 */
47 popq %r15 /* restrore R15 */
48 popq %rbx /* restrore RBX */
49 popq %rbp /* restrore RBP */
50
51 /* preserve ontop-function in R8 */
52 movq %rdx, %r8
53
54 /* return transfer_t from jump */
55 /* RAX == fctx, RDX == data */
56 movq %rsi, %rdx
57 /* pass transfer_t as first arg in context function */
58 /* RDI == fctx, RSI == data */
59 movq %rax, %rdi
60
61 /* keep return-address on stack */
62
63 /* indirect jump to context */
64 jmp *%r8