Lines Matching defs:instr

265 #define	FBT_BDEST(va, instr)	((uintptr_t)(va) + \
266 (((int32_t)(((instr) & FBT_DISP22_MASK) << 10)) >> 8))
267 #define FBT_BPCCDEST(va, instr) ((uintptr_t)(va) + \
268 (((int32_t)(((instr) & FBT_DISP19_MASK) << 13)) >> 11))
269 #define FBT_BPRDEST(va, instr) ((uintptr_t)(va) + \
270 (((int32_t)((FBT_DISP16(instr)) << 16)) >> 14))
276 #define FBT_IS_SAVE(instr) \
277 (FBT_FMT3_OP(instr) == FBT_OP_SAVE && \
278 FBT_FMT3_RD(instr) == FBT_REG_O6 && \
279 FBT_FMT3_RS1(instr) == FBT_REG_O6 && \
280 !(FBT_FMT3_ISIMM(instr) && FBT_FMT3_SIMM13(instr) == 0))
282 #define FBT_IS_BA(instr) (((instr) & ~FBT_DISP22_MASK) == FBT_OP_BA)
283 #define FBT_IS_BAPCC(instr) (((instr) & ~FBT_DISP22_MASK) == FBT_OP_BAPCC)
285 #define FBT_IS_RDPC(instr) ((FBT_FMT3_OP(instr) == FBT_OP_RD) && \
286 (FBT_FMT3_RD(instr) == FBT_REG_PC))
288 #define FBT_IS_PCRELATIVE(instr) \
289 ((((instr) & FBT_OP_MASK) == FBT_OP0 && \
290 ((instr) & FBT_FMT2_OP2_MASK) != FBT_FMT2_OP2_SETHI) || \
291 ((instr) & FBT_OP_MASK) == FBT_OP1 || \
292 FBT_IS_RDPC(instr))
294 #define FBT_IS_CTI(instr) \
295 ((((instr) & FBT_OP_MASK) == FBT_OP0 && \
296 ((instr) & FBT_FMT2_OP2_MASK) != FBT_FMT2_OP2_SETHI) || \
297 ((instr) & FBT_OP_MASK) == FBT_OP1 || \
298 (FBT_FMT3_OP(instr) == FBT_OP_JMPL) || \
299 (FBT_FMT3_OP(instr) == FBT_OP_RETURN))
387 fbt_patch_entry(uint32_t *instr, uint32_t id, fbt_trampoline_t *tramp,
391 uint32_t first = *instr;
433 uintptr_t ret = (uintptr_t)instr - sizeof (uint32_t);
441 uintptr_t ret = (uintptr_t)instr + sizeof (uint32_t);
458 ret = FBT_BDEST(instr, *instr);
460 ret = FBT_BPCCDEST(instr, *instr);
463 delay = *(instr + 1);
486 uintptr_t targ = FBT_BPRDEST(instr, first);
491 *tinstr++ = *(instr + 1);
540 fbt_canpatch_return(uint32_t *instr, int offset, const char *name)
544 if (FBT_FMT3_OP(*instr) == FBT_OP_RETURN) {
545 uint32_t delay = *(instr + 1);
547 if (*instr != FBT_RETURN(FBT_REG_I7, 8)) {
559 (void *)instr);
575 name, (void *)instr);
590 "return instruction", name, (void *)instr);
597 if (FBT_FMT3_OP(*(instr + 1)) != FBT_OP_RESTORE)
600 if (FBT_FMT1_OP(*instr) == FBT_OP_CALL)
603 if (FBT_FMT3_OP(*instr) != FBT_OP_JMPL)
606 rd = FBT_FMT3_RD(*instr);
617 "jmpl destination register", name, (void *)instr);
622 fbt_canpatch_retl(uint32_t *instr, int offset, const char *name)
624 if (FBT_FMT1_OP(*instr) == FBT_OP_CALL ||
625 (FBT_FMT3_OP(*instr) == FBT_OP_JMPL &&
626 FBT_FMT3_RD(*instr) == FBT_REG_O7)) {
637 uint32_t delay = *(instr + 1);
649 if (*instr < (uintptr_t)instr &&
650 *instr >= (uintptr_t)instr - offset)
655 name, (void *)instr);
668 if (fbt_canpatch_retl(instr - 1, 0, name))
672 if (FBT_FMT3_OP(*instr) != FBT_OP_JMPL)
675 if (FBT_FMT3_RD(*instr) != FBT_REG_G0)
683 fbt_patch_return(uint32_t *instr, uint32_t *funcbase, uint32_t *funclim,
687 uint32_t cti = *instr, restore = *(instr + 1), rs1, dest;
701 if (FBT_FMT3_OP(*instr) == FBT_OP_RETURN) {
715 uint32_t delay = *(instr + 1);
716 ASSERT(*instr == FBT_RETURN(FBT_REG_I7, 8));
828 dest = (uintptr_t)instr + (FBT_FMT1_DISP30(cti) << 2);
839 return (FBT_BAA(instr, va));
843 fbt_patch_retl(uint32_t *instr, uint32_t *funcbase, uint32_t *funclim,
849 uint32_t cti = *instr, dest;
862 fbt_canpatch_retl(instr - 1, 0, name)) {
863 *tinstr++ = *instr;
871 *tinstr++ = *(instr + 1);
971 dest = (uintptr_t)instr + (FBT_FMT1_DISP30(cti) << 2);
993 return (annul ? FBT_BAA(instr, va) : FBT_BA(instr, va));
1091 uint32_t *instr, *base, *limit;
1193 instr = base;
1225 if ((*instr & FBT_OP_MASK) == FBT_OP0 &&
1226 (*instr & FBT_FMT2_OP2_MASK) != FBT_FMT2_OP2_SETHI &&
1227 (*instr & FBT_FMT2_OP2_MASK) != FBT_FMT2_OP2_BPR) {
1228 if (!FBT_IS_BA(*instr) && !FBT_IS_BAPCC(*instr)) {
1238 while (!FBT_IS_SAVE(*instr)) {
1243 int op = *instr & FBT_OP_MASK;
1244 int op2 = *instr & FBT_FMT2_OP2_MASK;
1258 if ((*instr & FBT_ANNUL) ||
1259 !FBT_IS_SAVE(*(instr + 1))) {
1262 instr++;
1270 if (++instr == limit)
1274 if (instr < limit && cti) {
1288 if (instr == limit) {
1310 while (++instr < limit) {
1311 if (FBT_IS_SAVE(*instr))
1315 if (instr != limit)
1319 instr = base;
1321 if (FBT_IS_CTI(*instr)) {
1332 if (FBT_IS_CTI(*(instr + 1))) {
1342 if (FBT_IS_PCRELATIVE(*(instr + 1))) {
1356 (void) fbt_patch_entry(instr, FBT_ESTIMATE_ID,
1365 fbt->fbtp_patchval = FBT_BAA(instr, tramp.fbtt_va);
1367 if (!fbt_patch_entry(instr, fbt->fbtp_id,
1377 ((uintptr_t)instr - (uintptr_t)mp->text));
1378 fbt->fbtp_savedval = *instr;
1388 if (++instr == limit)
1391 offset = (uintptr_t)instr - (uintptr_t)base;
1393 if (!(*canpatch)(instr, offset, name))
1399 (void) (*patch)(instr, base, limit,
1421 if ((fbt->fbtp_patchval = (*patch)(instr, base, limit, offset,
1429 ((uintptr_t)instr - (uintptr_t)mp->text));
1430 fbt->fbtp_savedval = *instr;