10 #include <linux/kernel.h>
11 #include <linux/ptrace.h>
12 #include <linux/stddef.h>
15 #include <asm/compiler.h>
19 #include <asm/setup.h>
22 "reliable operation impossible!\n%s";
26 "Enable CPU_R4000_WORKAROUNDS to rectify.";
28 "Enable CPU_DADDI_WORKAROUNDS to rectify.";
30 static inline void align_mod(
const int align,
const int mod)
44 static inline void mult_sh_align_mod(
long *
v1,
long *
v2,
long *
w,
45 const int align,
const int mod)
49 long p,
s, lv1, lv2, lw;
72 :
"=r" (m1),
"=r" (m2),
"=r" (
s)
73 :
"0" (5),
"1" (8),
"2" (5));
74 align_mod(align, mod);
87 "dsll32 %0, %4, %5\n\t"
89 "dsll32 %1, %4, %5\n\t"
92 :
"=&r" (lv1),
"=r" (lw)
93 :
"r" (m1),
"r" (m2),
"r" (
s),
"I" (0)
103 :
"=r" (m1),
"=r" (m2),
"=r" (
s)
104 :
"0" (m1),
"1" (m2),
"2" (s));
105 align_mod(align, mod);
111 :
"0" (lv2),
"r" (
p));
119 static inline void check_mult_sh(
void)
121 long v1[8], v2[8], w[8];
124 printk(
"Checking for the multiply/shift bug... ");
135 mult_sh_align_mod(&v1[0], &v2[0], &w[0], 32, 0);
136 mult_sh_align_mod(&v1[1], &v2[1], &w[1], 32, 1);
137 mult_sh_align_mod(&v1[2], &v2[2], &w[2], 32, 2);
138 mult_sh_align_mod(&v1[3], &v2[3], &w[3], 32, 3);
139 mult_sh_align_mod(&v1[4], &v2[4], &w[4], 32, 4);
140 mult_sh_align_mod(&v1[5], &v2[5], &w[5], 32, 5);
141 mult_sh_align_mod(&v1[6], &v2[6], &w[6], 32, 6);
142 mult_sh_align_mod(&v1[7], &v2[7], &w[7], 32, 7);
145 for (i = 0; i < 8; i++)
154 printk(
"yes, workaround... ");
157 for (i = 0; i < 8; i++)
178 static inline void check_daddi(
void)
185 printk(
"Checking for the daddi bug... ");
203 "addiu %1, $0, %2\n\t"
205 #ifdef HAVE_AS_SET_DADDI
208 "daddi %0, %1, %3\n\t"
210 :
"=r" (
v),
"=&r" (tmp)
211 :
"I" (0xffffffffffffdb9a
UL),
"I" (0x1234));
220 printk(
"yes, workaround... ");
225 "addiu %1, $0, %2\n\t"
228 :
"=r" (
v),
"=&r" (tmp)
229 :
"I" (0xffffffffffffdb9a
UL),
"I" (0x1234));
244 static inline void check_daddiu(
void)
248 printk(
"Checking for the daddiu bug... ");
271 "addiu %2, $0, %3\n\t"
273 #ifdef HAVE_AS_SET_DADDI
276 "daddiu %0, %2, %4\n\t"
277 "addiu %1, $0, %4\n\t"
280 :
"=&r" (
v),
"=&r" (w),
"=&r" (
tmp)
281 :
"I" (0xffffffffffffdb9aUL),
"I" (0x1234));
290 printk(
"yes, workaround... ");
293 "addiu %2, $0, %3\n\t"
295 "daddiu %0, %2, %4\n\t"
296 "addiu %1, $0, %4\n\t"
298 :
"=&r" (
v),
"=&r" (w),
"=&r" (
tmp)
299 :
"I" (0xffffffffffffdb9aUL),
"I" (0x1234));