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 * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | * 14 * ------------------------------------------------- * 15 * | F14 | F15 | F16 | F17 | * 16 * ------------------------------------------------- * 17 * ------------------------------------------------- * 18 * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * 19 * ------------------------------------------------- * 20 * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | * 21 * ------------------------------------------------- * 22 * | F18 | F19 | F20 | F21 | * 23 * ------------------------------------------------- * 24 * ------------------------------------------------- * 25 * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * 26 * ------------------------------------------------- * 27 * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | * 28 * ------------------------------------------------- * 29 * | F22 | F23 | F24 | F25 | * 30 * ------------------------------------------------- * 31 * ------------------------------------------------- * 32 * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | * 33 * ------------------------------------------------- * 34 * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | * 35 * ------------------------------------------------- * 36 * | F26 | F27 | F28 | F29 | * 37 * ------------------------------------------------- * 38 * ------------------------------------------------- * 39 * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | * 40 * ------------------------------------------------- * 41 * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | * 42 * ------------------------------------------------- * 43 * | F30 | F31 | fpscr | R13 | R14 | * 44 * ------------------------------------------------- * 45 * ------------------------------------------------- * 46 * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | * 47 * ------------------------------------------------- * 48 * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | * 49 * ------------------------------------------------- * 50 * | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | * 51 * ------------------------------------------------- * 52 * ------------------------------------------------- * 53 * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | * 54 * ------------------------------------------------- * 55 * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | * 56 * ------------------------------------------------- * 57 * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | * 58 * ------------------------------------------------- * 59 * ------------------------------------------------- * 60 * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | * 61 * ------------------------------------------------- * 62 * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | * 63 * ------------------------------------------------- * 64 * | R31 |hiddn| CR | LR | PC |bchai|linkr| FCTX| * 65 * ------------------------------------------------- * 66 * ------------------------------------------------- * 67 * | 64 | | * 68 * ------------------------------------------------- * 69 * | 256 | | * 70 * ------------------------------------------------- * 71 * | DATA| | * 72 * ------------------------------------------------- * 73 * * 74 *******************************************************/ 75.globl .jump_fcontext 76.globl jump_fcontext[DS] 77.align 2 78.csect jump_fcontext[DS] 79jump_fcontext: 80 .long .jump_fcontext 81.jump_fcontext: 82 # reserve space on stack 83 subi r1, r1, 244 84 85 stfd f14, 0(r1) # save F14 86 stfd f15, 8(r1) # save F15 87 stfd f16, 16(r1) # save F16 88 stfd f17, 24(r1) # save F17 89 stfd f18, 32(r1) # save F18 90 stfd f19, 40(r1) # save F19 91 stfd f20, 48(r1) # save F20 92 stfd f21, 56(r1) # save F21 93 stfd f22, 64(r1) # save F22 94 stfd f23, 72(r1) # save F23 95 stfd f24, 80(r1) # save F24 96 stfd f25, 88(r1) # save F25 97 stfd f26, 96(r1) # save F26 98 stfd f27, 104(r1) # save F27 99 stfd f28, 112(r1) # save F28 100 stfd f29, 120(r1) # save F29 101 stfd f30, 128(r1) # save F30 102 stfd f31, 136(r1) # save F31 103 mffs f0 # load FPSCR 104 stfd f0, 144(r1) # save FPSCR 105 106 stw r13, 152(r1) # save R13 107 stw r14, 156(r1) # save R14 108 stw r15, 160(r1) # save R15 109 stw r16, 164(r1) # save R16 110 stw r17, 168(r1) # save R17 111 stw r18, 172(r1) # save R18 112 stw r19, 176(r1) # save R19 113 stw r20, 180(r1) # save R20 114 stw r21, 184(r1) # save R21 115 stw r22, 188(r1) # save R22 116 stw r23, 192(r1) # save R23 117 stw r24, 196(r1) # save R24 118 stw r25, 200(r1) # save R25 119 stw r26, 204(r1) # save R26 120 stw r27, 208(r1) # save R27 121 stw r28, 212(r1) # save R28 122 stw r29, 216(r1) # save R29 123 stw r30, 220(r1) # save R30 124 stw r31, 224(r1) # save R31 125 stw r3, 228(r1) # save hidden 126 127 # save CR 128 mfcr r0 129 stw r0, 232(r1) 130 # save LR 131 mflr r0 132 stw r0, 236(r1) 133 # save LR as PC 134 stw r0, 240(r1) 135 136 # store RSP (pointing to context-data) in R6 137 mr r6, r1 138 139 # restore RSP (pointing to context-data) from R4 140 mr r1, r4 141 142 lfd f14, 0(r1) # restore F14 143 lfd f15, 8(r1) # restore F15 144 lfd f16, 16(r1) # restore F16 145 lfd f17, 24(r1) # restore F17 146 lfd f18, 32(r1) # restore F18 147 lfd f19, 40(r1) # restore F19 148 lfd f20, 48(r1) # restore F20 149 lfd f21, 56(r1) # restore F21 150 lfd f22, 64(r1) # restore F22 151 lfd f23, 72(r1) # restore F23 152 lfd f24, 80(r1) # restore F24 153 lfd f25, 88(r1) # restore F25 154 lfd f26, 96(r1) # restore F26 155 lfd f27, 104(r1) # restore F27 156 lfd f28, 112(r1) # restore F28 157 lfd f29, 120(r1) # restore F29 158 lfd f30, 128(r1) # restore F30 159 lfd f31, 136(r1) # restore F31 160 lfd f0, 144(r1) # load FPSCR 161 mtfsf 0xff, f0 # restore FPSCR 162 163 lwz r13, 152(r1) # restore R13 164 lwz r14, 156(r1) # restore R14 165 lwz r15, 160(r1) # restore R15 166 lwz r16, 164(r1) # restore R16 167 lwz r17, 168(r1) # restore R17 168 lwz r18, 172(r1) # restore R18 169 lwz r19, 176(r1) # restore R19 170 lwz r20, 180(r1) # restore R20 171 lwz r21, 184(r1) # restore R21 172 lwz r22, 188(r1) # restore R22 173 lwz r23, 192(r1) # restore R23 174 lwz r24, 196(r1) # restore R24 175 lwz r25, 200(r1) # restore R25 176 lwz r26, 204(r1) # restore R26 177 lwz r27, 208(r1) # restore R27 178 lwz r28, 212(r1) # restore R28 179 lwz r29, 216(r1) # restore R29 180 lwz r30, 220(r1) # restore R30 181 lwz r31, 224(r1) # restore R31 182 lwz r3, 228(r1) # restore hidden 183 184 # restore CR 185 lwz r0, 232(r1) 186 mtcr r0 187 # restore LR 188 lwz r0, 236(r1) 189 mtlr r0 190 # load PC 191 lwz r0, 240(r1) 192 # restore CTR 193 mtctr r0 194 195 # adjust stack 196 addi r1, r1, 244 197 198 # return transfer_t 199 stw r6, 0(r3) 200 stw r5, 4(r3) 201 202 # jump to context 203 bctr 204