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