Loading...
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 1995, 1996, 1998, 1999, 2002, 2003 Ralf Baechle
7 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
8 * Copyright (C) 1994, 1995, 1996, by Andreas Busse
9 * Copyright (C) 1999 Silicon Graphics, Inc.
10 * Copyright (C) 2000 MIPS Technologies, Inc.
11 * written by Carsten Langgaard, carstenl@mips.com
12 */
13#include <asm/asm.h>
14#include <asm/export.h>
15#include <asm/asm-offsets.h>
16#include <asm/mipsregs.h>
17#include <asm/regdef.h>
18#include <asm/stackframe.h>
19
20/*
21 * task_struct *resume(task_struct *prev, task_struct *next,
22 * struct thread_info *next_ti)
23 */
24 .align 7
25 LEAF(resume)
26 .set arch=octeon
27 mfc0 t1, CP0_STATUS
28 LONG_S t1, THREAD_STATUS(a0)
29 cpu_save_nonscratch a0
30 LONG_S ra, THREAD_REG31(a0)
31
32#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0
33 /* Check if we need to store CVMSEG state */
34 dmfc0 t0, $11,7 /* CvmMemCtl */
35 bbit0 t0, 6, 3f /* Is user access enabled? */
36
37 /* Store the CVMSEG state */
38 /* Extract the size of CVMSEG */
39 andi t0, 0x3f
40 /* Multiply * (cache line size/sizeof(long)/2) */
41 sll t0, 7-LONGLOG-1
42 li t1, -32768 /* Base address of CVMSEG */
43 LONG_ADDI t2, a0, THREAD_CVMSEG /* Where to store CVMSEG to */
44 synciobdma
452:
46 .set noreorder
47 LONG_L t8, 0(t1) /* Load from CVMSEG */
48 subu t0, 1 /* Decrement loop var */
49 LONG_L t9, LONGSIZE(t1)/* Load from CVMSEG */
50 LONG_ADDU t1, LONGSIZE*2 /* Increment loc in CVMSEG */
51 LONG_S t8, 0(t2) /* Store CVMSEG to thread storage */
52 LONG_ADDU t2, LONGSIZE*2 /* Increment loc in thread storage */
53 bnez t0, 2b /* Loop until we've copied it all */
54 LONG_S t9, -LONGSIZE(t2)/* Store CVMSEG to thread storage */
55 .set reorder
56
57 /* Disable access to CVMSEG */
58 dmfc0 t0, $11,7 /* CvmMemCtl */
59 xori t0, t0, 0x40 /* Bit 6 is CVMSEG user enable */
60 dmtc0 t0, $11,7 /* CvmMemCtl */
61#endif
623:
63
64#if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_SMP)
65 PTR_LA t8, __stack_chk_guard
66 LONG_L t9, TASK_STACK_CANARY(a1)
67 LONG_S t9, 0(t8)
68#endif
69
70 /*
71 * The order of restoring the registers takes care of the race
72 * updating $28, $29 and kernelsp without disabling ints.
73 */
74 move $28, a2
75 cpu_restore_nonscratch a1
76
77 PTR_ADDU t0, $28, _THREAD_SIZE - 32
78 set_saved_sp t0, t1, t2
79
80 mfc0 t1, CP0_STATUS /* Do we really need this? */
81 li a3, 0xff01
82 and t1, a3
83 LONG_L a2, THREAD_STATUS(a1)
84 nor a3, $0, a3
85 and a2, a3
86 or a2, t1
87 mtc0 a2, CP0_STATUS
88 move v0, a0
89 jr ra
90 END(resume)
91
92/*
93 * void octeon_cop2_save(struct octeon_cop2_state *a0)
94 */
95 .align 7
96 .set push
97 .set noreorder
98 LEAF(octeon_cop2_save)
99
100 dmfc0 t9, $9,7 /* CvmCtl register. */
101
102 /* Save the COP2 CRC state */
103 dmfc2 t0, 0x0201
104 dmfc2 t1, 0x0202
105 dmfc2 t2, 0x0200
106 sd t0, OCTEON_CP2_CRC_IV(a0)
107 sd t1, OCTEON_CP2_CRC_LENGTH(a0)
108 /* Skip next instructions if CvmCtl[NODFA_CP2] set */
109 bbit1 t9, 28, 1f
110 sd t2, OCTEON_CP2_CRC_POLY(a0)
111
112 /* Save the LLM state */
113 dmfc2 t0, 0x0402
114 dmfc2 t1, 0x040A
115 sd t0, OCTEON_CP2_LLM_DAT(a0)
116
1171: bbit1 t9, 26, 3f /* done if CvmCtl[NOCRYPTO] set */
118 sd t1, OCTEON_CP2_LLM_DAT+8(a0)
119
120 /* Save the COP2 crypto state */
121 /* this part is mostly common to both pass 1 and later revisions */
122 dmfc2 t0, 0x0084
123 dmfc2 t1, 0x0080
124 dmfc2 t2, 0x0081
125 dmfc2 t3, 0x0082
126 sd t0, OCTEON_CP2_3DES_IV(a0)
127 dmfc2 t0, 0x0088
128 sd t1, OCTEON_CP2_3DES_KEY(a0)
129 dmfc2 t1, 0x0111 /* only necessary for pass 1 */
130 sd t2, OCTEON_CP2_3DES_KEY+8(a0)
131 dmfc2 t2, 0x0102
132 sd t3, OCTEON_CP2_3DES_KEY+16(a0)
133 dmfc2 t3, 0x0103
134 sd t0, OCTEON_CP2_3DES_RESULT(a0)
135 dmfc2 t0, 0x0104
136 sd t1, OCTEON_CP2_AES_INP0(a0) /* only necessary for pass 1 */
137 dmfc2 t1, 0x0105
138 sd t2, OCTEON_CP2_AES_IV(a0)
139 dmfc2 t2, 0x0106
140 sd t3, OCTEON_CP2_AES_IV+8(a0)
141 dmfc2 t3, 0x0107
142 sd t0, OCTEON_CP2_AES_KEY(a0)
143 dmfc2 t0, 0x0110
144 sd t1, OCTEON_CP2_AES_KEY+8(a0)
145 dmfc2 t1, 0x0100
146 sd t2, OCTEON_CP2_AES_KEY+16(a0)
147 dmfc2 t2, 0x0101
148 sd t3, OCTEON_CP2_AES_KEY+24(a0)
149 mfc0 v0, $15,0 /* Get the processor ID register */
150 sd t0, OCTEON_CP2_AES_KEYLEN(a0)
151 li v1, 0x000d0000 /* This is the processor ID of Octeon Pass1 */
152 sd t1, OCTEON_CP2_AES_RESULT(a0)
153 /* Skip to the Pass1 version of the remainder of the COP2 state */
154 beq v0, v1, 2f
155 sd t2, OCTEON_CP2_AES_RESULT+8(a0)
156
157 /* the non-pass1 state when !CvmCtl[NOCRYPTO] */
158 dmfc2 t1, 0x0240
159 dmfc2 t2, 0x0241
160 ori v1, v1, 0x9500 /* lowest OCTEON III PrId*/
161 dmfc2 t3, 0x0242
162 subu v1, v0, v1 /* prid - lowest OCTEON III PrId */
163 dmfc2 t0, 0x0243
164 sd t1, OCTEON_CP2_HSH_DATW(a0)
165 dmfc2 t1, 0x0244
166 sd t2, OCTEON_CP2_HSH_DATW+8(a0)
167 dmfc2 t2, 0x0245
168 sd t3, OCTEON_CP2_HSH_DATW+16(a0)
169 dmfc2 t3, 0x0246
170 sd t0, OCTEON_CP2_HSH_DATW+24(a0)
171 dmfc2 t0, 0x0247
172 sd t1, OCTEON_CP2_HSH_DATW+32(a0)
173 dmfc2 t1, 0x0248
174 sd t2, OCTEON_CP2_HSH_DATW+40(a0)
175 dmfc2 t2, 0x0249
176 sd t3, OCTEON_CP2_HSH_DATW+48(a0)
177 dmfc2 t3, 0x024A
178 sd t0, OCTEON_CP2_HSH_DATW+56(a0)
179 dmfc2 t0, 0x024B
180 sd t1, OCTEON_CP2_HSH_DATW+64(a0)
181 dmfc2 t1, 0x024C
182 sd t2, OCTEON_CP2_HSH_DATW+72(a0)
183 dmfc2 t2, 0x024D
184 sd t3, OCTEON_CP2_HSH_DATW+80(a0)
185 dmfc2 t3, 0x024E
186 sd t0, OCTEON_CP2_HSH_DATW+88(a0)
187 dmfc2 t0, 0x0250
188 sd t1, OCTEON_CP2_HSH_DATW+96(a0)
189 dmfc2 t1, 0x0251
190 sd t2, OCTEON_CP2_HSH_DATW+104(a0)
191 dmfc2 t2, 0x0252
192 sd t3, OCTEON_CP2_HSH_DATW+112(a0)
193 dmfc2 t3, 0x0253
194 sd t0, OCTEON_CP2_HSH_IVW(a0)
195 dmfc2 t0, 0x0254
196 sd t1, OCTEON_CP2_HSH_IVW+8(a0)
197 dmfc2 t1, 0x0255
198 sd t2, OCTEON_CP2_HSH_IVW+16(a0)
199 dmfc2 t2, 0x0256
200 sd t3, OCTEON_CP2_HSH_IVW+24(a0)
201 dmfc2 t3, 0x0257
202 sd t0, OCTEON_CP2_HSH_IVW+32(a0)
203 dmfc2 t0, 0x0258
204 sd t1, OCTEON_CP2_HSH_IVW+40(a0)
205 dmfc2 t1, 0x0259
206 sd t2, OCTEON_CP2_HSH_IVW+48(a0)
207 dmfc2 t2, 0x025E
208 sd t3, OCTEON_CP2_HSH_IVW+56(a0)
209 dmfc2 t3, 0x025A
210 sd t0, OCTEON_CP2_GFM_MULT(a0)
211 dmfc2 t0, 0x025B
212 sd t1, OCTEON_CP2_GFM_MULT+8(a0)
213 sd t2, OCTEON_CP2_GFM_POLY(a0)
214 sd t3, OCTEON_CP2_GFM_RESULT(a0)
215 bltz v1, 4f
216 sd t0, OCTEON_CP2_GFM_RESULT+8(a0)
217 /* OCTEON III things*/
218 dmfc2 t0, 0x024F
219 dmfc2 t1, 0x0050
220 sd t0, OCTEON_CP2_SHA3(a0)
221 sd t1, OCTEON_CP2_SHA3+8(a0)
2224:
223 jr ra
224 nop
225
2262: /* pass 1 special stuff when !CvmCtl[NOCRYPTO] */
227 dmfc2 t3, 0x0040
228 dmfc2 t0, 0x0041
229 dmfc2 t1, 0x0042
230 dmfc2 t2, 0x0043
231 sd t3, OCTEON_CP2_HSH_DATW(a0)
232 dmfc2 t3, 0x0044
233 sd t0, OCTEON_CP2_HSH_DATW+8(a0)
234 dmfc2 t0, 0x0045
235 sd t1, OCTEON_CP2_HSH_DATW+16(a0)
236 dmfc2 t1, 0x0046
237 sd t2, OCTEON_CP2_HSH_DATW+24(a0)
238 dmfc2 t2, 0x0048
239 sd t3, OCTEON_CP2_HSH_DATW+32(a0)
240 dmfc2 t3, 0x0049
241 sd t0, OCTEON_CP2_HSH_DATW+40(a0)
242 dmfc2 t0, 0x004A
243 sd t1, OCTEON_CP2_HSH_DATW+48(a0)
244 sd t2, OCTEON_CP2_HSH_IVW(a0)
245 sd t3, OCTEON_CP2_HSH_IVW+8(a0)
246 sd t0, OCTEON_CP2_HSH_IVW+16(a0)
247
2483: /* pass 1 or CvmCtl[NOCRYPTO] set */
249 jr ra
250 nop
251 END(octeon_cop2_save)
252 .set pop
253
254/*
255 * void octeon_cop2_restore(struct octeon_cop2_state *a0)
256 */
257 .align 7
258 .set push
259 .set noreorder
260 LEAF(octeon_cop2_restore)
261 /* First cache line was prefetched before the call */
262 pref 4, 128(a0)
263 dmfc0 t9, $9,7 /* CvmCtl register. */
264
265 pref 4, 256(a0)
266 ld t0, OCTEON_CP2_CRC_IV(a0)
267 pref 4, 384(a0)
268 ld t1, OCTEON_CP2_CRC_LENGTH(a0)
269 ld t2, OCTEON_CP2_CRC_POLY(a0)
270
271 /* Restore the COP2 CRC state */
272 dmtc2 t0, 0x0201
273 dmtc2 t1, 0x1202
274 bbit1 t9, 28, 2f /* Skip LLM if CvmCtl[NODFA_CP2] is set */
275 dmtc2 t2, 0x4200
276
277 /* Restore the LLM state */
278 ld t0, OCTEON_CP2_LLM_DAT(a0)
279 ld t1, OCTEON_CP2_LLM_DAT+8(a0)
280 dmtc2 t0, 0x0402
281 dmtc2 t1, 0x040A
282
2832:
284 bbit1 t9, 26, done_restore /* done if CvmCtl[NOCRYPTO] set */
285 nop
286
287 /* Restore the COP2 crypto state common to pass 1 and pass 2 */
288 ld t0, OCTEON_CP2_3DES_IV(a0)
289 ld t1, OCTEON_CP2_3DES_KEY(a0)
290 ld t2, OCTEON_CP2_3DES_KEY+8(a0)
291 dmtc2 t0, 0x0084
292 ld t0, OCTEON_CP2_3DES_KEY+16(a0)
293 dmtc2 t1, 0x0080
294 ld t1, OCTEON_CP2_3DES_RESULT(a0)
295 dmtc2 t2, 0x0081
296 ld t2, OCTEON_CP2_AES_INP0(a0) /* only really needed for pass 1 */
297 dmtc2 t0, 0x0082
298 ld t0, OCTEON_CP2_AES_IV(a0)
299 dmtc2 t1, 0x0098
300 ld t1, OCTEON_CP2_AES_IV+8(a0)
301 dmtc2 t2, 0x010A /* only really needed for pass 1 */
302 ld t2, OCTEON_CP2_AES_KEY(a0)
303 dmtc2 t0, 0x0102
304 ld t0, OCTEON_CP2_AES_KEY+8(a0)
305 dmtc2 t1, 0x0103
306 ld t1, OCTEON_CP2_AES_KEY+16(a0)
307 dmtc2 t2, 0x0104
308 ld t2, OCTEON_CP2_AES_KEY+24(a0)
309 dmtc2 t0, 0x0105
310 ld t0, OCTEON_CP2_AES_KEYLEN(a0)
311 dmtc2 t1, 0x0106
312 ld t1, OCTEON_CP2_AES_RESULT(a0)
313 dmtc2 t2, 0x0107
314 ld t2, OCTEON_CP2_AES_RESULT+8(a0)
315 mfc0 t3, $15,0 /* Get the processor ID register */
316 dmtc2 t0, 0x0110
317 li v0, 0x000d0000 /* This is the processor ID of Octeon Pass1 */
318 dmtc2 t1, 0x0100
319 bne v0, t3, 3f /* Skip the next stuff for non-pass1 */
320 dmtc2 t2, 0x0101
321
322 /* this code is specific for pass 1 */
323 ld t0, OCTEON_CP2_HSH_DATW(a0)
324 ld t1, OCTEON_CP2_HSH_DATW+8(a0)
325 ld t2, OCTEON_CP2_HSH_DATW+16(a0)
326 dmtc2 t0, 0x0040
327 ld t0, OCTEON_CP2_HSH_DATW+24(a0)
328 dmtc2 t1, 0x0041
329 ld t1, OCTEON_CP2_HSH_DATW+32(a0)
330 dmtc2 t2, 0x0042
331 ld t2, OCTEON_CP2_HSH_DATW+40(a0)
332 dmtc2 t0, 0x0043
333 ld t0, OCTEON_CP2_HSH_DATW+48(a0)
334 dmtc2 t1, 0x0044
335 ld t1, OCTEON_CP2_HSH_IVW(a0)
336 dmtc2 t2, 0x0045
337 ld t2, OCTEON_CP2_HSH_IVW+8(a0)
338 dmtc2 t0, 0x0046
339 ld t0, OCTEON_CP2_HSH_IVW+16(a0)
340 dmtc2 t1, 0x0048
341 dmtc2 t2, 0x0049
342 b done_restore /* unconditional branch */
343 dmtc2 t0, 0x004A
344
3453: /* this is post-pass1 code */
346 ld t2, OCTEON_CP2_HSH_DATW(a0)
347 ori v0, v0, 0x9500 /* lowest OCTEON III PrId*/
348 ld t0, OCTEON_CP2_HSH_DATW+8(a0)
349 ld t1, OCTEON_CP2_HSH_DATW+16(a0)
350 dmtc2 t2, 0x0240
351 ld t2, OCTEON_CP2_HSH_DATW+24(a0)
352 dmtc2 t0, 0x0241
353 ld t0, OCTEON_CP2_HSH_DATW+32(a0)
354 dmtc2 t1, 0x0242
355 ld t1, OCTEON_CP2_HSH_DATW+40(a0)
356 dmtc2 t2, 0x0243
357 ld t2, OCTEON_CP2_HSH_DATW+48(a0)
358 dmtc2 t0, 0x0244
359 ld t0, OCTEON_CP2_HSH_DATW+56(a0)
360 dmtc2 t1, 0x0245
361 ld t1, OCTEON_CP2_HSH_DATW+64(a0)
362 dmtc2 t2, 0x0246
363 ld t2, OCTEON_CP2_HSH_DATW+72(a0)
364 dmtc2 t0, 0x0247
365 ld t0, OCTEON_CP2_HSH_DATW+80(a0)
366 dmtc2 t1, 0x0248
367 ld t1, OCTEON_CP2_HSH_DATW+88(a0)
368 dmtc2 t2, 0x0249
369 ld t2, OCTEON_CP2_HSH_DATW+96(a0)
370 dmtc2 t0, 0x024A
371 ld t0, OCTEON_CP2_HSH_DATW+104(a0)
372 dmtc2 t1, 0x024B
373 ld t1, OCTEON_CP2_HSH_DATW+112(a0)
374 dmtc2 t2, 0x024C
375 ld t2, OCTEON_CP2_HSH_IVW(a0)
376 dmtc2 t0, 0x024D
377 ld t0, OCTEON_CP2_HSH_IVW+8(a0)
378 dmtc2 t1, 0x024E
379 ld t1, OCTEON_CP2_HSH_IVW+16(a0)
380 dmtc2 t2, 0x0250
381 ld t2, OCTEON_CP2_HSH_IVW+24(a0)
382 dmtc2 t0, 0x0251
383 ld t0, OCTEON_CP2_HSH_IVW+32(a0)
384 dmtc2 t1, 0x0252
385 ld t1, OCTEON_CP2_HSH_IVW+40(a0)
386 dmtc2 t2, 0x0253
387 ld t2, OCTEON_CP2_HSH_IVW+48(a0)
388 dmtc2 t0, 0x0254
389 ld t0, OCTEON_CP2_HSH_IVW+56(a0)
390 dmtc2 t1, 0x0255
391 ld t1, OCTEON_CP2_GFM_MULT(a0)
392 dmtc2 t2, 0x0256
393 ld t2, OCTEON_CP2_GFM_MULT+8(a0)
394 dmtc2 t0, 0x0257
395 ld t0, OCTEON_CP2_GFM_POLY(a0)
396 dmtc2 t1, 0x0258
397 ld t1, OCTEON_CP2_GFM_RESULT(a0)
398 dmtc2 t2, 0x0259
399 ld t2, OCTEON_CP2_GFM_RESULT+8(a0)
400 dmtc2 t0, 0x025E
401 subu v0, t3, v0 /* prid - lowest OCTEON III PrId */
402 dmtc2 t1, 0x025A
403 bltz v0, done_restore
404 dmtc2 t2, 0x025B
405 /* OCTEON III things*/
406 ld t0, OCTEON_CP2_SHA3(a0)
407 ld t1, OCTEON_CP2_SHA3+8(a0)
408 dmtc2 t0, 0x0051
409 dmtc2 t1, 0x0050
410done_restore:
411 jr ra
412 nop
413 END(octeon_cop2_restore)
414 .set pop
415
416/*
417 * void octeon_mult_save()
418 * sp is assumed to point to a struct pt_regs
419 *
420 * NOTE: This is called in SAVE_TEMP in stackframe.h. It can
421 * safely modify v1,k0, k1,$10-$15, and $24. It will
422 * be overwritten with a processor specific version of the code.
423 */
424 .p2align 7
425 .set push
426 .set noreorder
427 LEAF(octeon_mult_save)
428 jr ra
429 nop
430 .space 30 * 4, 0
431octeon_mult_save_end:
432 EXPORT(octeon_mult_save_end)
433 END(octeon_mult_save)
434
435 LEAF(octeon_mult_save2)
436 /* Save the multiplier state OCTEON II and earlier*/
437 v3mulu k0, $0, $0
438 v3mulu k1, $0, $0
439 sd k0, PT_MTP(sp) /* PT_MTP has P0 */
440 v3mulu k0, $0, $0
441 sd k1, PT_MTP+8(sp) /* PT_MTP+8 has P1 */
442 ori k1, $0, 1
443 v3mulu k1, k1, $0
444 sd k0, PT_MTP+16(sp) /* PT_MTP+16 has P2 */
445 v3mulu k0, $0, $0
446 sd k1, PT_MPL(sp) /* PT_MPL has MPL0 */
447 v3mulu k1, $0, $0
448 sd k0, PT_MPL+8(sp) /* PT_MPL+8 has MPL1 */
449 jr ra
450 sd k1, PT_MPL+16(sp) /* PT_MPL+16 has MPL2 */
451octeon_mult_save2_end:
452 EXPORT(octeon_mult_save2_end)
453 END(octeon_mult_save2)
454
455 LEAF(octeon_mult_save3)
456 /* Save the multiplier state OCTEON III */
457 v3mulu $10, $0, $0 /* read P0 */
458 v3mulu $11, $0, $0 /* read P1 */
459 v3mulu $12, $0, $0 /* read P2 */
460 sd $10, PT_MTP+(0*8)(sp) /* store P0 */
461 v3mulu $10, $0, $0 /* read P3 */
462 sd $11, PT_MTP+(1*8)(sp) /* store P1 */
463 v3mulu $11, $0, $0 /* read P4 */
464 sd $12, PT_MTP+(2*8)(sp) /* store P2 */
465 ori $13, $0, 1
466 v3mulu $12, $0, $0 /* read P5 */
467 sd $10, PT_MTP+(3*8)(sp) /* store P3 */
468 v3mulu $13, $13, $0 /* P4-P0 = MPL5-MPL1, $13 = MPL0 */
469 sd $11, PT_MTP+(4*8)(sp) /* store P4 */
470 v3mulu $10, $0, $0 /* read MPL1 */
471 sd $12, PT_MTP+(5*8)(sp) /* store P5 */
472 v3mulu $11, $0, $0 /* read MPL2 */
473 sd $13, PT_MPL+(0*8)(sp) /* store MPL0 */
474 v3mulu $12, $0, $0 /* read MPL3 */
475 sd $10, PT_MPL+(1*8)(sp) /* store MPL1 */
476 v3mulu $10, $0, $0 /* read MPL4 */
477 sd $11, PT_MPL+(2*8)(sp) /* store MPL2 */
478 v3mulu $11, $0, $0 /* read MPL5 */
479 sd $12, PT_MPL+(3*8)(sp) /* store MPL3 */
480 sd $10, PT_MPL+(4*8)(sp) /* store MPL4 */
481 jr ra
482 sd $11, PT_MPL+(5*8)(sp) /* store MPL5 */
483octeon_mult_save3_end:
484 EXPORT(octeon_mult_save3_end)
485 END(octeon_mult_save3)
486 .set pop
487
488/*
489 * void octeon_mult_restore()
490 * sp is assumed to point to a struct pt_regs
491 *
492 * NOTE: This is called in RESTORE_TEMP in stackframe.h.
493 */
494 .p2align 7
495 .set push
496 .set noreorder
497 LEAF(octeon_mult_restore)
498 jr ra
499 nop
500 .space 30 * 4, 0
501octeon_mult_restore_end:
502 EXPORT(octeon_mult_restore_end)
503 END(octeon_mult_restore)
504
505 LEAF(octeon_mult_restore2)
506 ld v0, PT_MPL(sp) /* MPL0 */
507 ld v1, PT_MPL+8(sp) /* MPL1 */
508 ld k0, PT_MPL+16(sp) /* MPL2 */
509 /* Restore the multiplier state */
510 ld k1, PT_MTP+16(sp) /* P2 */
511 mtm0 v0 /* MPL0 */
512 ld v0, PT_MTP+8(sp) /* P1 */
513 mtm1 v1 /* MPL1 */
514 ld v1, PT_MTP(sp) /* P0 */
515 mtm2 k0 /* MPL2 */
516 mtp2 k1 /* P2 */
517 mtp1 v0 /* P1 */
518 jr ra
519 mtp0 v1 /* P0 */
520octeon_mult_restore2_end:
521 EXPORT(octeon_mult_restore2_end)
522 END(octeon_mult_restore2)
523
524 LEAF(octeon_mult_restore3)
525 ld $12, PT_MPL+(0*8)(sp) /* read MPL0 */
526 ld $13, PT_MPL+(3*8)(sp) /* read MPL3 */
527 ld $10, PT_MPL+(1*8)(sp) /* read MPL1 */
528 ld $11, PT_MPL+(4*8)(sp) /* read MPL4 */
529 .word 0x718d0008
530 /* mtm0 $12, $13 restore MPL0 and MPL3 */
531 ld $12, PT_MPL+(2*8)(sp) /* read MPL2 */
532 .word 0x714b000c
533 /* mtm1 $10, $11 restore MPL1 and MPL4 */
534 ld $13, PT_MPL+(5*8)(sp) /* read MPL5 */
535 ld $10, PT_MTP+(0*8)(sp) /* read P0 */
536 ld $11, PT_MTP+(3*8)(sp) /* read P3 */
537 .word 0x718d000d
538 /* mtm2 $12, $13 restore MPL2 and MPL5 */
539 ld $12, PT_MTP+(1*8)(sp) /* read P1 */
540 .word 0x714b0009
541 /* mtp0 $10, $11 restore P0 and P3 */
542 ld $13, PT_MTP+(4*8)(sp) /* read P4 */
543 ld $10, PT_MTP+(2*8)(sp) /* read P2 */
544 ld $11, PT_MTP+(5*8)(sp) /* read P5 */
545 .word 0x718d000a
546 /* mtp1 $12, $13 restore P1 and P4 */
547 jr ra
548 .word 0x714b000b
549 /* mtp2 $10, $11 restore P2 and P5 */
550
551octeon_mult_restore3_end:
552 EXPORT(octeon_mult_restore3_end)
553 END(octeon_mult_restore3)
554 .set pop
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 1995, 1996, 1998, 1999, 2002, 2003 Ralf Baechle
7 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
8 * Copyright (C) 1994, 1995, 1996, by Andreas Busse
9 * Copyright (C) 1999 Silicon Graphics, Inc.
10 * Copyright (C) 2000 MIPS Technologies, Inc.
11 * written by Carsten Langgaard, carstenl@mips.com
12 */
13#include <asm/asm.h>
14#include <asm/cachectl.h>
15#include <asm/fpregdef.h>
16#include <asm/mipsregs.h>
17#include <asm/asm-offsets.h>
18#include <asm/pgtable-bits.h>
19#include <asm/regdef.h>
20#include <asm/stackframe.h>
21#include <asm/thread_info.h>
22
23#include <asm/asmmacro.h>
24
25/*
26 * Offset to the current process status flags, the first 32 bytes of the
27 * stack are not used.
28 */
29#define ST_OFF (_THREAD_SIZE - 32 - PT_SIZE + PT_STATUS)
30
31/*
32 * task_struct *resume(task_struct *prev, task_struct *next,
33 * struct thread_info *next_ti, int usedfpu)
34 */
35 .align 7
36 LEAF(resume)
37 .set arch=octeon
38 mfc0 t1, CP0_STATUS
39 LONG_S t1, THREAD_STATUS(a0)
40 cpu_save_nonscratch a0
41 LONG_S ra, THREAD_REG31(a0)
42
43#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0
44 /* Check if we need to store CVMSEG state */
45 mfc0 t0, $11,7 /* CvmMemCtl */
46 bbit0 t0, 6, 3f /* Is user access enabled? */
47
48 /* Store the CVMSEG state */
49 /* Extract the size of CVMSEG */
50 andi t0, 0x3f
51 /* Multiply * (cache line size/sizeof(long)/2) */
52 sll t0, 7-LONGLOG-1
53 li t1, -32768 /* Base address of CVMSEG */
54 LONG_ADDI t2, a0, THREAD_CVMSEG /* Where to store CVMSEG to */
55 synciobdma
562:
57 .set noreorder
58 LONG_L t8, 0(t1) /* Load from CVMSEG */
59 subu t0, 1 /* Decrement loop var */
60 LONG_L t9, LONGSIZE(t1)/* Load from CVMSEG */
61 LONG_ADDU t1, LONGSIZE*2 /* Increment loc in CVMSEG */
62 LONG_S t8, 0(t2) /* Store CVMSEG to thread storage */
63 LONG_ADDU t2, LONGSIZE*2 /* Increment loc in thread storage */
64 bnez t0, 2b /* Loop until we've copied it all */
65 LONG_S t9, -LONGSIZE(t2)/* Store CVMSEG to thread storage */
66 .set reorder
67
68 /* Disable access to CVMSEG */
69 mfc0 t0, $11,7 /* CvmMemCtl */
70 xori t0, t0, 0x40 /* Bit 6 is CVMSEG user enable */
71 mtc0 t0, $11,7 /* CvmMemCtl */
72#endif
733:
74
75#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
76 PTR_LA t8, __stack_chk_guard
77 LONG_L t9, TASK_STACK_CANARY(a1)
78 LONG_S t9, 0(t8)
79#endif
80
81 /*
82 * The order of restoring the registers takes care of the race
83 * updating $28, $29 and kernelsp without disabling ints.
84 */
85 move $28, a2
86 cpu_restore_nonscratch a1
87
88#if (_THREAD_SIZE - 32) < 0x8000
89 PTR_ADDIU t0, $28, _THREAD_SIZE - 32
90#else
91 PTR_LI t0, _THREAD_SIZE - 32
92 PTR_ADDU t0, $28
93#endif
94 set_saved_sp t0, t1, t2
95
96 mfc0 t1, CP0_STATUS /* Do we really need this? */
97 li a3, 0xff01
98 and t1, a3
99 LONG_L a2, THREAD_STATUS(a1)
100 nor a3, $0, a3
101 and a2, a3
102 or a2, t1
103 mtc0 a2, CP0_STATUS
104 move v0, a0
105 jr ra
106 END(resume)
107
108/*
109 * void octeon_cop2_save(struct octeon_cop2_state *a0)
110 */
111 .align 7
112 LEAF(octeon_cop2_save)
113
114 dmfc0 t9, $9,7 /* CvmCtl register. */
115
116 /* Save the COP2 CRC state */
117 dmfc2 t0, 0x0201
118 dmfc2 t1, 0x0202
119 dmfc2 t2, 0x0200
120 sd t0, OCTEON_CP2_CRC_IV(a0)
121 sd t1, OCTEON_CP2_CRC_LENGTH(a0)
122 sd t2, OCTEON_CP2_CRC_POLY(a0)
123 /* Skip next instructions if CvmCtl[NODFA_CP2] set */
124 bbit1 t9, 28, 1f
125
126 /* Save the LLM state */
127 dmfc2 t0, 0x0402
128 dmfc2 t1, 0x040A
129 sd t0, OCTEON_CP2_LLM_DAT(a0)
130 sd t1, OCTEON_CP2_LLM_DAT+8(a0)
131
1321: bbit1 t9, 26, 3f /* done if CvmCtl[NOCRYPTO] set */
133
134 /* Save the COP2 crypto state */
135 /* this part is mostly common to both pass 1 and later revisions */
136 dmfc2 t0, 0x0084
137 dmfc2 t1, 0x0080
138 dmfc2 t2, 0x0081
139 dmfc2 t3, 0x0082
140 sd t0, OCTEON_CP2_3DES_IV(a0)
141 dmfc2 t0, 0x0088
142 sd t1, OCTEON_CP2_3DES_KEY(a0)
143 dmfc2 t1, 0x0111 /* only necessary for pass 1 */
144 sd t2, OCTEON_CP2_3DES_KEY+8(a0)
145 dmfc2 t2, 0x0102
146 sd t3, OCTEON_CP2_3DES_KEY+16(a0)
147 dmfc2 t3, 0x0103
148 sd t0, OCTEON_CP2_3DES_RESULT(a0)
149 dmfc2 t0, 0x0104
150 sd t1, OCTEON_CP2_AES_INP0(a0) /* only necessary for pass 1 */
151 dmfc2 t1, 0x0105
152 sd t2, OCTEON_CP2_AES_IV(a0)
153 dmfc2 t2, 0x0106
154 sd t3, OCTEON_CP2_AES_IV+8(a0)
155 dmfc2 t3, 0x0107
156 sd t0, OCTEON_CP2_AES_KEY(a0)
157 dmfc2 t0, 0x0110
158 sd t1, OCTEON_CP2_AES_KEY+8(a0)
159 dmfc2 t1, 0x0100
160 sd t2, OCTEON_CP2_AES_KEY+16(a0)
161 dmfc2 t2, 0x0101
162 sd t3, OCTEON_CP2_AES_KEY+24(a0)
163 mfc0 t3, $15,0 /* Get the processor ID register */
164 sd t0, OCTEON_CP2_AES_KEYLEN(a0)
165 li t0, 0x000d0000 /* This is the processor ID of Octeon Pass1 */
166 sd t1, OCTEON_CP2_AES_RESULT(a0)
167 sd t2, OCTEON_CP2_AES_RESULT+8(a0)
168 /* Skip to the Pass1 version of the remainder of the COP2 state */
169 beq t3, t0, 2f
170
171 /* the non-pass1 state when !CvmCtl[NOCRYPTO] */
172 dmfc2 t1, 0x0240
173 dmfc2 t2, 0x0241
174 dmfc2 t3, 0x0242
175 dmfc2 t0, 0x0243
176 sd t1, OCTEON_CP2_HSH_DATW(a0)
177 dmfc2 t1, 0x0244
178 sd t2, OCTEON_CP2_HSH_DATW+8(a0)
179 dmfc2 t2, 0x0245
180 sd t3, OCTEON_CP2_HSH_DATW+16(a0)
181 dmfc2 t3, 0x0246
182 sd t0, OCTEON_CP2_HSH_DATW+24(a0)
183 dmfc2 t0, 0x0247
184 sd t1, OCTEON_CP2_HSH_DATW+32(a0)
185 dmfc2 t1, 0x0248
186 sd t2, OCTEON_CP2_HSH_DATW+40(a0)
187 dmfc2 t2, 0x0249
188 sd t3, OCTEON_CP2_HSH_DATW+48(a0)
189 dmfc2 t3, 0x024A
190 sd t0, OCTEON_CP2_HSH_DATW+56(a0)
191 dmfc2 t0, 0x024B
192 sd t1, OCTEON_CP2_HSH_DATW+64(a0)
193 dmfc2 t1, 0x024C
194 sd t2, OCTEON_CP2_HSH_DATW+72(a0)
195 dmfc2 t2, 0x024D
196 sd t3, OCTEON_CP2_HSH_DATW+80(a0)
197 dmfc2 t3, 0x024E
198 sd t0, OCTEON_CP2_HSH_DATW+88(a0)
199 dmfc2 t0, 0x0250
200 sd t1, OCTEON_CP2_HSH_DATW+96(a0)
201 dmfc2 t1, 0x0251
202 sd t2, OCTEON_CP2_HSH_DATW+104(a0)
203 dmfc2 t2, 0x0252
204 sd t3, OCTEON_CP2_HSH_DATW+112(a0)
205 dmfc2 t3, 0x0253
206 sd t0, OCTEON_CP2_HSH_IVW(a0)
207 dmfc2 t0, 0x0254
208 sd t1, OCTEON_CP2_HSH_IVW+8(a0)
209 dmfc2 t1, 0x0255
210 sd t2, OCTEON_CP2_HSH_IVW+16(a0)
211 dmfc2 t2, 0x0256
212 sd t3, OCTEON_CP2_HSH_IVW+24(a0)
213 dmfc2 t3, 0x0257
214 sd t0, OCTEON_CP2_HSH_IVW+32(a0)
215 dmfc2 t0, 0x0258
216 sd t1, OCTEON_CP2_HSH_IVW+40(a0)
217 dmfc2 t1, 0x0259
218 sd t2, OCTEON_CP2_HSH_IVW+48(a0)
219 dmfc2 t2, 0x025E
220 sd t3, OCTEON_CP2_HSH_IVW+56(a0)
221 dmfc2 t3, 0x025A
222 sd t0, OCTEON_CP2_GFM_MULT(a0)
223 dmfc2 t0, 0x025B
224 sd t1, OCTEON_CP2_GFM_MULT+8(a0)
225 sd t2, OCTEON_CP2_GFM_POLY(a0)
226 sd t3, OCTEON_CP2_GFM_RESULT(a0)
227 sd t0, OCTEON_CP2_GFM_RESULT+8(a0)
228 jr ra
229
2302: /* pass 1 special stuff when !CvmCtl[NOCRYPTO] */
231 dmfc2 t3, 0x0040
232 dmfc2 t0, 0x0041
233 dmfc2 t1, 0x0042
234 dmfc2 t2, 0x0043
235 sd t3, OCTEON_CP2_HSH_DATW(a0)
236 dmfc2 t3, 0x0044
237 sd t0, OCTEON_CP2_HSH_DATW+8(a0)
238 dmfc2 t0, 0x0045
239 sd t1, OCTEON_CP2_HSH_DATW+16(a0)
240 dmfc2 t1, 0x0046
241 sd t2, OCTEON_CP2_HSH_DATW+24(a0)
242 dmfc2 t2, 0x0048
243 sd t3, OCTEON_CP2_HSH_DATW+32(a0)
244 dmfc2 t3, 0x0049
245 sd t0, OCTEON_CP2_HSH_DATW+40(a0)
246 dmfc2 t0, 0x004A
247 sd t1, OCTEON_CP2_HSH_DATW+48(a0)
248 sd t2, OCTEON_CP2_HSH_IVW(a0)
249 sd t3, OCTEON_CP2_HSH_IVW+8(a0)
250 sd t0, OCTEON_CP2_HSH_IVW+16(a0)
251
2523: /* pass 1 or CvmCtl[NOCRYPTO] set */
253 jr ra
254 END(octeon_cop2_save)
255
256/*
257 * void octeon_cop2_restore(struct octeon_cop2_state *a0)
258 */
259 .align 7
260 .set push
261 .set noreorder
262 LEAF(octeon_cop2_restore)
263 /* First cache line was prefetched before the call */
264 pref 4, 128(a0)
265 dmfc0 t9, $9,7 /* CvmCtl register. */
266
267 pref 4, 256(a0)
268 ld t0, OCTEON_CP2_CRC_IV(a0)
269 pref 4, 384(a0)
270 ld t1, OCTEON_CP2_CRC_LENGTH(a0)
271 ld t2, OCTEON_CP2_CRC_POLY(a0)
272
273 /* Restore the COP2 CRC state */
274 dmtc2 t0, 0x0201
275 dmtc2 t1, 0x1202
276 bbit1 t9, 28, 2f /* Skip LLM if CvmCtl[NODFA_CP2] is set */
277 dmtc2 t2, 0x4200
278
279 /* Restore the LLM state */
280 ld t0, OCTEON_CP2_LLM_DAT(a0)
281 ld t1, OCTEON_CP2_LLM_DAT+8(a0)
282 dmtc2 t0, 0x0402
283 dmtc2 t1, 0x040A
284
2852:
286 bbit1 t9, 26, done_restore /* done if CvmCtl[NOCRYPTO] set */
287 nop
288
289 /* Restore the COP2 crypto state common to pass 1 and pass 2 */
290 ld t0, OCTEON_CP2_3DES_IV(a0)
291 ld t1, OCTEON_CP2_3DES_KEY(a0)
292 ld t2, OCTEON_CP2_3DES_KEY+8(a0)
293 dmtc2 t0, 0x0084
294 ld t0, OCTEON_CP2_3DES_KEY+16(a0)
295 dmtc2 t1, 0x0080
296 ld t1, OCTEON_CP2_3DES_RESULT(a0)
297 dmtc2 t2, 0x0081
298 ld t2, OCTEON_CP2_AES_INP0(a0) /* only really needed for pass 1 */
299 dmtc2 t0, 0x0082
300 ld t0, OCTEON_CP2_AES_IV(a0)
301 dmtc2 t1, 0x0098
302 ld t1, OCTEON_CP2_AES_IV+8(a0)
303 dmtc2 t2, 0x010A /* only really needed for pass 1 */
304 ld t2, OCTEON_CP2_AES_KEY(a0)
305 dmtc2 t0, 0x0102
306 ld t0, OCTEON_CP2_AES_KEY+8(a0)
307 dmtc2 t1, 0x0103
308 ld t1, OCTEON_CP2_AES_KEY+16(a0)
309 dmtc2 t2, 0x0104
310 ld t2, OCTEON_CP2_AES_KEY+24(a0)
311 dmtc2 t0, 0x0105
312 ld t0, OCTEON_CP2_AES_KEYLEN(a0)
313 dmtc2 t1, 0x0106
314 ld t1, OCTEON_CP2_AES_RESULT(a0)
315 dmtc2 t2, 0x0107
316 ld t2, OCTEON_CP2_AES_RESULT+8(a0)
317 mfc0 t3, $15,0 /* Get the processor ID register */
318 dmtc2 t0, 0x0110
319 li t0, 0x000d0000 /* This is the processor ID of Octeon Pass1 */
320 dmtc2 t1, 0x0100
321 bne t0, t3, 3f /* Skip the next stuff for non-pass1 */
322 dmtc2 t2, 0x0101
323
324 /* this code is specific for pass 1 */
325 ld t0, OCTEON_CP2_HSH_DATW(a0)
326 ld t1, OCTEON_CP2_HSH_DATW+8(a0)
327 ld t2, OCTEON_CP2_HSH_DATW+16(a0)
328 dmtc2 t0, 0x0040
329 ld t0, OCTEON_CP2_HSH_DATW+24(a0)
330 dmtc2 t1, 0x0041
331 ld t1, OCTEON_CP2_HSH_DATW+32(a0)
332 dmtc2 t2, 0x0042
333 ld t2, OCTEON_CP2_HSH_DATW+40(a0)
334 dmtc2 t0, 0x0043
335 ld t0, OCTEON_CP2_HSH_DATW+48(a0)
336 dmtc2 t1, 0x0044
337 ld t1, OCTEON_CP2_HSH_IVW(a0)
338 dmtc2 t2, 0x0045
339 ld t2, OCTEON_CP2_HSH_IVW+8(a0)
340 dmtc2 t0, 0x0046
341 ld t0, OCTEON_CP2_HSH_IVW+16(a0)
342 dmtc2 t1, 0x0048
343 dmtc2 t2, 0x0049
344 b done_restore /* unconditional branch */
345 dmtc2 t0, 0x004A
346
3473: /* this is post-pass1 code */
348 ld t2, OCTEON_CP2_HSH_DATW(a0)
349 ld t0, OCTEON_CP2_HSH_DATW+8(a0)
350 ld t1, OCTEON_CP2_HSH_DATW+16(a0)
351 dmtc2 t2, 0x0240
352 ld t2, OCTEON_CP2_HSH_DATW+24(a0)
353 dmtc2 t0, 0x0241
354 ld t0, OCTEON_CP2_HSH_DATW+32(a0)
355 dmtc2 t1, 0x0242
356 ld t1, OCTEON_CP2_HSH_DATW+40(a0)
357 dmtc2 t2, 0x0243
358 ld t2, OCTEON_CP2_HSH_DATW+48(a0)
359 dmtc2 t0, 0x0244
360 ld t0, OCTEON_CP2_HSH_DATW+56(a0)
361 dmtc2 t1, 0x0245
362 ld t1, OCTEON_CP2_HSH_DATW+64(a0)
363 dmtc2 t2, 0x0246
364 ld t2, OCTEON_CP2_HSH_DATW+72(a0)
365 dmtc2 t0, 0x0247
366 ld t0, OCTEON_CP2_HSH_DATW+80(a0)
367 dmtc2 t1, 0x0248
368 ld t1, OCTEON_CP2_HSH_DATW+88(a0)
369 dmtc2 t2, 0x0249
370 ld t2, OCTEON_CP2_HSH_DATW+96(a0)
371 dmtc2 t0, 0x024A
372 ld t0, OCTEON_CP2_HSH_DATW+104(a0)
373 dmtc2 t1, 0x024B
374 ld t1, OCTEON_CP2_HSH_DATW+112(a0)
375 dmtc2 t2, 0x024C
376 ld t2, OCTEON_CP2_HSH_IVW(a0)
377 dmtc2 t0, 0x024D
378 ld t0, OCTEON_CP2_HSH_IVW+8(a0)
379 dmtc2 t1, 0x024E
380 ld t1, OCTEON_CP2_HSH_IVW+16(a0)
381 dmtc2 t2, 0x0250
382 ld t2, OCTEON_CP2_HSH_IVW+24(a0)
383 dmtc2 t0, 0x0251
384 ld t0, OCTEON_CP2_HSH_IVW+32(a0)
385 dmtc2 t1, 0x0252
386 ld t1, OCTEON_CP2_HSH_IVW+40(a0)
387 dmtc2 t2, 0x0253
388 ld t2, OCTEON_CP2_HSH_IVW+48(a0)
389 dmtc2 t0, 0x0254
390 ld t0, OCTEON_CP2_HSH_IVW+56(a0)
391 dmtc2 t1, 0x0255
392 ld t1, OCTEON_CP2_GFM_MULT(a0)
393 dmtc2 t2, 0x0256
394 ld t2, OCTEON_CP2_GFM_MULT+8(a0)
395 dmtc2 t0, 0x0257
396 ld t0, OCTEON_CP2_GFM_POLY(a0)
397 dmtc2 t1, 0x0258
398 ld t1, OCTEON_CP2_GFM_RESULT(a0)
399 dmtc2 t2, 0x0259
400 ld t2, OCTEON_CP2_GFM_RESULT+8(a0)
401 dmtc2 t0, 0x025E
402 dmtc2 t1, 0x025A
403 dmtc2 t2, 0x025B
404
405done_restore:
406 jr ra
407 nop
408 END(octeon_cop2_restore)
409 .set pop
410
411/*
412 * void octeon_mult_save()
413 * sp is assumed to point to a struct pt_regs
414 *
415 * NOTE: This is called in SAVE_SOME in stackframe.h. It can only
416 * safely modify k0 and k1.
417 */
418 .align 7
419 .set push
420 .set noreorder
421 LEAF(octeon_mult_save)
422 dmfc0 k0, $9,7 /* CvmCtl register. */
423 bbit1 k0, 27, 1f /* Skip CvmCtl[NOMUL] */
424 nop
425
426 /* Save the multiplier state */
427 v3mulu k0, $0, $0
428 v3mulu k1, $0, $0
429 sd k0, PT_MTP(sp) /* PT_MTP has P0 */
430 v3mulu k0, $0, $0
431 sd k1, PT_MTP+8(sp) /* PT_MTP+8 has P1 */
432 ori k1, $0, 1
433 v3mulu k1, k1, $0
434 sd k0, PT_MTP+16(sp) /* PT_MTP+16 has P2 */
435 v3mulu k0, $0, $0
436 sd k1, PT_MPL(sp) /* PT_MPL has MPL0 */
437 v3mulu k1, $0, $0
438 sd k0, PT_MPL+8(sp) /* PT_MPL+8 has MPL1 */
439 jr ra
440 sd k1, PT_MPL+16(sp) /* PT_MPL+16 has MPL2 */
441
4421: /* Resume here if CvmCtl[NOMUL] */
443 jr ra
444 END(octeon_mult_save)
445 .set pop
446
447/*
448 * void octeon_mult_restore()
449 * sp is assumed to point to a struct pt_regs
450 *
451 * NOTE: This is called in RESTORE_SOME in stackframe.h.
452 */
453 .align 7
454 .set push
455 .set noreorder
456 LEAF(octeon_mult_restore)
457 dmfc0 k1, $9,7 /* CvmCtl register. */
458 ld v0, PT_MPL(sp) /* MPL0 */
459 ld v1, PT_MPL+8(sp) /* MPL1 */
460 ld k0, PT_MPL+16(sp) /* MPL2 */
461 bbit1 k1, 27, 1f /* Skip CvmCtl[NOMUL] */
462 /* Normally falls through, so no time wasted here */
463 nop
464
465 /* Restore the multiplier state */
466 ld k1, PT_MTP+16(sp) /* P2 */
467 MTM0 v0 /* MPL0 */
468 ld v0, PT_MTP+8(sp) /* P1 */
469 MTM1 v1 /* MPL1 */
470 ld v1, PT_MTP(sp) /* P0 */
471 MTM2 k0 /* MPL2 */
472 MTP2 k1 /* P2 */
473 MTP1 v0 /* P1 */
474 jr ra
475 MTP0 v1 /* P0 */
476
4771: /* Resume here if CvmCtl[NOMUL] */
478 jr ra
479 nop
480 END(octeon_mult_restore)
481 .set pop