]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/context/src/asm/jump_x86_64_sysv_elf_gas.S
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / context / src / asm / jump_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
27.text
28.globl jump_fcontext
29.type jump_fcontext,@function
30.align 16
31jump_fcontext:
b32b8144
FG
32 leaq -0x38(%rsp), %rsp /* prepare stack */
33
34#if !defined(BOOST_USE_TSX)
35 stmxcsr (%rsp) /* save MMX control- and status-word */
36 fnstcw 0x4(%rsp) /* save x87 control-word */
37#endif
38
39 movq %r12, 0x8(%rsp) /* save R12 */
40 movq %r13, 0x10(%rsp) /* save R13 */
41 movq %r14, 0x18(%rsp) /* save R14 */
42 movq %r15, 0x20(%rsp) /* save R15 */
43 movq %rbx, 0x28(%rsp) /* save RBX */
44 movq %rbp, 0x30(%rsp) /* save RBP */
7c673cae
FG
45
46 /* store RSP (pointing to context-data) in RAX */
47 movq %rsp, %rax
48
49 /* restore RSP (pointing to context-data) from RDI */
50 movq %rdi, %rsp
51
b32b8144
FG
52 movq 0x38(%rsp), %r8 /* restore return-address */
53
54#if !defined(BOOST_USE_TSX)
55 ldmxcsr (%rsp) /* restore MMX control- and status-word */
56 fldcw 0x4(%rsp) /* restore x87 control-word */
57#endif
58
59 movq 0x8(%rsp), %r12 /* restore R12 */
60 movq 0x10(%rsp), %r13 /* restore R13 */
61 movq 0x18(%rsp), %r14 /* restore R14 */
62 movq 0x20(%rsp), %r15 /* restore R15 */
63 movq 0x28(%rsp), %rbx /* restore RBX */
64 movq 0x30(%rsp), %rbp /* restore RBP */
7c673cae 65
b32b8144 66 leaq 0x40(%rsp), %rsp /* prepare stack */
7c673cae
FG
67
68 /* return transfer_t from jump */
69 /* RAX == fctx, RDX == data */
70 movq %rsi, %rdx
71 /* pass transfer_t as first arg in context function */
72 /* RDI == fctx, RSI == data */
73 movq %rax, %rdi
74
75 /* indirect jump to context */
76 jmp *%r8
77.size jump_fcontext,.-jump_fcontext
78
79/* Mark that we don't need executable stack. */
80.section .note.GNU-stack,"",%progbits