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()
591 rn = op->reg; in do_fp_load()
602 if (op->type & FPCONV) in do_fp_load()
604 else if (op->type & SIGNEXT) in do_fp_load()
626 static int do_fp_store(struct instruction_op *op, unsigned long ea, in do_fp_store() argument
638 nb = GETSIZE(op->type); in do_fp_store()
641 rn = op->reg; in do_fp_store()
648 if (op->type & FPCONV) in do_fp_store()
773 void emulate_vsx_load(struct instruction_op *op, union vsx_reg *reg, in emulate_vsx_load() argument
782 size = GETSIZE(op->type); in emulate_vsx_load()
785 switch (op->element_size) { in emulate_vsx_load()
793 if (IS_LE && (op->vsx_flags & VSX_LDLEFT)) in emulate_vsx_load()
806 if (op->type & SIGNEXT) { in emulate_vsx_load()
809 } else if (op->vsx_flags & VSX_FPCONV) { in emulate_vsx_load()
819 } else if (op->vsx_flags & VSX_SPLAT) in emulate_vsx_load()
830 if (op->vsx_flags & VSX_SPLAT) { in emulate_vsx_load()
859 void emulate_vsx_store(struct instruction_op *op, const union vsx_reg *reg, in emulate_vsx_store() argument
869 size = GETSIZE(op->type); in emulate_vsx_store()
871 switch (op->element_size) { in emulate_vsx_store()
892 if (IS_LE && (op->vsx_flags & VSX_LDLEFT)) in emulate_vsx_store()
906 if (size < 8 && op->vsx_flags & VSX_FPCONV) { in emulate_vsx_store()
951 static nokprobe_inline int do_vsx_load(struct instruction_op *op, in do_vsx_load() argument
955 int reg = op->reg; in do_vsx_load()
959 int size = GETSIZE(op->type); in do_vsx_load()
965 emulate_vsx_load(op, buf, mem, cross_endian); in do_vsx_load()
998 static nokprobe_inline int do_vsx_store(struct instruction_op *op, in do_vsx_store() argument
1002 int reg = op->reg; in do_vsx_store()
1006 int size = GETSIZE(op->type); in do_vsx_store()
1041 emulate_vsx_store(op, buf, mem, cross_endian); in do_vsx_store()
1087 #define __put_user_asmx(x, addr, err, op, cr) \ argument
1091 "1: " op " %2,0,%3\n" \
1103 #define __get_user_asmx(x, addr, err, op) \ argument
1107 "1: "op" %1,0,%2\n" \
1118 #define __cacheop_user_asmx(addr, err, op) \ argument
1120 "1: "op" 0,%1\n" \
1131 struct instruction_op *op) in set_cr0() argument
1133 long val = op->val; in set_cr0()
1135 op->type |= SETCC; in set_cr0()
1136 op->ccval = (regs->ccr & 0x0fffffff) | ((regs->xer >> 3) & 0x10000000); in set_cr0()
1140 op->ccval |= 0x80000000; in set_cr0()
1142 op->ccval |= 0x40000000; in set_cr0()
1144 op->ccval |= 0x20000000; in set_cr0()
1147 static nokprobe_inline void set_ca32(struct instruction_op *op, bool val) in set_ca32() argument
1151 op->xerval |= XER_CA32; in set_ca32()
1153 op->xerval &= ~XER_CA32; in set_ca32()
1158 struct instruction_op *op, int rd, in add_with_carry() argument
1166 op->type = COMPUTE | SETREG | SETXER; in add_with_carry()
1167 op->reg = rd; in add_with_carry()
1168 op->val = val; in add_with_carry()
1171 op->xerval = regs->xer; in add_with_carry()
1173 op->xerval |= XER_CA; in add_with_carry()
1175 op->xerval &= ~XER_CA; in add_with_carry()
1177 set_ca32(op, (unsigned int)val < (unsigned int)val1 || in add_with_carry()
1182 struct instruction_op *op, in do_cmp_signed() argument
1187 op->type = COMPUTE | SETCC; in do_cmp_signed()
1196 op->ccval = (regs->ccr & ~(0xf << shift)) | (crval << shift); in do_cmp_signed()
1200 struct instruction_op *op, in do_cmp_unsigned() argument
1206 op->type = COMPUTE | SETCC; in do_cmp_unsigned()
1215 op->ccval = (regs->ccr & ~(0xf << shift)) | (crval << shift); in do_cmp_unsigned()
1219 struct instruction_op *op, in do_cmpb() argument
1231 op->val = out_val; in do_cmpb()
1239 struct instruction_op *op, in do_popcnt() argument
1250 op->val = out; in do_popcnt()
1256 op->val = out & 0x0000003f0000003fULL; in do_popcnt()
1261 op->val = out; /* popcntd */ in do_popcnt()
1266 struct instruction_op *op, in do_bpermd() argument
1279 op->val = perm; in do_bpermd()
1287 struct instruction_op *op, in do_prty() argument
1294 op->val = res & 0x0000000100000001ULL; in do_prty()
1299 op->val = res & 1; /*prtyd */ in do_prty()
1345 int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, in analyse_instr() argument
1361 op->type = COMPUTE; in analyse_instr()
1366 op->type = BRANCH; in analyse_instr()
1370 op->val = truncate_if_32bit(regs->msr, imm); in analyse_instr()
1372 op->type |= SETLK; in analyse_instr()
1373 if (branch_taken(word, regs, op)) in analyse_instr()
1374 op->type |= BRTAKEN; in analyse_instr()
1378 op->type = SYSCALL; in analyse_instr()
1381 op->type = SYSCALL_VECTORED_0; in analyse_instr()
1385 op->type = UNKNOWN; in analyse_instr()
1388 op->type = BRANCH | BRTAKEN; in analyse_instr()
1394 op->val = truncate_if_32bit(regs->msr, imm); in analyse_instr()
1396 op->type |= SETLK; in analyse_instr()
1401 op->type = COMPUTE + SETCC; in analyse_instr()
1407 op->ccval = (regs->ccr & ~(0xfUL << rd)) | (val << rd); in analyse_instr()
1412 op->type = BRANCH; in analyse_instr()
1414 op->val = truncate_if_32bit(regs->msr, imm); in analyse_instr()
1416 op->type |= SETLK; in analyse_instr()
1417 if (branch_taken(word, regs, op)) in analyse_instr()
1418 op->type |= BRTAKEN; in analyse_instr()
1424 op->type = RFI; in analyse_instr()
1428 op->type = BARRIER | BARRIER_ISYNC; in analyse_instr()
1439 op->type = COMPUTE + SETCC; in analyse_instr()
1446 op->ccval = (regs->ccr & ~(1UL << (31 - rd))) | in analyse_instr()
1454 op->type = BARRIER + BARRIER_SYNC; in analyse_instr()
1458 op->type = BARRIER + BARRIER_LWSYNC; in analyse_instr()
1461 op->type = BARRIER + BARRIER_PTESYNC; in analyse_instr()
1468 op->type = BARRIER + BARRIER_EIEIO; in analyse_instr()
1488 op->reg = rd; in analyse_instr()
1489 op->val = regs->gpr[rd]; in analyse_instr()
1498 op->type = COMPUTE | PREFIXED; in analyse_instr()
1499 op->val = mlsd_8lsd_ea(word, suffix, regs); in analyse_instr()
1527 "=r" (op->val) : "r" (regs->gpr[ra]), 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()
1552 op->val = regs->gpr[ra] * (short) word; in analyse_instr()
1557 add_with_carry(regs, op, rd, ~regs->gpr[ra], imm, 1); in analyse_instr()
1567 do_cmp_unsigned(regs, op, val, imm, rd >> 2); in analyse_instr()
1577 do_cmp_signed(regs, op, val, imm, rd >> 2); in analyse_instr()
1582 add_with_carry(regs, op, rd, regs->gpr[ra], imm, 0); in analyse_instr()
1587 add_with_carry(regs, op, rd, regs->gpr[ra], imm, 0); in analyse_instr()
1588 set_cr0(regs, op); in analyse_instr()
1595 op->val = imm; in analyse_instr()
1602 op->val = imm; in analyse_instr()
1612 op->val = regs->nip + (imm << 16) + 4; in analyse_instr()
1615 op->type = UNKNOWN; in analyse_instr()
1623 op->val = (regs->gpr[ra] & ~imm) | (ROTATE(val, rb) & imm); in analyse_instr()
1630 op->val = ROTATE(val, rb) & MASK32(mb, me); in analyse_instr()
1638 op->val = ROTATE(val, rb) & MASK32(mb, me); in analyse_instr()
1642 op->val = regs->gpr[rd] | (unsigned short) word; in analyse_instr()
1647 op->val = regs->gpr[rd] | (imm << 16); in analyse_instr()
1651 op->val = regs->gpr[rd] ^ (unsigned short) word; in analyse_instr()
1656 op->val = regs->gpr[rd] ^ (imm << 16); in analyse_instr()
1660 op->val = regs->gpr[rd] & (unsigned short) word; in analyse_instr()
1661 set_cr0(regs, op); in analyse_instr()
1666 op->val = regs->gpr[rd] & (imm << 16); in analyse_instr()
1667 set_cr0(regs, op); in analyse_instr()
1692 op->val = val; in analyse_instr()
1699 op->val = val & MASK64_L(mb); in analyse_instr()
1702 op->val = val & MASK64_R(mb); in analyse_instr()
1707 op->type = UNKNOWN; /* illegal instruction */ in analyse_instr()
1717 op->val = (val) ? val2 : regs->gpr[rb]; in analyse_instr()
1737 op->type = MFMSR; in analyse_instr()
1738 op->reg = rd; in analyse_instr()
1743 op->type = MTMSR; in analyse_instr()
1744 op->reg = rd; in analyse_instr()
1745 op->val = 0xffffffff & ~(MSR_ME | MSR_LE); in analyse_instr()
1751 op->type = MTMSR; in analyse_instr()
1752 op->reg = rd; in analyse_instr()
1756 op->val = imm; in analyse_instr()
1770 op->val = regs->ccr & imm; in analyse_instr()
1787 op->val = -1; in analyse_instr()
1790 op->val = 1; in analyse_instr()
1792 op->val = 0; in analyse_instr()
1796 op->type = COMPUTE + SETCC; in analyse_instr()
1799 op->ccval = regs->ccr; in analyse_instr()
1802 op->ccval = (op->ccval & ~imm) | in analyse_instr()
1810 op->type = MFSPR; in analyse_instr()
1811 op->reg = rd; in analyse_instr()
1812 op->spr = spr; in analyse_instr()
1820 op->type = MTSPR; in analyse_instr()
1821 op->val = regs->gpr[rd]; in analyse_instr()
1822 op->spr = spr; in analyse_instr()
1841 do_cmp_signed(regs, op, val, val2, rd >> 2); in analyse_instr()
1854 do_cmp_unsigned(regs, op, val, val2, rd >> 2); in analyse_instr()
1858 do_cmpb(regs, op, regs->gpr[rd], regs->gpr[rb]); in analyse_instr()
1865 add_with_carry(regs, op, rd, ~regs->gpr[ra], in analyse_instr()
1870 asm("mulhdu %0,%1,%2" : "=r" (op->val) : in analyse_instr()
1875 add_with_carry(regs, op, rd, regs->gpr[ra], in analyse_instr()
1880 asm("mulhwu %0,%1,%2" : "=r" (op->val) : in analyse_instr()
1885 op->val = regs->gpr[rb] - regs->gpr[ra]; in analyse_instr()
1889 asm("mulhd %0,%1,%2" : "=r" (op->val) : in analyse_instr()
1894 asm("mulhw %0,%1,%2" : "=r" (op->val) : in analyse_instr()
1899 op->val = -regs->gpr[ra]; in analyse_instr()
1903 add_with_carry(regs, op, rd, ~regs->gpr[ra], in analyse_instr()
1908 add_with_carry(regs, op, rd, regs->gpr[ra], in analyse_instr()
1913 add_with_carry(regs, op, rd, ~regs->gpr[ra], 0L, in analyse_instr()
1918 add_with_carry(regs, op, rd, regs->gpr[ra], 0L, in analyse_instr()
1923 add_with_carry(regs, op, rd, ~regs->gpr[ra], -1L, in analyse_instr()
1928 op->val = regs->gpr[ra] * regs->gpr[rb]; in analyse_instr()
1932 add_with_carry(regs, op, rd, regs->gpr[ra], -1L, in analyse_instr()
1937 op->val = (long)(int) regs->gpr[ra] * in analyse_instr()
1945 op->val = regs->gpr[ra] % regs->gpr[rb]; in analyse_instr()
1949 op->val = regs->gpr[ra] + regs->gpr[rb]; in analyse_instr()
1955 op->val = (unsigned int) regs->gpr[ra] % in analyse_instr()
1960 op->val = regs->gpr[ra] / regs->gpr[rb]; in analyse_instr()
1964 op->val = (unsigned int) regs->gpr[ra] / in analyse_instr()
1969 op->val = (long int) regs->gpr[ra] / in analyse_instr()
1974 op->val = (int) regs->gpr[ra] / in analyse_instr()
1980 "=r" (op->val) : "r" (regs->gpr[ra]), in analyse_instr()
1985 "=r" (op->val) : "r" (regs->gpr[ra]), in analyse_instr()
1995 asm volatile(PPC_DARN(%0, 0) : "=r" (op->val)); in analyse_instr()
2000 asm volatile(PPC_DARN(%0, 1) : "=r" (op->val)); in analyse_instr()
2005 asm volatile(PPC_DARN(%0, 2) : "=r" (op->val)); in analyse_instr()
2014 op->val = (long int) regs->gpr[ra] % in analyse_instr()
2021 op->val = (int) regs->gpr[ra] % in analyse_instr()
2031 op->val = ( val ? __builtin_clz(val) : 32 ); in analyse_instr()
2036 op->val = ( val ? __builtin_clzl(val) : 64 ); in analyse_instr()
2040 op->val = regs->gpr[rd] & regs->gpr[rb]; in analyse_instr()
2044 op->val = regs->gpr[rd] & ~regs->gpr[rb]; in analyse_instr()
2048 do_popcnt(regs, op, regs->gpr[rd], 8); in analyse_instr()
2052 op->val = ~(regs->gpr[rd] | regs->gpr[rb]); in analyse_instr()
2056 do_prty(regs, op, regs->gpr[rd], 32); in analyse_instr()
2060 do_prty(regs, op, regs->gpr[rd], 64); in analyse_instr()
2064 do_bpermd(regs, op, regs->gpr[rd], regs->gpr[rb]); in analyse_instr()
2068 op->val = ~(regs->gpr[rd] ^ regs->gpr[rb]); in analyse_instr()
2072 op->val = regs->gpr[rd] ^ regs->gpr[rb]; in analyse_instr()
2076 do_popcnt(regs, op, regs->gpr[rd], 32); in analyse_instr()
2080 op->val = regs->gpr[rd] | ~regs->gpr[rb]; in analyse_instr()
2084 op->val = regs->gpr[rd] | regs->gpr[rb]; in analyse_instr()
2088 op->val = ~(regs->gpr[rd] & regs->gpr[rb]); in analyse_instr()
2092 do_popcnt(regs, op, regs->gpr[rd], 64); in analyse_instr()
2099 op->val = (val ? __builtin_ctz(val) : 32); in analyse_instr()
2106 op->val = (val ? __builtin_ctzl(val) : 64); in analyse_instr()
2110 op->val = (signed short) regs->gpr[rd]; in analyse_instr()
2114 op->val = (signed char) regs->gpr[rd]; in analyse_instr()
2118 op->val = (signed int) regs->gpr[rd]; in analyse_instr()
2128 op->val = (regs->gpr[rd] << sh) & 0xffffffffUL; in analyse_instr()
2130 op->val = 0; in analyse_instr()
2136 op->val = (regs->gpr[rd] & 0xffffffffUL) >> sh; in analyse_instr()
2138 op->val = 0; in analyse_instr()
2142 op->type = COMPUTE + SETREG + SETXER; in analyse_instr()
2145 op->val = ival >> (sh < 32 ? sh : 31); in analyse_instr()
2146 op->xerval = regs->xer; in analyse_instr()
2148 op->xerval |= XER_CA; in analyse_instr()
2150 op->xerval &= ~XER_CA; in analyse_instr()
2151 set_ca32(op, op->xerval & XER_CA); in analyse_instr()
2155 op->type = COMPUTE + SETREG + SETXER; in analyse_instr()
2158 op->val = ival >> sh; in analyse_instr()
2159 op->xerval = regs->xer; in analyse_instr()
2161 op->xerval |= XER_CA; in analyse_instr()
2163 op->xerval &= ~XER_CA; in analyse_instr()
2164 set_ca32(op, op->xerval & XER_CA); in analyse_instr()
2171 op->val = regs->gpr[rd] << sh; in analyse_instr()
2173 op->val = 0; in analyse_instr()
2179 op->val = regs->gpr[rd] >> sh; in analyse_instr()
2181 op->val = 0; in analyse_instr()
2185 op->type = COMPUTE + SETREG + SETXER; in analyse_instr()
2188 op->val = ival >> (sh < 64 ? sh : 63); in analyse_instr()
2189 op->xerval = regs->xer; in analyse_instr()
2191 op->xerval |= XER_CA; in analyse_instr()
2193 op->xerval &= ~XER_CA; in analyse_instr()
2194 set_ca32(op, op->xerval & XER_CA); in analyse_instr()
2199 op->type = COMPUTE + SETREG + SETXER; in analyse_instr()
2202 op->val = ival >> sh; in analyse_instr()
2203 op->xerval = regs->xer; in analyse_instr()
2205 op->xerval |= XER_CA; in analyse_instr()
2207 op->xerval &= ~XER_CA; in analyse_instr()
2208 set_ca32(op, op->xerval & XER_CA); in analyse_instr()
2215 op->type = COMPUTE + SETREG; in analyse_instr()
2219 op->val = ROTATE(val, sh) & MASK64(0, 63 - sh); in analyse_instr()
2221 op->val = val; in analyse_instr()
2230 op->type = MKOP(CACHEOP, DCBST, 0); in analyse_instr()
2231 op->ea = xform_ea(word, regs); in analyse_instr()
2235 op->type = MKOP(CACHEOP, DCBF, 0); in analyse_instr()
2236 op->ea = xform_ea(word, regs); in analyse_instr()
2240 op->type = MKOP(CACHEOP, DCBTST, 0); in analyse_instr()
2241 op->ea = xform_ea(word, regs); in analyse_instr()
2242 op->reg = rd; 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, ICBI, 0); in analyse_instr()
2253 op->ea = xform_ea(word, regs); in analyse_instr()
2257 op->type = MKOP(CACHEOP, DCBZ, 0); in analyse_instr()
2258 op->ea = xform_ea(word, regs); in analyse_instr()
2267 op->type = UNKNOWN; in analyse_instr()
2268 op->update_reg = ra; in analyse_instr()
2269 op->reg = rd; in analyse_instr()
2270 op->val = regs->gpr[rd]; in analyse_instr()
2272 op->vsx_flags = 0; in analyse_instr()
2277 op->ea = xform_ea(word, regs); in analyse_instr()
2280 op->type = MKOP(LARX, 0, 4); in analyse_instr()
2284 op->type = MKOP(STCX, 0, 4); in analyse_instr()
2289 op->type = MKOP(LARX, 0, 8); in analyse_instr()
2293 op->type = MKOP(STCX, 0, 8); in analyse_instr()
2297 op->type = MKOP(LARX, 0, 1); in analyse_instr()
2301 op->type = MKOP(STCX, 0, 1); in analyse_instr()
2305 op->type = MKOP(LARX, 0, 2); in analyse_instr()
2309 op->type = MKOP(STCX, 0, 2); in analyse_instr()
2314 op->type = MKOP(LARX, 0, 16); in analyse_instr()
2319 op->type = MKOP(STCX, 0, 16); in analyse_instr()
2325 op->type = MKOP(LOAD, u, 4); in analyse_instr()
2330 op->type = MKOP(LOAD, u, 1); in analyse_instr()
2339 op->type = MKOP(LOAD_VMX, 0, 1); in analyse_instr()
2340 op->element_size = 1; in analyse_instr()
2344 op->type = MKOP(LOAD_VMX, 0, 2); in analyse_instr()
2345 op->element_size = 2; in analyse_instr()
2349 op->type = MKOP(LOAD_VMX, 0, 4); in analyse_instr()
2350 op->element_size = 4; in analyse_instr()
2355 op->type = MKOP(LOAD_VMX, 0, 16); in analyse_instr()
2356 op->element_size = 16; in analyse_instr()
2360 op->type = MKOP(STORE_VMX, 0, 1); in analyse_instr()
2361 op->element_size = 1; in analyse_instr()
2365 op->type = MKOP(STORE_VMX, 0, 2); in analyse_instr()
2366 op->element_size = 2; in analyse_instr()
2370 op->type = MKOP(STORE_VMX, 0, 4); in analyse_instr()
2371 op->element_size = 4; in analyse_instr()
2376 op->type = MKOP(STORE_VMX, 0, 16); in analyse_instr()
2383 op->type = MKOP(LOAD, u, 8); in analyse_instr()
2388 op->type = MKOP(STORE, u, 8); in analyse_instr()
2394 op->type = MKOP(STORE, u, 4); in analyse_instr()
2399 op->type = MKOP(STORE, u, 1); in analyse_instr()
2404 op->type = MKOP(LOAD, u, 2); in analyse_instr()
2410 op->type = MKOP(LOAD, SIGNEXT | u, 4); in analyse_instr()
2416 op->type = MKOP(LOAD, SIGNEXT | u, 2); in analyse_instr()
2421 op->type = MKOP(STORE, u, 2); in analyse_instr()
2426 op->type = MKOP(LOAD, BYTEREV, 8); in analyse_instr()
2431 op->type = MKOP(LOAD_MULTI, 0, regs->xer & 0x7f); in analyse_instr()
2435 op->type = MKOP(LOAD, BYTEREV, 4); in analyse_instr()
2441 op->type = MKOP(LOAD_MULTI, 0, rb); in analyse_instr()
2442 op->ea = ra ? regs->gpr[ra] : 0; in analyse_instr()
2448 op->type = MKOP(LOAD_FP, u | FPCONV, 4); in analyse_instr()
2453 op->type = MKOP(LOAD_FP, u, 8); in analyse_instr()
2458 op->type = MKOP(STORE_FP, u | FPCONV, 4); in analyse_instr()
2463 op->type = MKOP(STORE_FP, u, 8); in analyse_instr()
2468 op->type = MKOP(LOAD_FP, 0, 16); in analyse_instr()
2472 op->type = MKOP(LOAD_FP, SIGNEXT, 4); in analyse_instr()
2476 op->type = MKOP(LOAD_FP, 0, 4); in analyse_instr()
2480 op->type = MKOP(STORE_FP, 0, 16); in analyse_instr()
2484 op->type = MKOP(STORE_FP, 0, 4); in analyse_instr()
2491 op->type = MKOP(STORE, BYTEREV, 8); in analyse_instr()
2492 op->val = byterev_8(regs->gpr[rd]); in analyse_instr()
2497 op->type = MKOP(STORE_MULTI, 0, regs->xer & 0x7f); in analyse_instr()
2501 op->type = MKOP(STORE, BYTEREV, 4); in analyse_instr()
2502 op->val = byterev_4(regs->gpr[rd]); in analyse_instr()
2508 op->type = MKOP(STORE_MULTI, 0, rb); in analyse_instr()
2509 op->ea = ra ? regs->gpr[ra] : 0; in analyse_instr()
2513 op->type = MKOP(LOAD, BYTEREV, 2); in analyse_instr()
2517 op->type = MKOP(STORE, BYTEREV, 2); in analyse_instr()
2518 op->val = byterev_2(regs->gpr[rd]); in analyse_instr()
2523 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2524 op->type = MKOP(LOAD_VSX, 0, 4); in analyse_instr()
2525 op->element_size = 8; in analyse_instr()
2529 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2530 op->type = MKOP(LOAD_VSX, SIGNEXT, 4); in analyse_instr()
2531 op->element_size = 8; in analyse_instr()
2535 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2536 op->type = MKOP(STORE_VSX, 0, 4); in analyse_instr()
2537 op->element_size = 8; in analyse_instr()
2543 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2544 op->type = MKOP(LOAD_VSX, 0, 16); in analyse_instr()
2545 op->element_size = 16; in analyse_instr()
2546 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2554 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2555 op->ea = ra ? regs->gpr[ra] : 0; in analyse_instr()
2559 op->type = MKOP(LOAD_VSX, 0, nb); in analyse_instr()
2560 op->element_size = 16; in analyse_instr()
2561 op->vsx_flags = ((word & 0x20) ? VSX_LDLEFT : 0) | in analyse_instr()
2566 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2567 op->type = MKOP(LOAD_VSX, 0, 8); in analyse_instr()
2568 op->element_size = 8; in analyse_instr()
2569 op->vsx_flags = VSX_SPLAT; in analyse_instr()
2575 op->reg = VSX_REGISTER_XTP(rd); in analyse_instr()
2576 op->type = MKOP(LOAD_VSX, 0, 32); in analyse_instr()
2577 op->element_size = 32; in analyse_instr()
2583 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2584 op->type = MKOP(LOAD_VSX, 0, 4); in analyse_instr()
2585 op->element_size = 4; in analyse_instr()
2586 op->vsx_flags = VSX_SPLAT | VSX_CHECK_VEC; in analyse_instr()
2592 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2593 op->type = MKOP(STORE_VSX, 0, 16); in analyse_instr()
2594 op->element_size = 16; in analyse_instr()
2595 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2603 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2604 op->ea = ra ? regs->gpr[ra] : 0; in analyse_instr()
2608 op->type = MKOP(STORE_VSX, 0, nb); in analyse_instr()
2609 op->element_size = 16; in analyse_instr()
2610 op->vsx_flags = ((word & 0x20) ? VSX_LDLEFT : 0) | in analyse_instr()
2617 op->reg = VSX_REGISTER_XTP(rd); in analyse_instr()
2618 op->type = MKOP(STORE_VSX, 0, 32); in analyse_instr()
2619 op->element_size = 32; in analyse_instr()
2622 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2623 op->type = MKOP(LOAD_VSX, 0, 4); in analyse_instr()
2624 op->element_size = 8; in analyse_instr()
2625 op->vsx_flags = VSX_FPCONV; in analyse_instr()
2629 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2630 op->type = MKOP(LOAD_VSX, 0, 8); in analyse_instr()
2631 op->element_size = 8; in analyse_instr()
2635 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2636 op->type = MKOP(STORE_VSX, 0, 4); in analyse_instr()
2637 op->element_size = 8; in analyse_instr()
2638 op->vsx_flags = VSX_FPCONV; in analyse_instr()
2642 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2643 op->type = MKOP(STORE_VSX, 0, 8); in analyse_instr()
2644 op->element_size = 8; in analyse_instr()
2648 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2649 op->type = MKOP(LOAD_VSX, 0, 16); in analyse_instr()
2650 op->element_size = 4; in analyse_instr()
2656 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2657 op->type = MKOP(LOAD_VSX, 0, 1); in analyse_instr()
2658 op->element_size = 8; in analyse_instr()
2659 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2665 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2666 op->type = MKOP(LOAD_VSX, 0, 16); in analyse_instr()
2667 op->element_size = 2; in analyse_instr()
2668 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2674 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2675 op->type = MKOP(LOAD_VSX, 0, 2); in analyse_instr()
2676 op->element_size = 8; in analyse_instr()
2677 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, 16); in analyse_instr()
2683 op->element_size = 8; in analyse_instr()
2689 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2690 op->type = MKOP(LOAD_VSX, 0, 16); in analyse_instr()
2691 op->element_size = 1; in analyse_instr()
2692 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2696 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2697 op->type = MKOP(STORE_VSX, 0, 16); in analyse_instr()
2698 op->element_size = 4; in analyse_instr()
2704 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2705 op->type = MKOP(STORE_VSX, 0, 1); in analyse_instr()
2706 op->element_size = 8; in analyse_instr()
2707 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2713 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2714 op->type = MKOP(STORE_VSX, 0, 16); in analyse_instr()
2715 op->element_size = 2; in analyse_instr()
2716 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2722 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2723 op->type = MKOP(STORE_VSX, 0, 2); in analyse_instr()
2724 op->element_size = 8; in analyse_instr()
2725 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, 16); in analyse_instr()
2731 op->element_size = 8; in analyse_instr()
2737 op->reg = rd | ((word & 1) << 5); in analyse_instr()
2738 op->type = MKOP(STORE_VSX, 0, 16); in analyse_instr()
2739 op->element_size = 1; in analyse_instr()
2740 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2749 op->type = MKOP(LOAD, u, 4); in analyse_instr()
2750 op->ea = dform_ea(word, regs); in analyse_instr()
2755 op->type = MKOP(LOAD, u, 1); in analyse_instr()
2756 op->ea = dform_ea(word, regs); in analyse_instr()
2761 op->type = MKOP(STORE, u, 4); in analyse_instr()
2762 op->ea = dform_ea(word, regs); in analyse_instr()
2767 op->type = MKOP(STORE, u, 1); in analyse_instr()
2768 op->ea = dform_ea(word, regs); in analyse_instr()
2773 op->type = MKOP(LOAD, u, 2); in analyse_instr()
2774 op->ea = dform_ea(word, regs); in analyse_instr()
2779 op->type = MKOP(LOAD, SIGNEXT | u, 2); in analyse_instr()
2780 op->ea = dform_ea(word, regs); in analyse_instr()
2785 op->type = MKOP(STORE, u, 2); in analyse_instr()
2786 op->ea = dform_ea(word, regs); in analyse_instr()
2792 op->type = MKOP(LOAD_MULTI, 0, 4 * (32 - rd)); in analyse_instr()
2793 op->ea = dform_ea(word, regs); in analyse_instr()
2797 op->type = MKOP(STORE_MULTI, 0, 4 * (32 - rd)); in analyse_instr()
2798 op->ea = dform_ea(word, regs); in analyse_instr()
2804 op->type = MKOP(LOAD_FP, u | FPCONV, 4); in analyse_instr()
2805 op->ea = dform_ea(word, regs); in analyse_instr()
2810 op->type = MKOP(LOAD_FP, u, 8); in analyse_instr()
2811 op->ea = dform_ea(word, regs); in analyse_instr()
2816 op->type = MKOP(STORE_FP, u | FPCONV, 4); in analyse_instr()
2817 op->ea = dform_ea(word, regs); in analyse_instr()
2822 op->type = MKOP(STORE_FP, u, 8); in analyse_instr()
2823 op->ea = dform_ea(word, regs); in analyse_instr()
2830 op->type = MKOP(LOAD, 0, 16); in analyse_instr()
2831 op->ea = dqform_ea(word, regs); in analyse_instr()
2837 op->ea = dsform_ea(word, regs); in analyse_instr()
2842 op->type = MKOP(LOAD_FP, 0, 16); in analyse_instr()
2847 op->reg = rd + 32; in analyse_instr()
2848 op->type = MKOP(LOAD_VSX, 0, 8); in analyse_instr()
2849 op->element_size = 8; in analyse_instr()
2850 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2855 op->reg = rd + 32; in analyse_instr()
2856 op->type = MKOP(LOAD_VSX, 0, 4); in analyse_instr()
2857 op->element_size = 8; in analyse_instr()
2858 op->vsx_flags = VSX_FPCONV | VSX_CHECK_VEC; in analyse_instr()
2866 op->ea = dsform_ea(word, regs); in analyse_instr()
2869 op->type = MKOP(LOAD, 0, 8); in analyse_instr()
2872 op->type = MKOP(LOAD, UPDATE, 8); in analyse_instr()
2875 op->type = MKOP(LOAD, SIGNEXT, 4); in analyse_instr()
2885 op->ea = dqform_ea(word, regs); in analyse_instr()
2886 op->reg = VSX_REGISTER_XTP(rd); in analyse_instr()
2887 op->element_size = 32; in analyse_instr()
2890 op->type = MKOP(LOAD_VSX, 0, 32); in analyse_instr()
2893 op->type = MKOP(STORE_VSX, 0, 32); in analyse_instr()
2902 op->ea = dsform_ea(word, regs); in analyse_instr()
2903 op->type = MKOP(STORE_FP, 0, 16); in analyse_instr()
2909 op->ea = dqform_ea(word, regs); in analyse_instr()
2911 op->reg = rd + 32; in analyse_instr()
2912 op->type = MKOP(LOAD_VSX, 0, 16); in analyse_instr()
2913 op->element_size = 16; in analyse_instr()
2914 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2921 op->ea = dsform_ea(word, regs); in analyse_instr()
2922 op->reg = rd + 32; in analyse_instr()
2923 op->type = MKOP(STORE_VSX, 0, 8); in analyse_instr()
2924 op->element_size = 8; in analyse_instr()
2925 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2932 op->ea = dsform_ea(word, regs); in analyse_instr()
2933 op->reg = rd + 32; in analyse_instr()
2934 op->type = MKOP(STORE_VSX, 0, 4); in analyse_instr()
2935 op->element_size = 8; in analyse_instr()
2936 op->vsx_flags = VSX_FPCONV | VSX_CHECK_VEC; in analyse_instr()
2942 op->ea = dqform_ea(word, regs); in analyse_instr()
2944 op->reg = rd + 32; in analyse_instr()
2945 op->type = MKOP(STORE_VSX, 0, 16); in analyse_instr()
2946 op->element_size = 16; in analyse_instr()
2947 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2955 op->ea = dsform_ea(word, regs); in analyse_instr()
2958 op->type = MKOP(STORE, 0, 8); in analyse_instr()
2961 op->type = MKOP(STORE, UPDATE, 8); in analyse_instr()
2965 op->type = MKOP(STORE, 0, 16); in analyse_instr()
2975 op->update_reg = ra; in analyse_instr()
2977 op->reg = rd; in analyse_instr()
2978 op->val = regs->gpr[rd]; in analyse_instr()
2986 op->ea = mlsd_8lsd_ea(word, suffix, regs); in analyse_instr()
2989 op->type = MKOP(LOAD, PREFIXED | SIGNEXT, 4); in analyse_instr()
2993 op->reg = rd + 32; in analyse_instr()
2994 op->type = MKOP(LOAD_VSX, PREFIXED, 8); in analyse_instr()
2995 op->element_size = 8; in analyse_instr()
2996 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
2999 op->reg = rd + 32; in analyse_instr()
3000 op->type = MKOP(LOAD_VSX, PREFIXED, 4); in analyse_instr()
3001 op->element_size = 8; in analyse_instr()
3002 op->vsx_flags = VSX_FPCONV | VSX_CHECK_VEC; in analyse_instr()
3005 op->reg = rd + 32; in analyse_instr()
3006 op->type = MKOP(STORE_VSX, PREFIXED, 8); in analyse_instr()
3007 op->element_size = 8; in analyse_instr()
3008 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
3011 op->reg = rd + 32; in analyse_instr()
3012 op->type = MKOP(STORE_VSX, PREFIXED, 4); in analyse_instr()
3013 op->element_size = 8; in analyse_instr()
3014 op->vsx_flags = VSX_FPCONV | VSX_CHECK_VEC; in analyse_instr()
3017 op->reg += 32; in analyse_instr()
3020 op->type = MKOP(LOAD_VSX, PREFIXED, 16); in analyse_instr()
3021 op->element_size = 16; in analyse_instr()
3022 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
3025 op->reg = rd + 32; in analyse_instr()
3028 op->type = MKOP(STORE_VSX, PREFIXED, 16); in analyse_instr()
3029 op->element_size = 16; in analyse_instr()
3030 op->vsx_flags = VSX_CHECK_VEC; in analyse_instr()
3034 op->type = MKOP(LOAD, PREFIXED, 16); in analyse_instr()
3037 op->type = MKOP(LOAD, PREFIXED, 8); in analyse_instr()
3041 op->reg = VSX_REGISTER_XTP(rd); in analyse_instr()
3042 op->type = MKOP(LOAD_VSX, PREFIXED, 32); in analyse_instr()
3043 op->element_size = 32; in analyse_instr()
3047 op->type = MKOP(STORE, PREFIXED, 16); in analyse_instr()
3050 op->type = MKOP(STORE, PREFIXED, 8); in analyse_instr()
3054 op->reg = VSX_REGISTER_XTP(rd); in analyse_instr()
3055 op->type = MKOP(STORE_VSX, PREFIXED, 32); in analyse_instr()
3056 op->element_size = 32; in analyse_instr()
3066 op->ea = mlsd_8lsd_ea(word, suffix, regs); in analyse_instr()
3069 op->type = MKOP(LOAD, PREFIXED, 4); in analyse_instr()
3072 op->type = MKOP(LOAD, PREFIXED, 1); in analyse_instr()
3075 op->type = MKOP(STORE, PREFIXED, 4); in analyse_instr()
3078 op->type = MKOP(STORE, PREFIXED, 1); in analyse_instr()
3081 op->type = MKOP(LOAD, PREFIXED, 2); in analyse_instr()
3084 op->type = MKOP(LOAD, PREFIXED | SIGNEXT, 2); in analyse_instr()
3087 op->type = MKOP(STORE, PREFIXED, 2); in analyse_instr()
3090 op->type = MKOP(LOAD_FP, PREFIXED | FPCONV, 4); in analyse_instr()
3093 op->type = MKOP(LOAD_FP, PREFIXED, 8); in analyse_instr()
3096 op->type = MKOP(STORE_FP, PREFIXED | FPCONV, 4); in analyse_instr()
3099 op->type = MKOP(STORE_FP, PREFIXED, 8); in analyse_instr()
3110 if (OP_IS_LOAD_STORE(op->type) && (op->type & UPDATE)) { in analyse_instr()
3111 switch (GETTYPE(op->type)) { in analyse_instr()
3125 if ((GETTYPE(op->type) == LOAD_VSX || in analyse_instr()
3126 GETTYPE(op->type) == STORE_VSX) && in analyse_instr()
3135 op->type = UNKNOWN; in analyse_instr()
3140 set_cr0(regs, op); in analyse_instr()
3142 op->reg = ra; in analyse_instr()
3143 op->type |= SETREG; in analyse_instr()
3148 set_cr0(regs, op); in analyse_instr()
3150 op->reg = rd; in analyse_instr()
3151 op->type |= SETREG; in analyse_instr()
3155 op->type = INTERRUPT | 0x700; in analyse_instr()
3156 op->val = SRR1_PROGPRIV; in analyse_instr()
3160 op->type = INTERRUPT | 0x700; in analyse_instr()
3161 op->val = SRR1_PROGTRAP; in analyse_instr()
3219 void emulate_update_regs(struct pt_regs *regs, struct instruction_op *op) in emulate_update_regs() argument
3223 next_pc = truncate_if_32bit(regs->msr, regs->nip + GETLENGTH(op->type)); in emulate_update_regs()
3224 switch (GETTYPE(op->type)) { in emulate_update_regs()
3226 if (op->type & SETREG) in emulate_update_regs()
3227 regs->gpr[op->reg] = op->val; in emulate_update_regs()
3228 if (op->type & SETCC) in emulate_update_regs()
3229 regs->ccr = op->ccval; in emulate_update_regs()
3230 if (op->type & SETXER) in emulate_update_regs()
3231 regs->xer = op->xerval; in emulate_update_regs()
3235 if (op->type & SETLK) in emulate_update_regs()
3237 if (op->type & BRTAKEN) in emulate_update_regs()
3238 next_pc = op->val; in emulate_update_regs()
3239 if (op->type & DECCTR) in emulate_update_regs()
3244 switch (op->type & BARRIER_MASK) { in emulate_update_regs()
3266 switch (op->spr) { in emulate_update_regs()
3268 regs->gpr[op->reg] = regs->xer & 0xffffffffUL; in emulate_update_regs()
3271 regs->gpr[op->reg] = regs->link; in emulate_update_regs()
3274 regs->gpr[op->reg] = regs->ctr; in emulate_update_regs()
3282 switch (op->spr) { in emulate_update_regs()
3284 regs->xer = op->val & 0xffffffffUL; in emulate_update_regs()
3287 regs->link = op->val; in emulate_update_regs()
3290 regs->ctr = op->val; in emulate_update_regs()
3313 int emulate_loadstore(struct pt_regs *regs, struct instruction_op *op) in emulate_loadstore() argument
3323 size = GETSIZE(op->type); in emulate_loadstore()
3324 type = GETTYPE(op->type); in emulate_loadstore()
3326 ea = truncate_if_32bit(regs->msr, op->ea); in emulate_loadstore()
3353 err = do_lqarx(ea, ®s->gpr[op->reg]); in emulate_loadstore()
3364 regs->gpr[op->reg] = val; in emulate_loadstore()
3376 __put_user_asmx(op->val, ea, err, "stbcx.", cr); in emulate_loadstore()
3379 __put_user_asmx(op->val, ea, err, "sthcx.", cr); in emulate_loadstore()
3383 __put_user_asmx(op->val, ea, err, "stwcx.", cr); in emulate_loadstore()
3387 __put_user_asmx(op->val, ea, err, "stdcx.", cr); in emulate_loadstore()
3390 err = do_stqcx(ea, regs->gpr[op->reg], in emulate_loadstore()
3391 regs->gpr[op->reg + 1], &cr); in emulate_loadstore()
3408 err = emulate_lq(regs, ea, op->reg, cross_endian); in emulate_loadstore()
3412 err = read_mem(®s->gpr[op->reg], ea, size, regs); in emulate_loadstore()
3414 if (op->type & SIGNEXT) in emulate_loadstore()
3415 do_signext(®s->gpr[op->reg], size); in emulate_loadstore()
3416 if ((op->type & BYTEREV) == (cross_endian ? 0 : BYTEREV)) in emulate_loadstore()
3417 do_byterev(®s->gpr[op->reg], size); in emulate_loadstore()
3431 err = do_fp_load(op, ea, regs, cross_endian); in emulate_loadstore()
3438 err = do_vec_load(op->reg, ea, size, regs, cross_endian); in emulate_loadstore()
3449 if (op->reg >= 32 && (op->vsx_flags & VSX_CHECK_VEC)) in emulate_loadstore()
3453 err = do_vsx_load(op, ea, regs, cross_endian); in emulate_loadstore()
3460 rd = op->reg; in emulate_loadstore()
3482 err = emulate_stq(regs, ea, op->reg, cross_endian); in emulate_loadstore()
3486 if ((op->type & UPDATE) && size == sizeof(long) && in emulate_loadstore()
3487 op->reg == 1 && op->update_reg == 1 && in emulate_loadstore()
3494 do_byterev(&op->val, size); in emulate_loadstore()
3495 err = write_mem(op->val, ea, size, regs); in emulate_loadstore()
3502 err = do_fp_store(op, ea, regs, cross_endian); in emulate_loadstore()
3509 err = do_vec_store(op->reg, ea, size, regs, cross_endian); in emulate_loadstore()
3520 if (op->reg >= 32 && (op->vsx_flags & VSX_CHECK_VEC)) in emulate_loadstore()
3524 err = do_vsx_store(op, ea, regs, cross_endian); in emulate_loadstore()
3531 rd = op->reg; in emulate_loadstore()
3556 if (op->type & UPDATE) in emulate_loadstore()
3557 regs->gpr[op->update_reg] = op->ea; in emulate_loadstore()
3572 struct instruction_op op; in emulate_step() local
3577 r = analyse_instr(&op, regs, instr); in emulate_step()
3581 emulate_update_regs(regs, &op); in emulate_step()
3586 type = GETTYPE(op.type); in emulate_step()
3589 err = emulate_loadstore(regs, &op); in emulate_step()
3597 ea = truncate_if_32bit(regs->msr, op.ea); in emulate_step()
3600 switch (op.type & CACHEOP_MASK) { in emulate_step()
3608 if (op.reg == 0) in emulate_step()
3612 if (op.reg == 0) in emulate_step()
3629 regs->gpr[op.reg] = regs->msr & MSR_MASK; in emulate_step()
3633 val = regs->gpr[op.reg]; in emulate_step()
3638 regs_set_return_msr(regs, (regs->msr & ~op.val) | (val & op.val)); in emulate_step()
3662 truncate_if_32bit(regs->msr, regs->nip + GETLENGTH(op.type))); in emulate_step()