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 "ontop_s390x_sysv_elf_gas.S"
35 .align 4 # According to the sample code in the ELF ABI docs
36 .global ontop_fcontext
37 .type ontop_fcontext, @function
48 # Reserved the space for stack to store the data of current context
49 # before we jump to the new context.
52 # save the registers to the stack
53 stmg %r6, %r15, GR_OFFSET(%r15)
55 # save the floating point registers
56 std %f0,FP_OFFSET(%r15)
57 std %f3,FP_OFFSET+8(%r15)
58 std %f5,FP_OFFSET+16(%r15)
59 std %f7,FP_OFFSET+24(%r15)
61 stg %r14,PC_OFFSET(%r15)
63 # Store the SP pointing to the old context-data into R0
66 # Get the SP pointing to the new context-data
67 # Note: Since the return type of the jump_fcontext is struct whose
68 # size is more than 8. The compiler automatically passes the
69 # address of the transfer_t where the data needs to store into R2.
71 # Hence the first param passed to the jump_fcontext which represent
72 # the fctx we want to switch to is present in R3
73 # R2 --> Address of the return transfer_t struct
74 # R3 --> Context we want to switch to
78 # Load the registers with the data present in context-data of the
79 # context we are going to switch to
80 lmg %r6,%r15,GR_OFFSET(%r15)
82 # Restore Floating point registers
83 ld %f1,FP_OFFSET(%r15)
84 ld %f3,FP_OFFSET+8(%r15)
85 ld %f5,FP_OFFSET+16(%r15)
86 ld %f7,FP_OFFSET+24(%r15)
93 # R2 --> Address where the return transfer_t is stored
96 # R5 --> Context function
98 # Store the elements to return transfer_t
102 # Note: The address in R2 points to the place where the return
103 # transfer_t is stored. Since context_function take transfer_t
104 # as first parameter. And R2 is the register which holds the
105 # first parameter value.
107 #jump to context function
110 .size ontop_fcontext,.-ontop_fcontext
111 # Mark that we don't need executable stack.
112 .section .note.GNU-stack,"",%progbits