]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/context/src/asm/ontop_x86_64_sysv_elf_gas.S
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / context / src / asm / ontop_x86_64_sysv_elf_gas.S
CommitLineData
7c673cae
FG
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 * ---------------------------------------------------------------------------------- *
b32b8144 15 * | fc_mxcsr|fc_x87_cw| R12 | R13 | R14 | *
7c673cae
FG
16 * ---------------------------------------------------------------------------------- *
17 * ---------------------------------------------------------------------------------- *
18 * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
19 * ---------------------------------------------------------------------------------- *
20 * | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
21 * ---------------------------------------------------------------------------------- *
b32b8144 22 * | R15 | RBX | RBP | RIP | *
7c673cae
FG
23 * ---------------------------------------------------------------------------------- *
24 * *
25 ****************************************************************************************/
26
92f5a8d4 27.file "ontop_x86_64_sysv_elf_gas.S"
7c673cae
FG
28.text
29.globl ontop_fcontext
30.type ontop_fcontext,@function
31.align 16
32ontop_fcontext:
b32b8144
FG
33 /* preserve ontop-function in R8 */
34 movq %rdx, %r8
35
36 leaq -0x38(%rsp), %rsp /* prepare stack */
37
38#if !defined(BOOST_USE_TSX)
39 stmxcsr (%rsp) /* save MMX control- and status-word */
40 fnstcw 0x4(%rsp) /* save x87 control-word */
41#endif
42
43 movq %r12, 0x8(%rsp) /* save R12 */
44 movq %r13, 0x10(%rsp) /* save R13 */
45 movq %r14, 0x18(%rsp) /* save R14 */
46 movq %r15, 0x20(%rsp) /* save R15 */
47 movq %rbx, 0x28(%rsp) /* save RBX */
48 movq %rbp, 0x30(%rsp) /* save RBP */
7c673cae
FG
49
50 /* store RSP (pointing to context-data) in RAX */
51 movq %rsp, %rax
52
53 /* restore RSP (pointing to context-data) from RDI */
54 movq %rdi, %rsp
55
b32b8144
FG
56#if !defined(BOOST_USE_TSX)
57 ldmxcsr (%rsp) /* restore MMX control- and status-word */
58 fldcw 0x4(%rsp) /* restore x87 control-word */
59#endif
7c673cae 60
b32b8144
FG
61 movq 0x8(%rsp), %r12 /* restore R12 */
62 movq 0x10(%rsp), %r13 /* restore R13 */
63 movq 0x18(%rsp), %r14 /* restore R14 */
64 movq 0x20(%rsp), %r15 /* restore R15 */
65 movq 0x28(%rsp), %rbx /* restore RBX */
66 movq 0x30(%rsp), %rbp /* restore RBP */
67
68 leaq 0x38(%rsp), %rsp /* prepare stack */
7c673cae
FG
69
70 /* return transfer_t from jump */
71 /* RAX == fctx, RDX == data */
72 movq %rsi, %rdx
73 /* pass transfer_t as first arg in context function */
74 /* RDI == fctx, RSI == data */
75 movq %rax, %rdi
76
77 /* keep return-address on stack */
78
79 /* indirect jump to context */
80 jmp *%r8
81.size ontop_fcontext,.-ontop_fcontext
82
83/* Mark that we don't need executable stack. */
84.section .note.GNU-stack,"",%progbits