Rev 60 | Rev 83 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 60 | Rev 82 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | 30 | ||
31 | .global context_save |
31 | .global context_save |
32 | .global context_restore |
32 | .global context_restore |
33 | 33 | ||
34 | context_save: |
34 | context_save: |
35 | alloc loc0 = ar.pfs, 1, 2, 0, 0 |
35 | alloc loc0 = ar.pfs, 1, 9, 0, 0 |
36 | 36 | ||
37 | /* |
37 | /* |
38 | * TODO: save the rest of the context registers. |
38 | * TODO: save the rest of the context registers. |
39 | */ |
39 | */ |
40 | 40 | ||
- | 41 | /* |
|
- | 42 | * Save general registers |
|
- | 43 | */ |
|
41 | st8 [in0] = r1, 8 ;; |
44 | st8 [in0] = r1, 8 ;; |
42 | st8 [in0] = r2, 8 ;; |
45 | st8 [in0] = r2, 8 ;; |
43 | st8 [in0] = r3, 8 ;; |
46 | st8 [in0] = r3, 8 ;; |
44 | st8 [in0] = r4, 8 ;; |
47 | st8 [in0] = r4, 8 ;; |
45 | st8 [in0] = r5, 8 ;; |
48 | st8 [in0] = r5, 8 ;; |
Line 68... | Line 71... | ||
68 | st8 [in0] = r28, 8 ;; |
71 | st8 [in0] = r28, 8 ;; |
69 | st8 [in0] = r29, 8 ;; |
72 | st8 [in0] = r29, 8 ;; |
70 | st8 [in0] = r30, 8 ;; |
73 | st8 [in0] = r30, 8 ;; |
71 | st8 [in0] = r31, 8 ;; |
74 | st8 [in0] = r31, 8 ;; |
72 | 75 | ||
- | 76 | /* |
|
73 | /* save pc */ |
77 | * Save branch registers |
- | 78 | */ |
|
74 | mov loc1 = b0 ;; |
79 | mov loc1 = b0 ;; |
- | 80 | st8 [in0] = loc1, 8 /* save pc */ |
|
- | 81 | mov loc2 = b1 ;; |
|
- | 82 | st8 [in0] = loc2, 8 |
|
- | 83 | mov loc3 = b2 ;; |
|
- | 84 | st8 [in0] = loc3, 8 |
|
- | 85 | mov loc4 = b3 ;; |
|
- | 86 | st8 [in0] = loc4, 8 |
|
- | 87 | mov loc5 = b4 ;; |
|
- | 88 | st8 [in0] = loc5, 8 |
|
- | 89 | mov loc6 = b5 ;; |
|
- | 90 | st8 [in0] = loc6, 8 |
|
- | 91 | mov loc7 = b6 ;; |
|
- | 92 | st8 [in0] = loc7, 8 |
|
- | 93 | mov loc8 = b7 ;; |
|
- | 94 | st8 [in0] = loc8, 8 |
|
- | 95 | ||
- | 96 | /* |
|
- | 97 | * Save predicate registers |
|
- | 98 | */ |
|
- | 99 | mov loc1 = pr ;; |
|
75 | st8 [in0] = loc1, 8 |
100 | st8 [in0] = loc1, 8 |
76 | 101 | ||
77 | mov ar.pfs = loc0 |
102 | mov ar.pfs = loc0 |
78 | 103 | ||
79 | add r8 = r0, r0, 1 /* context_save returns 1 */ |
104 | add r8 = r0, r0, 1 /* context_save returns 1 */ |
80 | br.ret.sptk.many b0 |
105 | br.ret.sptk.many b0 |
81 | 106 | ||
82 | context_restore: |
107 | context_restore: |
83 | alloc loc0 = ar.pfs, 1, 2, 0, 0 |
108 | alloc loc0 = ar.pfs, 1, 9, 0, 0 |
84 | 109 | ||
85 | /* |
110 | /* |
86 | * TODO: restore the rest of the context registers. |
111 | * TODO: restore the rest of the context registers. |
87 | */ |
112 | */ |
88 | 113 | ||
- | 114 | /* |
|
- | 115 | * Restore general registers |
|
- | 116 | */ |
|
89 | ld8 r1 = [in0], 8 ;; |
117 | ld8 r1 = [in0], 8 ;; |
90 | ld8 r2 = [in0], 8 ;; |
118 | ld8 r2 = [in0], 8 ;; |
91 | ld8 r3 = [in0], 8 ;; |
119 | ld8 r3 = [in0], 8 ;; |
92 | ld8 r4 = [in0], 8 ;; |
120 | ld8 r4 = [in0], 8 ;; |
93 | ld8 r5 = [in0], 8 ;; |
121 | ld8 r5 = [in0], 8 ;; |
Line 116... | Line 144... | ||
116 | ld8 r28 = [in0], 8 ;; |
144 | ld8 r28 = [in0], 8 ;; |
117 | ld8 r29 = [in0], 8 ;; |
145 | ld8 r29 = [in0], 8 ;; |
118 | ld8 r30 = [in0], 8 ;; |
146 | ld8 r30 = [in0], 8 ;; |
119 | ld8 r31 = [in0], 8 ;; |
147 | ld8 r31 = [in0], 8 ;; |
120 | 148 | ||
- | 149 | /* |
|
121 | /* restore pc */ |
150 | * Restore branch registers |
- | 151 | */ |
|
122 | ld8 loc1 = [in0], 8 ;; |
152 | ld8 loc1 = [in0], 8 ;; /* restore pc */ |
123 | mov b0 = loc1 |
153 | mov b0 = loc1 |
- | 154 | ld8 loc2 = [in0], 8 ;; |
|
- | 155 | mov b1 = loc2 |
|
- | 156 | ld8 loc3 = [in0], 8 ;; |
|
- | 157 | mov b2 = loc3 |
|
- | 158 | ld8 loc4 = [in0], 8 ;; |
|
- | 159 | mov b3 = loc4 |
|
- | 160 | ld8 loc5 = [in0], 8 ;; |
|
- | 161 | mov b4 = loc5 |
|
- | 162 | ld8 loc6 = [in0], 8 ;; |
|
- | 163 | mov b5 = loc6 |
|
- | 164 | ld8 loc7 = [in0], 8 ;; |
|
- | 165 | mov b6 = loc7 |
|
- | 166 | ld8 loc8 = [in0], 8 ;; |
|
- | 167 | mov b7 = loc8 |
|
- | 168 | ||
- | 169 | ld8 loc1 = [in0], 8 ;; |
|
- | 170 | mov pr = loc1, ~0 |
|
124 | 171 | ||
125 | mov ar.pfs = loc0 |
172 | mov ar.pfs = loc0 |
126 | 173 | ||
127 | mov r8 = r0 /* context_restore returns 0 */ |
174 | mov r8 = r0 /* context_restore returns 0 */ |
128 | br.ret.sptk.many b0 |
175 | br.ret.sptk.many b0 |