]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/src/asm/jump_x86_64_sysv_elf_gas.S
8403c8860061fc560bd716b91ff56ab8d8172440
[ceph.git] / ceph / src / boost / libs / context / src / asm / jump_x86_64_sysv_elf_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 jump_fcontext
29 .type jump_fcontext,@function
30 .align 16
31 jump_fcontext:
32 pushq %rbp /* save RBP */
33 pushq %rbx /* save RBX */
34 pushq %r15 /* save R15 */
35 pushq %r14 /* save R14 */
36 pushq %r13 /* save R13 */
37 pushq %r12 /* save R12 */
38
39 /* store RSP (pointing to context-data) in RAX */
40 movq %rsp, %rax
41
42 /* restore RSP (pointing to context-data) from RDI */
43 movq %rdi, %rsp
44
45 popq %r12 /* restrore R12 */
46 popq %r13 /* restrore R13 */
47 popq %r14 /* restrore R14 */
48 popq %r15 /* restrore R15 */
49 popq %rbx /* restrore RBX */
50 popq %rbp /* restrore RBP */
51
52 /* restore return-address */
53 popq %r8
54
55 /* return transfer_t from jump */
56 /* RAX == fctx, RDX == data */
57 movq %rsi, %rdx
58 /* pass transfer_t as first arg in context function */
59 /* RDI == fctx, RSI == data */
60 movq %rax, %rdi
61
62 /* indirect jump to context */
63 jmp *%r8
64 .size jump_fcontext,.-jump_fcontext
65
66 /* Mark that we don't need executable stack. */
67 .section .note.GNU-stack,"",%progbits