blob: cdac7b3eeaf7fa6524b8f6ffb92edc7209eef4c5 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * asmmacro.h: Assembler macros to make things easier to read.
3 *
Justin P. Mattock79add622011-04-04 14:15:29 -07004 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 * Copyright (C) 1998, 1999, 2003 Ralf Baechle
6 */
7#ifndef _ASM_ASMMACRO_32_H
8#define _ASM_ASMMACRO_32_H
9
Sam Ravnborg048eb582005-09-09 22:32:31 +020010#include <asm/asm-offsets.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <asm/regdef.h>
12#include <asm/fpregdef.h>
13#include <asm/mipsregs.h>
14
Linus Torvalds1da177e2005-04-16 15:20:36 -070015 .macro fpu_save_single thread tmp=t0
Manuel Lauss842dfc12014-11-07 14:13:54 +010016 .set push
17 SET_HARDFLOAT
Linus Torvalds1da177e2005-04-16 15:20:36 -070018 cfc1 \tmp, fcr31
Paul Burton02987632014-01-27 15:23:08 +000019 swc1 $f0, THREAD_FPR0_LS64(\thread)
20 swc1 $f1, THREAD_FPR1_LS64(\thread)
21 swc1 $f2, THREAD_FPR2_LS64(\thread)
22 swc1 $f3, THREAD_FPR3_LS64(\thread)
23 swc1 $f4, THREAD_FPR4_LS64(\thread)
24 swc1 $f5, THREAD_FPR5_LS64(\thread)
25 swc1 $f6, THREAD_FPR6_LS64(\thread)
26 swc1 $f7, THREAD_FPR7_LS64(\thread)
27 swc1 $f8, THREAD_FPR8_LS64(\thread)
28 swc1 $f9, THREAD_FPR9_LS64(\thread)
29 swc1 $f10, THREAD_FPR10_LS64(\thread)
30 swc1 $f11, THREAD_FPR11_LS64(\thread)
31 swc1 $f12, THREAD_FPR12_LS64(\thread)
32 swc1 $f13, THREAD_FPR13_LS64(\thread)
33 swc1 $f14, THREAD_FPR14_LS64(\thread)
34 swc1 $f15, THREAD_FPR15_LS64(\thread)
35 swc1 $f16, THREAD_FPR16_LS64(\thread)
36 swc1 $f17, THREAD_FPR17_LS64(\thread)
37 swc1 $f18, THREAD_FPR18_LS64(\thread)
38 swc1 $f19, THREAD_FPR19_LS64(\thread)
39 swc1 $f20, THREAD_FPR20_LS64(\thread)
40 swc1 $f21, THREAD_FPR21_LS64(\thread)
41 swc1 $f22, THREAD_FPR22_LS64(\thread)
42 swc1 $f23, THREAD_FPR23_LS64(\thread)
43 swc1 $f24, THREAD_FPR24_LS64(\thread)
44 swc1 $f25, THREAD_FPR25_LS64(\thread)
45 swc1 $f26, THREAD_FPR26_LS64(\thread)
46 swc1 $f27, THREAD_FPR27_LS64(\thread)
47 swc1 $f28, THREAD_FPR28_LS64(\thread)
48 swc1 $f29, THREAD_FPR29_LS64(\thread)
49 swc1 $f30, THREAD_FPR30_LS64(\thread)
50 swc1 $f31, THREAD_FPR31_LS64(\thread)
Linus Torvalds1da177e2005-04-16 15:20:36 -070051 sw \tmp, THREAD_FCR31(\thread)
Manuel Lauss842dfc12014-11-07 14:13:54 +010052 .set pop
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 .endm
54
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 .macro fpu_restore_single thread tmp=t0
Manuel Lauss842dfc12014-11-07 14:13:54 +010056 .set push
57 SET_HARDFLOAT
Linus Torvalds1da177e2005-04-16 15:20:36 -070058 lw \tmp, THREAD_FCR31(\thread)
Paul Burton02987632014-01-27 15:23:08 +000059 lwc1 $f0, THREAD_FPR0_LS64(\thread)
60 lwc1 $f1, THREAD_FPR1_LS64(\thread)
61 lwc1 $f2, THREAD_FPR2_LS64(\thread)
62 lwc1 $f3, THREAD_FPR3_LS64(\thread)
63 lwc1 $f4, THREAD_FPR4_LS64(\thread)
64 lwc1 $f5, THREAD_FPR5_LS64(\thread)
65 lwc1 $f6, THREAD_FPR6_LS64(\thread)
66 lwc1 $f7, THREAD_FPR7_LS64(\thread)
67 lwc1 $f8, THREAD_FPR8_LS64(\thread)
68 lwc1 $f9, THREAD_FPR9_LS64(\thread)
69 lwc1 $f10, THREAD_FPR10_LS64(\thread)
70 lwc1 $f11, THREAD_FPR11_LS64(\thread)
71 lwc1 $f12, THREAD_FPR12_LS64(\thread)
72 lwc1 $f13, THREAD_FPR13_LS64(\thread)
73 lwc1 $f14, THREAD_FPR14_LS64(\thread)
74 lwc1 $f15, THREAD_FPR15_LS64(\thread)
75 lwc1 $f16, THREAD_FPR16_LS64(\thread)
76 lwc1 $f17, THREAD_FPR17_LS64(\thread)
77 lwc1 $f18, THREAD_FPR18_LS64(\thread)
78 lwc1 $f19, THREAD_FPR19_LS64(\thread)
79 lwc1 $f20, THREAD_FPR20_LS64(\thread)
80 lwc1 $f21, THREAD_FPR21_LS64(\thread)
81 lwc1 $f22, THREAD_FPR22_LS64(\thread)
82 lwc1 $f23, THREAD_FPR23_LS64(\thread)
83 lwc1 $f24, THREAD_FPR24_LS64(\thread)
84 lwc1 $f25, THREAD_FPR25_LS64(\thread)
85 lwc1 $f26, THREAD_FPR26_LS64(\thread)
86 lwc1 $f27, THREAD_FPR27_LS64(\thread)
87 lwc1 $f28, THREAD_FPR28_LS64(\thread)
88 lwc1 $f29, THREAD_FPR29_LS64(\thread)
89 lwc1 $f30, THREAD_FPR30_LS64(\thread)
90 lwc1 $f31, THREAD_FPR31_LS64(\thread)
Linus Torvalds1da177e2005-04-16 15:20:36 -070091 ctc1 \tmp, fcr31
Manuel Lauss842dfc12014-11-07 14:13:54 +010092 .set pop
Linus Torvalds1da177e2005-04-16 15:20:36 -070093 .endm
94
95 .macro cpu_save_nonscratch thread
96 LONG_S s0, THREAD_REG16(\thread)
97 LONG_S s1, THREAD_REG17(\thread)
98 LONG_S s2, THREAD_REG18(\thread)
99 LONG_S s3, THREAD_REG19(\thread)
100 LONG_S s4, THREAD_REG20(\thread)
101 LONG_S s5, THREAD_REG21(\thread)
102 LONG_S s6, THREAD_REG22(\thread)
103 LONG_S s7, THREAD_REG23(\thread)
104 LONG_S sp, THREAD_REG29(\thread)
105 LONG_S fp, THREAD_REG30(\thread)
106 .endm
107
108 .macro cpu_restore_nonscratch thread
109 LONG_L s0, THREAD_REG16(\thread)
110 LONG_L s1, THREAD_REG17(\thread)
111 LONG_L s2, THREAD_REG18(\thread)
112 LONG_L s3, THREAD_REG19(\thread)
113 LONG_L s4, THREAD_REG20(\thread)
114 LONG_L s5, THREAD_REG21(\thread)
115 LONG_L s6, THREAD_REG22(\thread)
116 LONG_L s7, THREAD_REG23(\thread)
117 LONG_L sp, THREAD_REG29(\thread)
118 LONG_L fp, THREAD_REG30(\thread)
119 LONG_L ra, THREAD_REG31(\thread)
120 .endm
121
122#endif /* _ASM_ASMMACRO_32_H */