hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/powerpc/kernel/vecemu.c
....@@ -10,6 +10,7 @@
1010 #include <asm/processor.h>
1111 #include <asm/switch_to.h>
1212 #include <linux/uaccess.h>
13
+#include <asm/inst.h>
1314
1415 /* Functions in vector.S */
1516 extern void vaddfp(vector128 *dst, vector128 *a, vector128 *b);
....@@ -260,21 +261,24 @@
260261
261262 int emulate_altivec(struct pt_regs *regs)
262263 {
263
- unsigned int instr, i;
264
+ struct ppc_inst instr;
265
+ unsigned int i, word;
264266 unsigned int va, vb, vc, vd;
265267 vector128 *vrs;
266268
267
- if (get_user(instr, (unsigned int __user *) regs->nip))
269
+ if (get_user_instr(instr, (void __user *)regs->nip))
268270 return -EFAULT;
269
- if ((instr >> 26) != 4)
271
+
272
+ word = ppc_inst_val(instr);
273
+ if (ppc_inst_primary_opcode(instr) != 4)
270274 return -EINVAL; /* not an altivec instruction */
271
- vd = (instr >> 21) & 0x1f;
272
- va = (instr >> 16) & 0x1f;
273
- vb = (instr >> 11) & 0x1f;
274
- vc = (instr >> 6) & 0x1f;
275
+ vd = (word >> 21) & 0x1f;
276
+ va = (word >> 16) & 0x1f;
277
+ vb = (word >> 11) & 0x1f;
278
+ vc = (word >> 6) & 0x1f;
275279
276280 vrs = current->thread.vr_state.vr;
277
- switch (instr & 0x3f) {
281
+ switch (word & 0x3f) {
278282 case 10:
279283 switch (vc) {
280284 case 0: /* vaddfp */