]>
Commit | Line | Data |
---|---|---|
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 | * | F20 | F22 | F24 | F26 | * | |
16 | * ------------------------------------------------- * | |
17 | * ------------------------------------------------- * | |
18 | * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * | |
19 | * ------------------------------------------------- * | |
20 | * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | * | |
21 | * ------------------------------------------------- * | |
22 | * | F28 | F30 | S0 | S1 | S2 | S3 | * | |
23 | * ------------------------------------------------- * | |
24 | * ------------------------------------------------- * | |
25 | * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * | |
26 | * ------------------------------------------------- * | |
27 | * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | * | |
28 | * ------------------------------------------------- * | |
29 | * | S4 | S5 | S6 | S7 | FP |hiddn| RA | PC | * | |
30 | * ------------------------------------------------- * | |
31 | * ------------------------------------------------- * | |
32 | * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | * | |
33 | * ------------------------------------------------- * | |
34 | * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | * | |
35 | * ------------------------------------------------- * | |
36 | * | GP | FCTX| DATA| | | | | | * | |
37 | * ------------------------------------------------- * | |
38 | * * | |
39 | * *****************************************************/ | |
40 | ||
41 | .text | |
42 | .globl jump_fcontext | |
43 | .align 2 | |
44 | .type jump_fcontext,@function | |
45 | .ent jump_fcontext | |
46 | jump_fcontext: | |
47 | # reserve space on stack | |
48 | addiu $sp, $sp, -96 | |
49 | ||
50 | sw $s0, 48($sp) # save S0 | |
51 | sw $s1, 52($sp) # save S1 | |
52 | sw $s2, 56($sp) # save S2 | |
53 | sw $s3, 60($sp) # save S3 | |
54 | sw $s4, 64($sp) # save S4 | |
55 | sw $s5, 68($sp) # save S5 | |
56 | sw $s6, 72($sp) # save S6 | |
57 | sw $s7, 76($sp) # save S7 | |
58 | sw $fp, 80($sp) # save FP | |
59 | sw $a0, 84($sp) # save hidden, address of returned transfer_t | |
60 | sw $ra, 88($sp) # save RA | |
61 | sw $ra, 92($sp) # save RA as PC | |
62 | ||
63 | #if defined(__mips_hard_float) | |
64 | s.d $f20, ($sp) # save F20 | |
65 | s.d $f22, 8($sp) # save F22 | |
66 | s.d $f24, 16($sp) # save F24 | |
67 | s.d $f26, 24($sp) # save F26 | |
68 | s.d $f28, 32($sp) # save F28 | |
69 | s.d $f30, 40($sp) # save F30 | |
70 | #endif | |
71 | ||
72 | # store SP (pointing to context-data) in A0 | |
73 | move $a0, $sp | |
74 | ||
75 | # restore SP (pointing to context-data) from A1 | |
76 | move $sp, $a1 | |
77 | ||
78 | #if defined(__mips_hard_float) | |
79 | l.d $f20, ($sp) # restore F20 | |
80 | l.d $f22, 8($sp) # restore F22 | |
81 | l.d $f24, 16($sp) # restore F24 | |
82 | l.d $f26, 24($sp) # restore F26 | |
83 | l.d $f28, 32($sp) # restore F28 | |
84 | l.d $f30, 40($sp) # restore F30 | |
85 | #endif | |
86 | ||
87 | lw $s0, 48($sp) # restore S0 | |
88 | lw $s1, 52($sp) # restore S1 | |
89 | lw $s2, 56($sp) # restore S2 | |
90 | lw $s3, 60($sp) # restore S3 | |
91 | lw $s4, 64($sp) # restore S4 | |
92 | lw $s5, 68($sp) # restore S5 | |
93 | lw $s6, 72($sp) # restore S6 | |
94 | lw $s7, 76($sp) # restore S7 | |
95 | lw $fp, 80($sp) # restore FP | |
96 | lw $t0, 84($sp) # restore hidden, address of returned transfer_t | |
97 | lw $ra, 88($sp) # restore RA | |
98 | ||
99 | # load PC | |
100 | lw $t9, 92($sp) | |
101 | ||
102 | # adjust stack | |
103 | addiu $sp, $sp, 96 | |
104 | ||
105 | # return transfer_t from jump | |
106 | sw $a0, ($t0) # fctx of transfer_t | |
107 | sw $a2, 4($t0) # data of transfer_t | |
108 | # pass transfer_t as first arg in context function | |
109 | # A0 == fctx, A1 == data | |
110 | move $a1, $a2 | |
111 | ||
112 | # jump to context | |
113 | jr $t9 | |
114 | .end jump_fcontext | |
115 | .size jump_fcontext, .-jump_fcontext | |
116 | ||
117 | /* Mark that we don't need executable stack. */ | |
118 | .section .note.GNU-stack,"",%progbits |