1 /*******************************************************
3 * ------------------------------------------------- *
4 * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
5 * ------------------------------------------------- *
6 * | 0 | 8 | 16 | 24 | *
7 * ------------------------------------------------- *
8 * | R6 | R7 | R8 | R9 | *
9 * ------------------------------------------------- *
10 * ------------------------------------------------- *
11 * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
12 * ------------------------------------------------- *
13 * | 32 | 40 | 48 | 56 | *
14 * ------------------------------------------------- *
15 * | R10 | R11 | R12 | R13 | *
16 * ------------------------------------------------- *
17 * ------------------------------------------------- *
18 * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
19 * ------------------------------------------------- *
20 * | 64 | 72 | 80 | 88 | *
21 * ------------------------------------------------- *
22 * | R14/LR | R15 | F1 | F3 | *
23 * ------------------------------------------------- *
24 * ------------------------------------------------- *
25 * | 24 | 25 | 26 | 27 | 28 | 29 | | *
26 * ------------------------------------------------- *
27 * | 96 | 104 | 112 | 120 | *
28 * ------------------------------------------------- *
29 * | F5 | F7 | PC | | *
30 * ------------------------------------------------- *
31 * *****************************************************/
33 .file "jump_s390x_sysv_elf_gas.S"
35 .align 4 # According to the sample code in the ELF ABI docs
37 .type jump_fcontext, @function
45 #define L_STACKFRAME 120
49 # Reserved the space for stack to store the data of current context
50 # before we jump to the new context.
51 aghi %r15,-L_STACKFRAME
53 # save the registers to the stack
54 stmg %r6, %r15, GR_OFFSET(%r15)
56 # save the floating point registers
57 std %f0,FP_OFFSET(%r15)
58 std %f3,FP_OFFSET+8(%r15)
59 std %f5,FP_OFFSET+16(%r15)
60 std %f7,FP_OFFSET+24(%r15)
63 stg %r14,PC_OFFSET(%r15)
65 # Store the SP pointing to the old context-data into R0
68 # Get the SP pointing to the new context-data
69 # Note: Since the return type of the jump_fcontext is struct whose
70 # size is more than 8. The compiler automatically passes the
71 # address of the transfer_t where the data needs to store into R2.
73 # Hence the first param passed to the jump_fcontext which represent
74 # the fctx we want to switch to is present in R3
75 # R2 --> Address of the return transfer_t struct
76 # R3 --> Context we want to switch to
80 # Load the registers with the data present in context-data of the
81 # context we are going to switch to
82 lmg %r6, %r14, GR_OFFSET(%r15)
84 # Restore Floating point registers
85 ld %f1,FP_OFFSET(%r15)
86 ld %f3,FP_OFFSET+8(%r15)
87 ld %f5,FP_OFFSET+16(%r15)
88 ld %f7,FP_OFFSET+24(%r15)
91 lg %r1,PC_OFFSET(%r15)
96 # R2 --> Address where the return transfer_t is stored
100 # Store the elements to return transfer_t
104 # Note: The address in R2 points to the place where the return
105 # transfer_t is stored. Since context_function take transfer_t
106 # as first parameter. And R2 is the register which holds the
107 # first parameter value.
112 .size jump_fcontext,.-jump_fcontext
113 # Mark that we don't need executable stack.
114 .section .note.GNU-stack,"",%progbits