5
5
*
6
6
* Copyright (C) 1998, 1999, 2000 by Ralf Baechle
7
7
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8
- * Copyright (C) 2007 Maciej W. Rozycki
8
+ * Copyright (C) 2007 by Maciej W. Rozycki
9
+ * Copyright (C) 2011, 2012 MIPS Technologies, Inc.
9
10
*/
10
11
#include <asm/asm.h>
11
12
#include <asm/asm-offsets.h>
19
20
#define LONG_S_R sdr
20
21
#endif
21
22
23
+ #ifdef CONFIG_CPU_MICROMIPS
24
+ #define STORSIZE (LONGSIZE * 2 )
25
+ #define STORMASK (STORSIZE - 1 )
26
+ #define FILL64RG t8
27
+ #define FILLPTRG t7
28
+ #undef LONG_S
29
+ #define LONG_S LONG_SP
30
+ #else
31
+ #define STORSIZE LONGSIZE
32
+ #define STORMASK LONGMASK
33
+ #define FILL64RG a1
34
+ #define FILLPTRG t0
35
+ #endif
36
+
22
37
#define EX(insn,reg,addr,handler) \
23
38
9: insn reg, addr; \
24
39
.section __ex_table,"a" ; \
25
40
PTR 9b, handler; \
26
41
.previous
27
42
28
43
.macro f_fill64 dst, offset, val, fixup
29
- EX(LONG_S, \val, (\offset + 0 * LONGSIZE)(\dst), \fixup)
30
- EX(LONG_S, \val, (\offset + 1 * LONGSIZE)(\dst), \fixup)
31
- EX(LONG_S, \val, (\offset + 2 * LONGSIZE)(\dst), \fixup)
32
- EX(LONG_S, \val, (\offset + 3 * LONGSIZE)(\dst), \fixup)
33
- EX(LONG_S, \val, (\offset + 4 * LONGSIZE)(\dst), \fixup)
34
- EX(LONG_S, \val, (\offset + 5 * LONGSIZE)(\dst), \fixup)
35
- EX(LONG_S, \val, (\offset + 6 * LONGSIZE)(\dst), \fixup)
36
- EX(LONG_S, \val, (\offset + 7 * LONGSIZE)(\dst), \fixup)
37
- #if LONGSIZE == 4
38
- EX(LONG_S, \val, (\offset + 8 * LONGSIZE)(\dst), \fixup)
39
- EX(LONG_S, \val, (\offset + 9 * LONGSIZE)(\dst), \fixup)
40
- EX(LONG_S, \val, (\offset + 10 * LONGSIZE)(\dst), \fixup)
41
- EX(LONG_S, \val, (\offset + 11 * LONGSIZE)(\dst), \fixup)
42
- EX(LONG_S, \val, (\offset + 12 * LONGSIZE)(\dst), \fixup)
43
- EX(LONG_S, \val, (\offset + 13 * LONGSIZE)(\dst), \fixup)
44
- EX(LONG_S, \val, (\offset + 14 * LONGSIZE)(\dst), \fixup)
45
- EX(LONG_S, \val, (\offset + 15 * LONGSIZE)(\dst), \fixup)
44
+ EX(LONG_S, \val, (\offset + 0 * STORSIZE)(\dst), \fixup)
45
+ EX(LONG_S, \val, (\offset + 1 * STORSIZE)(\dst), \fixup)
46
+ EX(LONG_S, \val, (\offset + 2 * STORSIZE)(\dst), \fixup)
47
+ EX(LONG_S, \val, (\offset + 3 * STORSIZE)(\dst), \fixup)
48
+ #if ((defined(CONFIG_CPU_MICROMIPS) && (LONGSIZE == 4 )) || !defined(CONFIG_CPU_MICROMIPS))
49
+ EX(LONG_S, \val, (\offset + 4 * STORSIZE)(\dst), \fixup)
50
+ EX(LONG_S, \val, (\offset + 5 * STORSIZE)(\dst), \fixup)
51
+ EX(LONG_S, \val, (\offset + 6 * STORSIZE)(\dst), \fixup)
52
+ EX(LONG_S, \val, (\offset + 7 * STORSIZE)(\dst), \fixup)
53
+ #endif
54
+ #if (!defined(CONFIG_CPU_MICROMIPS) && (LONGSIZE == 4 ))
55
+ EX(LONG_S, \val, (\offset + 8 * STORSIZE)(\dst), \fixup)
56
+ EX(LONG_S, \val, (\offset + 9 * STORSIZE)(\dst), \fixup)
57
+ EX(LONG_S, \val, (\offset + 10 * STORSIZE)(\dst), \fixup)
58
+ EX(LONG_S, \val, (\offset + 11 * STORSIZE)(\dst), \fixup)
59
+ EX(LONG_S, \val, (\offset + 12 * STORSIZE)(\dst), \fixup)
60
+ EX(LONG_S, \val, (\offset + 13 * STORSIZE)(\dst), \fixup)
61
+ EX(LONG_S, \val, (\offset + 14 * STORSIZE)(\dst), \fixup)
62
+ EX(LONG_S, \val, (\offset + 15 * STORSIZE)(\dst), \fixup)
46
63
#endif
47
64
.endm
48
65
@@ -71,16 +88,20 @@ LEAF(memset)
71
88
1:
72
89
73
90
FEXPORT(__bzero)
74
- sltiu t0, a2, LONGSIZE /* very small region? */
91
+ sltiu t0, a2, STORSIZE /* very small region? */
75
92
bnez t0, .Lsmall_memset
76
- andi t0, a0, LONGMASK /* aligned? */
93
+ andi t0, a0, STORMASK /* aligned? */
77
94
95
+ #ifdef CONFIG_CPU_MICROMIPS
96
+ move t8, a1 /* used by 'swp' instruction */
97
+ move t9, a1
98
+ #endif
78
99
#ifndef CONFIG_CPU_DADDI_WORKAROUNDS
79
100
beqz t0, 1f
80
- PTR_SUBU t0, LONGSIZE /* alignment in bytes */
101
+ PTR_SUBU t0, STORSIZE /* alignment in bytes */
81
102
#else
82
103
.set noat
83
- li AT, LONGSIZE
104
+ li AT, STORSIZE
84
105
beqz t0, 1f
85
106
PTR_SUBU t0, AT /* alignment in bytes */
86
107
.set at
@@ -99,24 +120,27 @@ FEXPORT(__bzero)
99
120
1: ori t1, a2, 0x3f /* # of full blocks */
100
121
xori t1, 0x3f
101
122
beqz t1, .Lmemset_partial /* no block to fill */
102
- andi t0, a2, 0x40 -LONGSIZE
123
+ andi t0, a2, 0x40 -STORSIZE
103
124
104
125
PTR_ADDU t1, a0 /* end address */
105
126
.set reorder
106
127
1: PTR_ADDIU a0, 64
107
128
R10KCBARRIER(0 (ra))
108
- f_fill64 a0, -64 , a1 , .Lfwd_fixup
129
+ f_fill64 a0, -64 , FILL64RG , .Lfwd_fixup
109
130
bne t1, a0, 1b
110
131
.set noreorder
111
132
112
133
.Lmemset_partial:
113
134
R10KCBARRIER(0 (ra))
114
135
PTR_LA t1, 2f /* where to start */
136
+ #ifdef CONFIG_CPU_MICROMIPS
137
+ LONG_SRL t7, t0, 1
138
+ #endif
115
139
#if LONGSIZE == 4
116
- PTR_SUBU t1, t0
140
+ PTR_SUBU t1, FILLPTRG
117
141
#else
118
142
.set noat
119
- LONG_SRL AT, t0 , 1
143
+ LONG_SRL AT, FILLPTRG , 1
120
144
PTR_SUBU t1, AT
121
145
.set at
122
146
#endif
@@ -126,9 +150,9 @@ FEXPORT(__bzero)
126
150
.set push
127
151
.set noreorder
128
152
.set nomacro
129
- f_fill64 a0, -64 , a1 , .Lpartial_fixup /* ... but first do longs ... */
153
+ f_fill64 a0, -64 , FILL64RG , .Lpartial_fixup /* ... but first do longs ... */
130
154
2: .set pop
131
- andi a2, LONGMASK /* At most one long to go */
155
+ andi a2, STORMASK /* At most one long to go */
132
156
133
157
beqz a2, 1f
134
158
PTR_ADDU a0, a2 /* What's left */
@@ -169,12 +193,12 @@ FEXPORT(__bzero)
169
193
170
194
.Lpartial_fixup:
171
195
PTR_L t0, TI_TASK($28 )
172
- andi a2, LONGMASK
196
+ andi a2, STORMASK
173
197
LONG_L t0, THREAD_BUADDR(t0)
174
198
LONG_ADDU a2, t1
175
199
jr ra
176
200
LONG_SUBU a2, t0
177
201
178
202
.Llast_fixup:
179
203
jr ra
180
- andi v1, a2, LONGMASK
204
+ andi v1, a2, STORMASK
0 commit comments