Lines Matching refs:op
85 struct instruction_op *op) in branch_taken() argument
92 op->type |= DECCTR; in branch_taken()
575 static int do_fp_load(struct instruction_op *op, unsigned long ea, in do_fp_load() argument
588 nb = GETSIZE(op->type); in do_fp_load()
593 rn = op->reg; in do_fp_load()
604 if (op->type & FPCONV) in do_fp_load()
606 else if (op->type & SIGNEXT) in do_fp_load()
628 static int do_fp_store(struct instruction_op *op, unsigned long ea, in do_fp_store() argument
640 nb = GETSIZE(op->type); in do_fp_store()
645 rn = op->reg; in do_fp_store()
652 if (op->type & FPCONV) in do_fp_store()
783 static nokprobe_inline void emulate_vsx_load(struct instruction_op *op, union vsx_reg *reg, in emulate_vsx_load() argument
792 size = GETSIZE(op->type); in emulate_vsx_load()
795 switch (op->element_size) { in emulate_vsx_load()
803 if (IS_LE && (op->vsx_flags & VSX_LDLEFT)) in emulate_vsx_load()
816 if (op->type & SIGNEXT) { in emulate_vsx_load()
819 } else if (op->vsx_flags & VSX_FPCONV) { in emulate_vsx_load()
829 } else if (op->vsx_flags & VSX_SPLAT) in emulate_vsx_load()
840 if (op->vsx_flags & VSX_SPLAT) { in emulate_vsx_load()
867 static nokprobe_inline void emulate_vsx_store(struct instruction_op *op, const union vsx_reg *reg, in emulate_vsx_store() argument
877 size = GETSIZE(op->type); in emulate_vsx_store()
879 switch (op->element_size) { in emulate_vsx_store()
900 if (IS_LE && (op->vsx_flags & VSX_LDLEFT)) in emulate_vsx_store()
914 if (size < 8 && op->vsx_flags & VSX_FPCONV) { in emulate_vsx_store()
957 static nokprobe_inline int do_vsx_load(struct instruction_op *op, in do_vsx_load() argument
961 int reg = op->reg; in do_vsx_load()
965 int size = GETSIZE(op->type); in do_vsx_load()
971 emulate_vsx_load(op, buf, mem, cross_endian); in do_vsx_load()
1004 static nokprobe_inline int do_vsx_store(struct instruction_op *op, in do_vsx_store() argument
1008 int reg = op->reg; in do_vsx_store()
1012 int size = GETSIZE(op->type); in do_vsx_store()
1047 emulate_vsx_store(op, buf, mem, cross_endian); in do_vsx_store()
1093 #define __put_user_asmx(x, addr, err, op, cr) \ argument
1097 "1: " op " %2,0,%3\n" \
1109 #define __get_user_asmx(x, addr, err, op) \ argument
1113 "1: "op" %1,0,%2\n" \
1124 #define __cacheop_user_asmx(addr, err, op) \ argument
1126 "1: "op" 0,%1\n" \
1137 struct instruction_op *op) in set_cr0() argument
1139 long val = op->val; in set_cr0()
1141 op->type |= SETCC; in set_cr0()
1142 op->ccval = (regs->ccr & 0x0fffffff) | ((regs->xer >> 3) & 0x10000000); in set_cr0()
1146 op->ccval |= 0x80000000; in set_cr0()
1148 op->ccval |= 0x40000000; in set_cr0()
1150 op->ccval |= 0x20000000; in set_cr0()
1153 static nokprobe_inline void set_ca32(struct instruction_op *op, bool val) in set_ca32() argument
1157 op->xerval |= XER_CA32; in set_ca32()
1159 op->xerval &= ~XER_CA32; in set_ca32()
1164 struct instruction_op *op, int rd, in add_with_carry() argument
1172 op->type = COMPUTE | SETREG | SETXER; in add_with_carry()
1173 op->reg = rd; in add_with_carry()
1174 op->val = val; in add_with_carry()
1177 op->xerval = regs->xer; in add_with_carry()
1179 op->xerval |= XER_CA; in add_with_carry()
1181 op->xerval &= ~XER_CA; in add_with_carry()
1183 set_ca32(op, (unsigned int)val < (unsigned int)val1 || in add_with_carry()
1188 struct instruction_op *op, in do_cmp_signed() argument
1193 op->type = COMPUTE | SETCC; in do_cmp_signed()
1202 op->ccval = (regs->ccr & ~(0xf << shift)) | (crval << shift); in do_cmp_signed()
1206 struct instruction_op *op, in do_cmp_unsigned() argument
1212 op->type = COMPUTE | SETCC; in do_cmp_unsigned()
1221 op->ccval = (regs->ccr & ~(0xf << shift)) | (crval << shift); in do_cmp_unsigned()
1225 struct instruction_op *op, in do_cmpb() argument
1237 op->val = out_val; in do_cmpb()
1245 struct instruction_op *op, in do_popcnt() argument
1256 op->val = out; in do_popcnt()
1262 op->val = out & 0x0000003f0000003fULL; in do_popcnt()
1267 op->val = out; /* popcntd */ in do_popcnt()
1272 struct instruction_op *op, in do_bpermd() argument
1285 op->val = perm; in do_bpermd()
1293 struct instruction_op *op, in do_prty() argument
1300 op->val = res & 0x0000000100000001ULL; in do_prty()
1305 op->val = res & 1; /*prtyd */ in do_prty()
1351 int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, in analyse_instr() argument
1367 op->type = COMPUTE; in analyse_instr()
1372 op->type = BRANCH; in analyse_instr()
1376 op->val = truncate_if_32bit(regs->msr, imm); in analyse_instr()
1378 op->type |= SETLK; in analyse_instr()
1379 if (branch_taken(word, regs, op)) in analyse_instr()
1380 op->type |= BRTAKEN; in analyse_instr()
1384 op->type = SYSCALL; in analyse_instr()
1387 op->type = SYSCALL_VECTORED_0; in analyse_instr()
1391 op->type = UNKNOWN; in analyse_instr()
1394 op->type = BRANCH | BRTAKEN; in analyse_instr()
1400 op->val = truncate_if_32bit(regs->msr, imm); in analyse_instr()
1402 op->type |= SETLK; in analyse_instr()
1407 op->type = COMPUTE + SETCC; in analyse_instr()
1413 op->ccval = (regs->ccr & ~(0xfUL << rd)) | (val << rd); in analyse_instr()
1418 op->type = BRANCH; in analyse_instr()
1420 op->val = truncate_if_32bit(regs->msr, imm); in analyse_instr()
1422 op->type |= SETLK; in analyse_instr()
1423 if (branch_taken(word, regs, op)) in analyse_instr()
1424 op->type |= BRTAKEN; in analyse_instr()
1430 op->type = RFI; in analyse_instr()
1434 op->type = BARRIER | BARRIER_ISYNC; in analyse_instr()
1445 op->type = COMPUTE + SETCC; in analyse_instr()
1452 op->ccval = (regs->ccr & ~(1UL << (31 - rd))) | in analyse_instr()
1460 op->type = BARRIER + BARRIER_SYNC; in analyse_instr()
1464 op->type = BARRIER + BARRIER_LWSYNC; in analyse_instr()
1467 op->type = BARRIER + BARRIER_PTESYNC; in analyse_instr()
1474 op->type = BARRIER + BARRIER_EIEIO; in analyse_instr()
1494 op->reg = rd; in analyse_instr()
1495 op->val = regs->gpr[rd]; in analyse_instr()
1504 op->type = COMPUTE | PREFIXED; in analyse_instr()
1505 op->val = mlsd_8lsd_ea(word, suffix, regs); in analyse_instr()
1533 "=r" (op->val) : "r" (regs->gpr[ra]), in analyse_instr()
1539 "=r" (op->val) : "r" (regs->gpr[ra]), in analyse_instr()
1545 "=r" (op->val) : "r" (regs->gpr[ra]), in analyse_instr()
1558 op->val = regs->gpr[ra] * (short) word; in analyse_instr()
1563 add_with_carry(regs, op, rd, ~regs->gpr[ra], imm, 1); in analyse_instr()
1573 do_cmp_unsigned(regs, op, val, imm, rd >> 2); in analyse_instr()
1583 do_cmp_signed(regs, op, val, imm, rd >> 2); in analyse_instr()
1588 add_with_carry(regs, op, rd, regs->gpr[ra], imm, 0); in analyse_instr()
1593 add_with_carry(regs, op, rd, regs->gpr[ra], imm, 0); in analyse_instr()
1594 set_cr0(regs, op); in analyse_instr()
1601 op->val = imm; in analyse_instr()
1608 op->val = imm; in analyse_instr()
1618 op->val = regs->nip + (imm << 16) + 4; in analyse_instr()
1621 op->type = UNKNOWN; in analyse_instr()
1629 op->val = (regs->gpr[ra] & ~imm) | (ROTATE(val, rb) & imm); in analyse_instr()
1636 op->val = ROTATE(val, rb) & MASK32(mb, me); in analyse_instr()
1644 op->val = ROTATE(val, rb) & MASK32(mb, me); in analyse_instr()
1648 op->val = regs->gpr[rd] | (unsigned short) word; in analyse_instr()
1653 op->val = regs->gpr[rd] | (imm << 16); in analyse_instr()
1657 op->val = regs->gpr[rd] ^ (unsigned short) word; in analyse_instr()
1662 op->val = regs->gpr[rd] ^ (imm << 16); in analyse_instr()
1666 op->val = regs->gpr[rd] & (unsigned short) word; in analyse_instr()
1667 set_cr0(regs, op); in analyse_instr()
1672 op->val = regs->gpr[rd] & (imm << 16); in analyse_instr()
1673 set_cr0(regs, op); in analyse_instr()
1698 op->val = val; in analyse_instr()
1705 op->val = val & MASK64_L(mb); in analyse_instr()
1708 op->val = val & MASK64_R(mb); in analyse_instr()
1713 op->type = UNKNOWN; /* illegal instruction */ in analyse_instr()
1723 op->val = (val) ? val2 : regs->gpr[rb]; in analyse_instr()
1743 op->type = MFMSR; in analyse_instr()
1744 op->reg = rd; in analyse_instr()
1749 op->type = MTMSR; in analyse_instr()
1750 op->reg = rd; in analyse_instr()
1751 op->val = 0xffffffff & ~(MSR_ME | MSR_LE); in analyse_instr()
1757 op->type = MTMSR; in analyse_instr()
1758 op->reg = rd; in analyse_instr()
1762 op->val = imm; in analyse_instr()
1776 op->val = regs->ccr & imm; in analyse_instr()
1793 op->val = -1; in analyse_instr()
1796 op->val = 1; in analyse_instr()
1798 op->val = 0; in analyse_instr()
1802 op->type = COMPUTE + SETCC; in analyse_instr()
1805 op->ccval = regs->ccr; in analyse_instr()
1808 op->ccval = (op->ccval & ~imm) | in analyse_instr()
1816 op->type = MFSPR; in analyse_instr()
1817 op->reg = rd; in analyse_instr()
1818 op->spr = spr; in analyse_instr()
1826 op->type = MTSPR; in analyse_instr()
1827 op->val = regs->gpr[rd]; in analyse_instr()
1828 op->spr = spr; in analyse_instr()
1847 do_cmp_signed(regs, op, val, val2, rd >> 2); in analyse_instr()
1860 do_cmp_unsigned(regs, op, val, val2, rd >> 2); in analyse_instr()
1864 do_cmpb(regs, op, regs->gpr[rd], regs->gpr[rb]); in analyse_instr()
1871 add_with_carry(regs, op, rd, ~regs->gpr[ra], in analyse_instr()
1876 asm("mulhdu %0,%1,%2" : "=r" (op->val) : in analyse_instr()
1881 add_with_carry(regs, op, rd, regs->gpr[ra], in analyse_instr()
1886 asm("mulhwu %0,%1,%2" : "=r" (op->val) : in analyse_instr()
1891 op->val = regs->gpr[rb] - regs->gpr[ra]; in analyse_instr()
1895 asm("mulhd %0,%1,%2" : "=r" (op->val) : in analyse_instr()
1900 asm("mulhw %0,%1,%2" : "=r" (op->val) : in analyse_instr()
1905 op->val = -regs->gpr[ra]; in analyse_instr()
1909 add_with_carry(regs, op, rd, ~regs->gpr[ra], in analyse_instr()
1914 add_with_carry(regs, op, rd, regs->gpr[ra], in analyse_instr()
1919 add_with_carry(regs, op, rd, ~regs->gpr[ra], 0L, in analyse_instr()
1924 add_with_carry(regs, op, rd, regs->gpr[ra], 0L, in analyse_instr()
1929 add_with_carry(regs, op, rd, ~regs->gpr[ra], -1L, in analyse_instr()
1934 op->val = regs->gpr[ra] * regs->gpr[rb]; in analyse_instr()
1938 add_with_carry(regs, op, rd, regs->gpr[ra], -1L, in analyse_instr()
1943 op->val = (long)(int) regs->gpr[ra] * in analyse_instr()
1951 op->val = regs->gpr[ra] % regs->gpr[rb]; in analyse_instr()
1955 op->val = regs->gpr[ra] + regs->gpr[rb]; in analyse_instr()
1961 op->val = (unsigned int) regs->gpr[ra] % in analyse_instr()
1966 op->val = regs->gpr[ra] / regs->gpr[rb]; in analyse_instr()
1970 op->val = (unsigned int) regs->gpr[ra] / in analyse_instr()
1975 op->val = (long int) regs->gpr[ra] / in analyse_instr()
1980 op->val = (int) regs->gpr[ra] / in analyse_instr()
1986 "=r" (op->val) : "r" (regs->gpr[ra]), in analyse_instr()
1991 "=r" (op->val) : "r" (regs->gpr[ra]), in analyse_instr()
2001 asm volatile(PPC_DARN(%0, 0) : "=r" (op->val)); in analyse_instr()
2006 asm volatile(PPC_DARN(%0, 1) : "=r" (op->val)); in analyse_instr()
2011 asm volatile(PPC_DARN(%0, 2) : "=r" (op->val)); in analyse_instr()
2020 op->val = (long int) regs->gpr[ra] % in analyse_instr()
2027 op->val = (int) regs->gpr[ra] % in analyse_instr()
2037 op->val = ( val ? __builtin_clz(val) : 32 ); in analyse_instr()
2042 op->val = ( val ? __builtin_clzl(val) : 64 ); in analyse_instr()
2046 op->val = regs->gpr[rd] & regs->gpr[rb]; in analyse_instr()
2050 op->val = regs->gpr[rd] & ~regs->gpr[rb]; in analyse_instr()
2054 do_popcnt(regs, op, regs->gpr[rd], 8); in analyse_instr()
2058 op->val = ~(regs->gpr[rd] | regs->gpr[rb]); in analyse_instr()
2062 do_prty(regs, op, regs->gpr[rd], 32); in analyse_instr()
2066 do_prty(regs, op, regs->gpr[rd], 64); in analyse_instr()
2070 do_bpermd(regs, op, regs->gpr[rd], regs->gpr[rb]); in analyse_instr()
2074 op->val = ~(regs->gpr[rd] ^ regs->gpr[rb]); in analyse_instr()
2078 op->val = regs->gpr[rd] ^ regs->gpr[rb]; in analyse_instr()
2082 do_popcnt(regs, op, regs->gpr[rd], 32); in analyse_instr()
2086 op->val = regs->gpr[rd] | ~regs->gpr[rb]; in analyse_instr()
2090 op->val = regs->gpr[rd] | regs->gpr[rb]; in analyse_instr()
2094 op->val = ~(regs->gpr[rd] & regs->gpr[rb]); in analyse_instr()
2098 do_popcnt(regs, op, regs->gpr[rd], 64); in analyse_instr()
2105 op->val = (val ? __builtin_ctz(val) : 32); in analyse_instr()
2112 op->val = (val ? __builtin_ctzl(val) : 64); in analyse_instr()
2116 op->val = (signed short) regs->gpr[rd]; in analyse_instr()
2120 op->val = (signed char) regs->gpr[rd]; in analyse_instr()
2124 op->val = (signed int) regs->gpr[rd]; in analyse_instr()
2134 op->val = (regs->gpr[rd] << sh) & 0xffffffffUL; in analyse_instr()
2136 op->val = 0; in analyse_instr()
2142 op->val = (regs->gpr[rd] & 0xffffffffUL) >> sh; in analyse_instr()
2144 op->val = 0; in analyse_instr()
2148 op->type = COMPUTE + SETREG + SETXER; in analyse_instr()
2151 op->val = ival >> (sh < 32 ? sh : 31); in analyse_instr()
2152 op->xerval = regs->xer; in analyse_instr()
2154 op->xerval |= XER_CA; in analyse_instr()
2156 op->xerval &= ~XER_CA; in analyse_instr()
2157 set_ca32(op, op->xerval & XER_CA); in analyse_instr()
2161 op->type = COMPUTE + SETREG + SETXER; in analyse_instr()
2164 op->val = ival >> sh; in analyse_instr()
2165 op->xerval = regs->xer; in analyse_instr()
2167 op->xerval |= XER_CA; in analyse_instr()
2169 op->xerval &= ~XER_CA; in analyse_instr()
2170 set_ca32(op, op->xerval & XER_CA); in analyse_instr()
2177 op->val = regs->gpr[rd] << sh; in analyse_instr()
2179 op->val = 0; in analyse_instr()
2185 op->val = regs->gpr[rd] >> sh; in analyse_instr()
2187 op->val = 0; in analyse_instr()
2191 op->type = COMPUTE + SETREG + SETXER; in analyse_instr()
2194 op->val = ival >> (sh < 64 ? sh : 63); in analyse_instr()
2195 op->xerval = regs->xer; in analyse_instr()
2197 op->xerval |= XER_CA; in analyse_instr()
2199 op->xerval &= ~XER_CA; in analyse_instr()
2200 set_ca32(op, op->xerval & XER_CA); in analyse_instr()
2205 op->type = COMPUTE + SETREG + SETXER; in analyse_instr()
2208 op->val = ival >> sh; in analyse_instr()
2209 op->xerval = regs->xer; in analyse_instr()
2211 op->xerval |= XER_CA; in analyse_instr()
2213 op->xerval &= ~XER_CA; in analyse_instr()
2214 set_ca32(op, op->xerval & XER_CA); in analyse_instr()
2221 op->type = COMPUTE + SETREG; in analyse_instr()
2225 op->val = ROTATE(val, sh) & MASK64(0, 63 - sh); in analyse_instr()
2227 op->val = val; in analyse_instr()
2236 op->type = MKOP(CACHEOP, DCBST, 0); in analyse_instr()
2237 op->ea = xform_ea(word, regs); in analyse_instr()
2241 op->type = MKOP(CACHEOP, DCBF, 0); in analyse_instr()
2242 op->ea = xform_ea(word, regs); in analyse_instr()
2246 op->type = MKOP(CACHEOP, DCBTST, 0); in analyse_instr()
2247 op->ea = xform_ea(word, regs); in analyse_instr()
2248 op->reg = rd; in analyse_instr()
2252 op->type = MKOP(CACHEOP, DCBTST, 0); in analyse_instr()
2253 op->ea = xform_ea(word, regs); in analyse_instr()
2254 op->reg = rd; in analyse_instr()
2258 op->type = MKOP(CACHEOP, ICBI, 0); in analyse_instr()
2259 op->ea = xform_ea(word, regs); in analyse_instr()
2263 op->type = MKOP(CACHEOP, DCBZ, 0); in analyse_instr()
2264 op->ea = xform_ea(word, regs); in analyse_instr()
2273 op->type = UNKNOWN; in analyse_instr()
2274 op->update_reg = ra; in analyse_instr()
2275 op->reg = rd; in analyse_instr()
2276 op->val = regs->gpr[rd]; in analyse_instr()
2278 op->vsx_flags = 0; in analyse_instr()
2283 op->ea = xform_ea(word, regs); in analyse_instr()
2286 op->type = MKOP(LARX, 0, 4); in analyse_instr()
2290 op->type = MKOP(STCX, 0, 4); in analyse_instr()
2295 op->type = MKOP(LARX, 0, 1); in analyse_instr()
2299 op->type = MKOP(STCX, 0, 1); in analyse_instr()
2303 op->type = MKOP(LARX, 0, 2); in analyse_instr()
2307 op->type = MKOP(STCX, 0, 2); in analyse_instr()
2312 op->type = MKOP(LARX, 0, 8); in analyse_instr()
2316 op->type = MKOP(STCX, 0, 8); in analyse_instr()
2321 op->type = MKOP(LARX, 0, 16); in analyse_instr()
2326 op->type = MKOP(STCX, 0, 16); in analyse_instr()
2332 op->type = MKOP(LOAD, u, 4); in analyse_instr()
2337 op->type = MKOP(LOAD, u, 1); in analyse_instr()
2346 op->type = MKOP(LOAD_VMX, 0, 1); in analyse_instr()
2347 op->element_size = 1; in analyse_instr()
2351 op->type = MKOP(LOAD_VMX, 0, 2); in analyse_instr()
2352 op->element_size = 2; in analyse_instr()
2356 op->type = MKOP(LOAD_VMX, 0, 4); in analyse_instr()
2357 op->element_size = 4; in analyse_instr()
2362 op->type = MKOP(LOAD_VMX, 0, 16); in analyse_instr()
2363 op->element_size = 16; in analyse_instr()
2367 op->type = MKOP(STORE_VMX, 0, 1); in analyse_instr()
2368 op->element_size = 1; in analyse_instr()
2372 op->type = MKOP(STORE_VMX, 0, 2); in analyse_instr()
2373 op->element_size = 2; in analyse_instr()
2377 op->type = MKOP(STORE_VMX, 0, 4); in analyse_instr()
2378 op->element_size = 4; in analyse_instr()
2383 op->type = MKOP(STORE_VMX, 0, 16); in analyse_instr()
2390 op->type = MKOP(LOAD, u, 8); in analyse_instr()
2395 op->type = MKOP(STORE, u, 8); in analyse_instr()
2401 op->type = MKOP(STORE, u, 4); in analyse_instr()
2406 op->type = MKOP(STORE, u, 1); in analyse_instr()
2411 op->type = MKOP(LOAD, u, 2); in analyse_instr()
2417 op->type = MKOP(LOAD, SIGNEXT | u, 4); in analyse_instr()
2423 op->type = MKOP(LOAD, SIGNEXT | u, 2); in analyse_instr()
2428 op->type = MKOP(STORE, u, 2); in analyse_instr()
2433 op->type = MKOP(LOAD, BYTEREV, 8); in analyse_instr()
2438 op->type = MKOP(LOAD_MULTI, 0, regs->xer & 0x7f); in analyse_instr()
2442 op->type = MKOP(LOAD, BYTEREV, 4); in analyse_instr()
2448 op->type = MKOP(LOAD_MULTI, 0, rb); in analyse_instr()
2449 op->ea = ra ? regs->gpr[ra] : 0; in analyse_instr()
2455 op->type = MKOP(LOAD_FP, u | FPCONV, 4); in analyse_instr()
2460 op->type = MKOP(LOAD_FP, u, 8); in analyse_instr()
2465 op->type = MKOP(STORE_FP, u | FPCONV, 4); in analyse_instr()
2470 op->type = MKOP(STORE_FP, u, 8); in analyse_instr()
2475 op->type = MKOP(LOAD_FP, 0, 16); in analyse_instr()
2479 op->type = MKOP(LOAD_FP, SIGNEXT, 4); in analyse_instr()
2483 op->type = MKOP(LOAD_FP, 0, 4); in analyse_instr()
2487 op->type = MKOP(STORE_FP, 0, 16); in analyse_instr()
2491 op->type = MKOP(STORE_FP, 0, 4); in analyse_instr()
2498 op->type = MKOP(STORE, BYTEREV, 8); in analyse_instr()
2499 op->val = byterev_8(regs->gpr[rd]); in analyse_instr()
2504 op->type = MKOP(STORE_MULTI, 0, regs->xer & 0x7f); in analyse_instr()
2508 op->type = MKOP(STORE, BYTEREV, 4); in analyse_instr()
2509 op->val = byterev_4(regs->gpr[rd]); in analyse_instr()
2515 op->type = MKOP(STORE_MULTI, 0, rb); in analyse_instr()
2516 op->ea = ra ? regs->gpr[ra] : 0; in analyse_instr()
2520 op->type = MKOP(LOAD, BYTEREV, 2); in analyse_instr()
2524 op->type = MKOP(STORE, BYTEREV, 2); in analyse_instr()
2525 op->val = byterev_2(regs->gpr[rd]); in analyse_instr()
2530 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2531 op->type = MKOP(LOAD_VSX, 0, 4); in analyse_instr()
2532 op->element_size = 8; in analyse_instr()
2536 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2537 op->type = MKOP(LOAD_VSX, SIGNEXT, 4); in analyse_instr()
2538 op->element_size = 8; in analyse_instr()
2542 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2543 op->type = MKOP(STORE_VSX, 0, 4); in analyse_instr()
2544 op->element_size = 8; in analyse_instr()
2550 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2551 op->type = MKOP(LOAD_VSX, 0, 16); in analyse_instr()
2552 op->element_size = 16; in analyse_instr()
2553 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2561 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2562 op->ea = ra ? regs->gpr[ra] : 0; in analyse_instr()
2566 op->type = MKOP(LOAD_VSX, 0, nb); in analyse_instr()
2567 op->element_size = 16; in analyse_instr()
2568 op->vsx_flags = ((word & 0x20) ? VSX_LDLEFT : 0) | in analyse_instr()
2573 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2574 op->type = MKOP(LOAD_VSX, 0, 8); in analyse_instr()
2575 op->element_size = 8; in analyse_instr()
2576 op->vsx_flags = VSX_SPLAT; in analyse_instr()
2582 op->reg = VSX_REGISTER_XTP(rd); in analyse_instr()
2583 op->type = MKOP(LOAD_VSX, 0, 32); in analyse_instr()
2584 op->element_size = 32; in analyse_instr()
2590 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2591 op->type = MKOP(LOAD_VSX, 0, 4); in analyse_instr()
2592 op->element_size = 4; in analyse_instr()
2593 op->vsx_flags = VSX_SPLAT | VSX_CHECK_VEC; in analyse_instr()
2599 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2600 op->type = MKOP(STORE_VSX, 0, 16); in analyse_instr()
2601 op->element_size = 16; in analyse_instr()
2602 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2610 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2611 op->ea = ra ? regs->gpr[ra] : 0; in analyse_instr()
2615 op->type = MKOP(STORE_VSX, 0, nb); in analyse_instr()
2616 op->element_size = 16; in analyse_instr()
2617 op->vsx_flags = ((word & 0x20) ? VSX_LDLEFT : 0) | in analyse_instr()
2624 op->reg = VSX_REGISTER_XTP(rd); in analyse_instr()
2625 op->type = MKOP(STORE_VSX, 0, 32); in analyse_instr()
2626 op->element_size = 32; in analyse_instr()
2629 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2630 op->type = MKOP(LOAD_VSX, 0, 4); in analyse_instr()
2631 op->element_size = 8; in analyse_instr()
2632 op->vsx_flags = VSX_FPCONV; in analyse_instr()
2636 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2637 op->type = MKOP(LOAD_VSX, 0, 8); in analyse_instr()
2638 op->element_size = 8; in analyse_instr()
2642 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2643 op->type = MKOP(STORE_VSX, 0, 4); in analyse_instr()
2644 op->element_size = 8; in analyse_instr()
2645 op->vsx_flags = VSX_FPCONV; in analyse_instr()
2649 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2650 op->type = MKOP(STORE_VSX, 0, 8); in analyse_instr()
2651 op->element_size = 8; in analyse_instr()
2655 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2656 op->type = MKOP(LOAD_VSX, 0, 16); in analyse_instr()
2657 op->element_size = 4; in analyse_instr()
2663 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2664 op->type = MKOP(LOAD_VSX, 0, 1); in analyse_instr()
2665 op->element_size = 8; in analyse_instr()
2666 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2672 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2673 op->type = MKOP(LOAD_VSX, 0, 16); in analyse_instr()
2674 op->element_size = 2; in analyse_instr()
2675 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2681 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2682 op->type = MKOP(LOAD_VSX, 0, 2); in analyse_instr()
2683 op->element_size = 8; in analyse_instr()
2684 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2688 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2689 op->type = MKOP(LOAD_VSX, 0, 16); in analyse_instr()
2690 op->element_size = 8; in analyse_instr()
2696 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2697 op->type = MKOP(LOAD_VSX, 0, 16); in analyse_instr()
2698 op->element_size = 1; in analyse_instr()
2699 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2703 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2704 op->type = MKOP(STORE_VSX, 0, 16); in analyse_instr()
2705 op->element_size = 4; in analyse_instr()
2711 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2712 op->type = MKOP(STORE_VSX, 0, 1); in analyse_instr()
2713 op->element_size = 8; in analyse_instr()
2714 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2720 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2721 op->type = MKOP(STORE_VSX, 0, 16); in analyse_instr()
2722 op->element_size = 2; in analyse_instr()
2723 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2729 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2730 op->type = MKOP(STORE_VSX, 0, 2); in analyse_instr()
2731 op->element_size = 8; in analyse_instr()
2732 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2736 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2737 op->type = MKOP(STORE_VSX, 0, 16); in analyse_instr()
2738 op->element_size = 8; in analyse_instr()
2744 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2745 op->type = MKOP(STORE_VSX, 0, 16); in analyse_instr()
2746 op->element_size = 1; in analyse_instr()
2747 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2756 op->type = MKOP(LOAD, u, 4); in analyse_instr()
2757 op->ea = dform_ea(word, regs); in analyse_instr()
2762 op->type = MKOP(LOAD, u, 1); in analyse_instr()
2763 op->ea = dform_ea(word, regs); in analyse_instr()
2768 op->type = MKOP(STORE, u, 4); in analyse_instr()
2769 op->ea = dform_ea(word, regs); in analyse_instr()
2774 op->type = MKOP(STORE, u, 1); in analyse_instr()
2775 op->ea = dform_ea(word, regs); in analyse_instr()
2780 op->type = MKOP(LOAD, u, 2); in analyse_instr()
2781 op->ea = dform_ea(word, regs); in analyse_instr()
2786 op->type = MKOP(LOAD, SIGNEXT | u, 2); in analyse_instr()
2787 op->ea = dform_ea(word, regs); in analyse_instr()
2792 op->type = MKOP(STORE, u, 2); in analyse_instr()
2793 op->ea = dform_ea(word, regs); in analyse_instr()
2799 op->type = MKOP(LOAD_MULTI, 0, 4 * (32 - rd)); in analyse_instr()
2800 op->ea = dform_ea(word, regs); in analyse_instr()
2804 op->type = MKOP(STORE_MULTI, 0, 4 * (32 - rd)); in analyse_instr()
2805 op->ea = dform_ea(word, regs); in analyse_instr()
2811 op->type = MKOP(LOAD_FP, u | FPCONV, 4); in analyse_instr()
2812 op->ea = dform_ea(word, regs); in analyse_instr()
2817 op->type = MKOP(LOAD_FP, u, 8); in analyse_instr()
2818 op->ea = dform_ea(word, regs); in analyse_instr()
2823 op->type = MKOP(STORE_FP, u | FPCONV, 4); in analyse_instr()
2824 op->ea = dform_ea(word, regs); in analyse_instr()
2829 op->type = MKOP(STORE_FP, u, 8); in analyse_instr()
2830 op->ea = dform_ea(word, regs); in analyse_instr()
2837 op->type = MKOP(LOAD, 0, 16); in analyse_instr()
2838 op->ea = dqform_ea(word, regs); in analyse_instr()
2844 op->ea = dsform_ea(word, regs); in analyse_instr()
2849 op->type = MKOP(LOAD_FP, 0, 16); in analyse_instr()
2854 op->reg = rd + 32; in analyse_instr()
2855 op->type = MKOP(LOAD_VSX, 0, 8); in analyse_instr()
2856 op->element_size = 8; in analyse_instr()
2857 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2862 op->reg = rd + 32; in analyse_instr()
2863 op->type = MKOP(LOAD_VSX, 0, 4); in analyse_instr()
2864 op->element_size = 8; in analyse_instr()
2865 op->vsx_flags = VSX_FPCONV | VSX_CHECK_VEC; in analyse_instr()
2873 op->ea = dsform_ea(word, regs); in analyse_instr()
2876 op->type = MKOP(LOAD, 0, 8); in analyse_instr()
2879 op->type = MKOP(LOAD, UPDATE, 8); in analyse_instr()
2882 op->type = MKOP(LOAD, SIGNEXT, 4); in analyse_instr()
2892 op->ea = dqform_ea(word, regs); in analyse_instr()
2893 op->reg = VSX_REGISTER_XTP(rd); in analyse_instr()
2894 op->element_size = 32; in analyse_instr()
2897 op->type = MKOP(LOAD_VSX, 0, 32); in analyse_instr()
2900 op->type = MKOP(STORE_VSX, 0, 32); in analyse_instr()
2909 op->ea = dsform_ea(word, regs); in analyse_instr()
2910 op->type = MKOP(STORE_FP, 0, 16); in analyse_instr()
2916 op->ea = dqform_ea(word, regs); in analyse_instr()
2918 op->reg = rd + 32; in analyse_instr()
2919 op->type = MKOP(LOAD_VSX, 0, 16); in analyse_instr()
2920 op->element_size = 16; in analyse_instr()
2921 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2928 op->ea = dsform_ea(word, regs); in analyse_instr()
2929 op->reg = rd + 32; in analyse_instr()
2930 op->type = MKOP(STORE_VSX, 0, 8); in analyse_instr()
2931 op->element_size = 8; in analyse_instr()
2932 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2939 op->ea = dsform_ea(word, regs); in analyse_instr()
2940 op->reg = rd + 32; in analyse_instr()
2941 op->type = MKOP(STORE_VSX, 0, 4); in analyse_instr()
2942 op->element_size = 8; in analyse_instr()
2943 op->vsx_flags = VSX_FPCONV | VSX_CHECK_VEC; in analyse_instr()
2949 op->ea = dqform_ea(word, regs); in analyse_instr()
2951 op->reg = rd + 32; in analyse_instr()
2952 op->type = MKOP(STORE_VSX, 0, 16); in analyse_instr()
2953 op->element_size = 16; in analyse_instr()
2954 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2962 op->ea = dsform_ea(word, regs); in analyse_instr()
2965 op->type = MKOP(STORE, 0, 8); in analyse_instr()
2968 op->type = MKOP(STORE, UPDATE, 8); in analyse_instr()
2972 op->type = MKOP(STORE, 0, 16); in analyse_instr()
2982 op->update_reg = ra; in analyse_instr()
2984 op->reg = rd; in analyse_instr()
2985 op->val = regs->gpr[rd]; in analyse_instr()
2993 op->ea = mlsd_8lsd_ea(word, suffix, regs); in analyse_instr()
2996 op->type = MKOP(LOAD, PREFIXED | SIGNEXT, 4); in analyse_instr()
3000 op->reg = rd + 32; in analyse_instr()
3001 op->type = MKOP(LOAD_VSX, PREFIXED, 8); in analyse_instr()
3002 op->element_size = 8; in analyse_instr()
3003 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
3006 op->reg = rd + 32; in analyse_instr()
3007 op->type = MKOP(LOAD_VSX, PREFIXED, 4); in analyse_instr()
3008 op->element_size = 8; in analyse_instr()
3009 op->vsx_flags = VSX_FPCONV | VSX_CHECK_VEC; in analyse_instr()
3012 op->reg = rd + 32; in analyse_instr()
3013 op->type = MKOP(STORE_VSX, PREFIXED, 8); in analyse_instr()
3014 op->element_size = 8; in analyse_instr()
3015 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
3018 op->reg = rd + 32; in analyse_instr()
3019 op->type = MKOP(STORE_VSX, PREFIXED, 4); in analyse_instr()
3020 op->element_size = 8; in analyse_instr()
3021 op->vsx_flags = VSX_FPCONV | VSX_CHECK_VEC; in analyse_instr()
3024 op->reg += 32; in analyse_instr()
3027 op->type = MKOP(LOAD_VSX, PREFIXED, 16); in analyse_instr()
3028 op->element_size = 16; in analyse_instr()
3029 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
3032 op->reg = rd + 32; in analyse_instr()
3035 op->type = MKOP(STORE_VSX, PREFIXED, 16); in analyse_instr()
3036 op->element_size = 16; in analyse_instr()
3037 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
3041 op->type = MKOP(LOAD, PREFIXED, 16); in analyse_instr()
3044 op->type = MKOP(LOAD, PREFIXED, 8); in analyse_instr()
3048 op->reg = VSX_REGISTER_XTP(rd); in analyse_instr()
3049 op->type = MKOP(LOAD_VSX, PREFIXED, 32); in analyse_instr()
3050 op->element_size = 32; in analyse_instr()
3054 op->type = MKOP(STORE, PREFIXED, 16); in analyse_instr()
3057 op->type = MKOP(STORE, PREFIXED, 8); in analyse_instr()
3061 op->reg = VSX_REGISTER_XTP(rd); in analyse_instr()
3062 op->type = MKOP(STORE_VSX, PREFIXED, 32); in analyse_instr()
3063 op->element_size = 32; in analyse_instr()
3073 op->ea = mlsd_8lsd_ea(word, suffix, regs); in analyse_instr()
3076 op->type = MKOP(LOAD, PREFIXED, 4); in analyse_instr()
3079 op->type = MKOP(LOAD, PREFIXED, 1); in analyse_instr()
3082 op->type = MKOP(STORE, PREFIXED, 4); in analyse_instr()
3085 op->type = MKOP(STORE, PREFIXED, 1); in analyse_instr()
3088 op->type = MKOP(LOAD, PREFIXED, 2); in analyse_instr()
3091 op->type = MKOP(LOAD, PREFIXED | SIGNEXT, 2); in analyse_instr()
3094 op->type = MKOP(STORE, PREFIXED, 2); in analyse_instr()
3097 op->type = MKOP(LOAD_FP, PREFIXED | FPCONV, 4); in analyse_instr()
3100 op->type = MKOP(LOAD_FP, PREFIXED, 8); in analyse_instr()
3103 op->type = MKOP(STORE_FP, PREFIXED | FPCONV, 4); in analyse_instr()
3106 op->type = MKOP(STORE_FP, PREFIXED, 8); in analyse_instr()
3117 if (OP_IS_LOAD_STORE(op->type) && (op->type & UPDATE)) { in analyse_instr()
3118 switch (GETTYPE(op->type)) { in analyse_instr()
3132 if ((GETTYPE(op->type) == LOAD_VSX || in analyse_instr()
3133 GETTYPE(op->type) == STORE_VSX) && in analyse_instr()
3142 op->type = UNKNOWN; in analyse_instr()
3147 set_cr0(regs, op); in analyse_instr()
3149 op->reg = ra; in analyse_instr()
3150 op->type |= SETREG; in analyse_instr()
3155 set_cr0(regs, op); in analyse_instr()
3157 op->reg = rd; in analyse_instr()
3158 op->type |= SETREG; in analyse_instr()
3162 op->type = INTERRUPT | 0x700; in analyse_instr()
3163 op->val = SRR1_PROGPRIV; in analyse_instr()
3167 op->type = INTERRUPT | 0x700; in analyse_instr()
3168 op->val = SRR1_PROGTRAP; in analyse_instr()
3226 void emulate_update_regs(struct pt_regs *regs, struct instruction_op *op) in emulate_update_regs() argument
3230 next_pc = truncate_if_32bit(regs->msr, regs->nip + GETLENGTH(op->type)); in emulate_update_regs()
3231 switch (GETTYPE(op->type)) { in emulate_update_regs()
3233 if (op->type & SETREG) in emulate_update_regs()
3234 regs->gpr[op->reg] = op->val; in emulate_update_regs()
3235 if (op->type & SETCC) in emulate_update_regs()
3236 regs->ccr = op->ccval; in emulate_update_regs()
3237 if (op->type & SETXER) in emulate_update_regs()
3238 regs->xer = op->xerval; in emulate_update_regs()
3242 if (op->type & SETLK) in emulate_update_regs()
3244 if (op->type & BRTAKEN) in emulate_update_regs()
3245 next_pc = op->val; in emulate_update_regs()
3246 if (op->type & DECCTR) in emulate_update_regs()
3251 switch (op->type & BARRIER_MASK) { in emulate_update_regs()
3273 switch (op->spr) { in emulate_update_regs()
3275 regs->gpr[op->reg] = regs->xer & 0xffffffffUL; in emulate_update_regs()
3278 regs->gpr[op->reg] = regs->link; in emulate_update_regs()
3281 regs->gpr[op->reg] = regs->ctr; in emulate_update_regs()
3289 switch (op->spr) { in emulate_update_regs()
3291 regs->xer = op->val & 0xffffffffUL; in emulate_update_regs()
3294 regs->link = op->val; in emulate_update_regs()
3297 regs->ctr = op->val; in emulate_update_regs()
3320 int emulate_loadstore(struct pt_regs *regs, struct instruction_op *op) in emulate_loadstore() argument
3330 size = GETSIZE(op->type); in emulate_loadstore()
3331 type = GETTYPE(op->type); in emulate_loadstore()
3333 ea = truncate_if_32bit(regs->msr, op->ea); in emulate_loadstore()
3360 err = do_lqarx(ea, ®s->gpr[op->reg]); in emulate_loadstore()
3371 regs->gpr[op->reg] = val; in emulate_loadstore()
3383 __put_user_asmx(op->val, ea, err, "stbcx.", cr); in emulate_loadstore()
3386 __put_user_asmx(op->val, ea, err, "sthcx.", cr); in emulate_loadstore()
3390 __put_user_asmx(op->val, ea, err, "stwcx.", cr); in emulate_loadstore()
3394 __put_user_asmx(op->val, ea, err, "stdcx.", cr); in emulate_loadstore()
3397 err = do_stqcx(ea, regs->gpr[op->reg], in emulate_loadstore()
3398 regs->gpr[op->reg + 1], &cr); in emulate_loadstore()
3415 err = emulate_lq(regs, ea, op->reg, cross_endian); in emulate_loadstore()
3419 err = read_mem(®s->gpr[op->reg], ea, size, regs); in emulate_loadstore()
3421 if (op->type & SIGNEXT) in emulate_loadstore()
3422 do_signext(®s->gpr[op->reg], size); in emulate_loadstore()
3423 if ((op->type & BYTEREV) == (cross_endian ? 0 : BYTEREV)) in emulate_loadstore()
3424 do_byterev(®s->gpr[op->reg], size); in emulate_loadstore()
3438 err = do_fp_load(op, ea, regs, cross_endian); in emulate_loadstore()
3445 err = do_vec_load(op->reg, ea, size, regs, cross_endian); in emulate_loadstore()
3456 if (op->reg >= 32 && (op->vsx_flags & VSX_CHECK_VEC)) in emulate_loadstore()
3460 err = do_vsx_load(op, ea, regs, cross_endian); in emulate_loadstore()
3467 rd = op->reg; in emulate_loadstore()
3489 err = emulate_stq(regs, ea, op->reg, cross_endian); in emulate_loadstore()
3493 if ((op->type & UPDATE) && size == sizeof(long) && in emulate_loadstore()
3494 op->reg == 1 && op->update_reg == 1 && in emulate_loadstore()
3501 do_byterev(&op->val, size); in emulate_loadstore()
3502 err = write_mem(op->val, ea, size, regs); in emulate_loadstore()
3509 err = do_fp_store(op, ea, regs, cross_endian); in emulate_loadstore()
3516 err = do_vec_store(op->reg, ea, size, regs, cross_endian); in emulate_loadstore()
3527 if (op->reg >= 32 && (op->vsx_flags & VSX_CHECK_VEC)) in emulate_loadstore()
3531 err = do_vsx_store(op, ea, regs, cross_endian); in emulate_loadstore()
3538 rd = op->reg; in emulate_loadstore()
3563 if (op->type & UPDATE) in emulate_loadstore()
3564 regs->gpr[op->update_reg] = op->ea; in emulate_loadstore()
3579 struct instruction_op op; in emulate_step() local
3584 r = analyse_instr(&op, regs, instr); in emulate_step()
3588 emulate_update_regs(regs, &op); in emulate_step()
3593 type = GETTYPE(op.type); in emulate_step()
3596 err = emulate_loadstore(regs, &op); in emulate_step()
3604 ea = truncate_if_32bit(regs->msr, op.ea); in emulate_step()
3607 switch (op.type & CACHEOP_MASK) { in emulate_step()
3615 if (op.reg == 0) in emulate_step()
3619 if (op.reg == 0) in emulate_step()
3636 regs->gpr[op.reg] = regs->msr & MSR_MASK; in emulate_step()
3640 val = regs->gpr[op.reg]; in emulate_step()
3645 regs_set_return_msr(regs, (regs->msr & ~op.val) | (val & op.val)); in emulate_step()
3669 truncate_if_32bit(regs->msr, regs->nip + GETLENGTH(op.type))); in emulate_step()