.. | .. |
---|
10 | 10 | #include <asm/processor.h> |
---|
11 | 11 | #include <asm/switch_to.h> |
---|
12 | 12 | #include <linux/uaccess.h> |
---|
| 13 | +#include <asm/inst.h> |
---|
13 | 14 | |
---|
14 | 15 | /* Functions in vector.S */ |
---|
15 | 16 | extern void vaddfp(vector128 *dst, vector128 *a, vector128 *b); |
---|
.. | .. |
---|
260 | 261 | |
---|
261 | 262 | int emulate_altivec(struct pt_regs *regs) |
---|
262 | 263 | { |
---|
263 | | - unsigned int instr, i; |
---|
| 264 | + struct ppc_inst instr; |
---|
| 265 | + unsigned int i, word; |
---|
264 | 266 | unsigned int va, vb, vc, vd; |
---|
265 | 267 | vector128 *vrs; |
---|
266 | 268 | |
---|
267 | | - if (get_user(instr, (unsigned int __user *) regs->nip)) |
---|
| 269 | + if (get_user_instr(instr, (void __user *)regs->nip)) |
---|
268 | 270 | return -EFAULT; |
---|
269 | | - if ((instr >> 26) != 4) |
---|
| 271 | + |
---|
| 272 | + word = ppc_inst_val(instr); |
---|
| 273 | + if (ppc_inst_primary_opcode(instr) != 4) |
---|
270 | 274 | 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; |
---|
275 | 279 | |
---|
276 | 280 | vrs = current->thread.vr_state.vr; |
---|
277 | | - switch (instr & 0x3f) { |
---|
| 281 | + switch (word & 0x3f) { |
---|
278 | 282 | case 10: |
---|
279 | 283 | switch (vc) { |
---|
280 | 284 | case 0: /* vaddfp */ |
---|