Lines Matching defs:pCpu

669                                      PDISCPUSTATE pCpu, uint32_t *pcbInstr, char *pszOutput, size_t cbOutput)
680 pCpu, pcbInstr, pszOutput, cbOutput));
685 PDISCPUSTATE pCpu, uint32_t *pcbInstr)
696 pCpu, pcbInstr));
702 PDISCPUSTATE pCpu, uint32_t *pcbInstr)
711 pCpu, pcbInstr));
1428 * @param pCpu CPU disassembly state
1434 static int patmAnalyseBlockCallback(PVM pVM, DISCPUSTATE *pCpu, RCPTRTYPE(uint8_t *) pInstrGC, RCPTRTYPE(uint8_t *) pCurInstrGC, PPATMP2GLOOKUPREC pCacheRec)
1460 if ( (pCpu->pCurInstr->fOpType & DISOPTYPE_CONTROLFLOW)
1461 && (pCpu->pCurInstr->uOpcode == OP_JMP || pCpu->pCurInstr->uOpcode == OP_CALL)
1464 Assert(pCpu->Param1.cb <= 4 || pCpu->Param1.cb == 6);
1465 if ( pCpu->Param1.cb == 6 /* far call/jmp */
1466 || (pCpu->pCurInstr->uOpcode == OP_CALL && !(pPatch->flags & PATMFL_SUPPORT_CALLS))
1467 || (OP_PARM_VTYPE(pCpu->pCurInstr->fParam1) != OP_PARM_J && !(pPatch->flags & PATMFL_SUPPORT_INDIRECT_CALLS))
1476 if (pPatch->opcode == OP_CLI && pCpu->pCurInstr->uOpcode == OP_JMP)
1479 && pCurInstrGC + pCpu->cbInstr < pPatch->pPrivInstrGC + SIZEOF_NEARJUMP32) /* hardcoded patch jump size; cbPatchJump is still zero */
1490 if (pCurInstrGC != pInstrGC && pCpu->pCurInstr->uOpcode == OP_PUSHF)
1498 if (pCpu->pCurInstr->uOpcode == OP_RETF)
1504 else if ( pCpu->pCurInstr->uOpcode == OP_INT3
1505 || pCpu->pCurInstr->uOpcode == OP_INT
1506 || pCpu->pCurInstr->uOpcode == OP_INTO)
1514 pPatch->cbPatchBlockSize += pCpu->cbInstr;
1521 switch (pCpu->pCurInstr->uOpcode)
1543 if (pCpu->pCurInstr->uOpcode == OP_POPF)
1572 if (pCpu->pCurInstr->fOpType & (DISOPTYPE_PRIVILEGED_NOTRAP))
1581 if ((pPatch->flags & PATMFL_CHECK_SIZE) && pPatch->cbPatchBlockSize > SIZEOF_NEARJUMP32 && !(pCpu->pCurInstr->fOpType & DISOPTYPE_RELATIVE_CONTROLFLOW))
1584 Log(("End of block at %RRv size %d\n", pCurInstrGC, pCpu->cbInstr));
1596 * @param pCpu CPU disassembly state
1602 static int patmAnalyseFunctionCallback(PVM pVM, DISCPUSTATE *pCpu, RCPTRTYPE(uint8_t *) pInstrGC, RCPTRTYPE(uint8_t *) pCurInstrGC, PPATMP2GLOOKUPREC pCacheRec)
1624 if ( (pCpu->pCurInstr->fOpType & DISOPTYPE_CONTROLFLOW)
1625 && (pCpu->pCurInstr->uOpcode == OP_JMP || pCpu->pCurInstr->uOpcode == OP_CALL)
1628 Assert(pCpu->Param1.cb <= 4 || pCpu->Param1.cb == 6);
1629 if ( pCpu->Param1.cb == 6 /* far call/jmp */
1630 || (pCpu->pCurInstr->uOpcode == OP_CALL && !(pPatch->flags & PATMFL_SUPPORT_CALLS))
1631 || (OP_PARM_VTYPE(pCpu->pCurInstr->fParam1) != OP_PARM_J && !(pPatch->flags & PATMFL_SUPPORT_INDIRECT_CALLS))
1639 if (pCpu->pCurInstr->uOpcode == OP_RETF)
1645 if (pCpu->pCurInstr->uOpcode == OP_INT3 || pCpu->pCurInstr->uOpcode == OP_INT || pCpu->pCurInstr->uOpcode == OP_INTO)
1653 if (pCpu->pCurInstr->fOpType & DISOPTYPE_PRIVILEGED && pCpu->pCurInstr->uOpcode != OP_STI)
1661 pPatch->cbPatchBlockSize += pCpu->cbInstr;
1670 switch (pCpu->pCurInstr->uOpcode)
1691 if (pCpu->pCurInstr->fOpType & (DISOPTYPE_PRIVILEGED_NOTRAP))
1707 * @param pCpu CPU disassembly state
1713 static int patmRecompileCallback(PVM pVM, DISCPUSTATE *pCpu, RCPTRTYPE(uint8_t *) pInstrGC, RCPTRTYPE(uint8_t *) pCurInstrGC, PPATMP2GLOOKUPREC pCacheRec)
1729 return patmPatchGenRelJump(pVM, pPatch, pCurInstrGC, OP_JMP, !!(pCpu->fPrefix & DISPREFIX_OPSIZE));
1734 rc = patmAnalyseFunctionCallback(pVM, pCpu, pInstrGC, pCurInstrGC, pCacheRec);
1737 rc = patmAnalyseBlockCallback(pVM, pCpu, pInstrGC, pCurInstrGC, pCacheRec);
1756 pPatch->pInstrGCHighest = pCurInstrGC + pCpu->cbInstr;
1769 if ( (pCpu->pCurInstr->fOpType & DISOPTYPE_CONTROLFLOW)
1770 && (pCpu->pCurInstr->uOpcode != OP_CALL || (pPatch->flags & PATMFL_SUPPORT_CALLS))
1771 && (OP_PARM_VTYPE(pCpu->pCurInstr->fParam1) == OP_PARM_J))
1773 RCPTRTYPE(uint8_t *) pTargetGC = PATMResolveBranch(pCpu, pCurInstrGC);
1776 Log(("We don't support far jumps here!! (%08X)\n", pCpu->Param1.fUse));
1780 if (pCpu->pCurInstr->uOpcode == OP_CALL)
1783 rc = patmPatchGenCall(pVM, pPatch, pCpu, pCurInstrGC, pTargetGC, false);
1788 rc = patmPatchGenRelJump(pVM, pPatch, pTargetGC, pCpu->pCurInstr->uOpcode, !!(pCpu->fPrefix & DISPREFIX_OPSIZE));
1796 switch (pCpu->pCurInstr->uOpcode)
1820 if (pCpu->pCurInstr->fOpType & DISOPTYPE_POTENTIALLY_DANGEROUS)
1823 if ( (pCpu->Param1.fUse & DISUSE_REG_SEG)
1824 && (pCpu->Param1.Base.idxSegReg == DISSELREG_SS))
1832 if ( (pCpu->Param2.fUse & DISUSE_REG_SEG)
1833 && (pCpu->Param2.Base.idxSegReg == USE_REG_SS)
1834 && (pCpu->Param1.fUse & (DISUSE_REG_GEN32|DISUSE_REG_GEN16))) /** @todo memory operand must in theory be handled too */
1837 rc = patmPatchGenMovFromSS(pVM, pPatch, pCpu, pCurInstrGC);
1847 /** @todo broken comparison!! should be if ((pCpu->Param1.fUse & DISUSE_REG_SEG) && (pCpu->Param1.Base.idxSegReg == DISSELREG_SS)) */
1848 if (pCpu->pCurInstr->fParam1 == OP_PARM_REG_SS)
1850 Assert(pCpu->pCurInstr->fOpType & DISOPTYPE_INHIBIT_IRQS);
1866 pNextInstrGC = pCurInstrGC + pCpu->cbInstr;
1873 DISCPUSTATE cpu = *pCpu;
1880 pNextInstrGC = pCurInstrGC + pCpu->cbInstr;
1924 bool fGenerateJmpBack = (pCurInstrGC + pCpu->cbInstr - pInstrGC >= SIZEOF_NEARJUMP32);
1931 rc = patmPatchGenPopf(pVM, pPatch, pCurInstrGC + pCpu->cbInstr, !!(pCpu->fPrefix & DISPREFIX_OPSIZE), fGenerateJmpBack);
1949 rc = patmPatchGenPushf(pVM, pPatch, !!(pCpu->fPrefix & DISPREFIX_OPSIZE));
1955 /** @todo broken comparison!! should be if ((pCpu->Param1.fUse & DISUSE_REG_SEG) && (pCpu->Param1.Base.idxSegReg == DISSELREG_SS)) */
1956 if (pCpu->pCurInstr->fParam1 == OP_PARM_REG_CS)
1967 rc = patmPatchGenIret(pVM, pPatch, pCurInstrGC, !!(pCpu->fPrefix & DISPREFIX_OPSIZE));
1995 rc = patmPatchGenSldtStr(pVM, pPatch, pCpu, pCurInstrGC);
2002 rc = patmPatchGenSxDT(pVM, pPatch, pCpu, pCurInstrGC);
2009 rc = patmPatchGenRet(pVM, pPatch, pCpu, pCurInstrGC);
2016 rc = patmPatchGenDuplicate(pVM, pPatch, pCpu, pCurInstrGC);
2026 Assert(pCpu->Param1.cb == 4 || pCpu->Param1.cb == 6);
2027 if (pPatch->flags & PATMFL_SUPPORT_INDIRECT_CALLS && pCpu->Param1.cb == 4 /* no far calls! */)
2029 rc = patmPatchGenCall(pVM, pPatch, pCpu, pCurInstrGC, (RTRCPTR)0xDEADBEEF, true);
2043 Assert(pCpu->Param1.cb == 4 || pCpu->Param1.cb == 6);
2044 if (pPatch->flags & PATMFL_SUPPORT_INDIRECT_CALLS && pCpu->Param1.cb == 4 /* no far jumps! */)
2046 rc = patmPatchGenJump(pVM, pPatch, pCpu, pCurInstrGC);
2060 if (pCpu->pCurInstr->fParam2 == OP_PARM_Dd)
2062 rc = patmPatchGenMovDebug(pVM, pPatch, pCpu);
2071 if (pCpu->pCurInstr->fParam2 == OP_PARM_Cd)
2073 rc = patmPatchGenMovControl(pVM, pPatch, pCpu);
2081 if (pCpu->pCurInstr->fOpType & (DISOPTYPE_CONTROLFLOW | DISOPTYPE_PRIVILEGED_NOTRAP))
2092 rc = patmPatchGenDuplicate(pVM, pPatch, pCpu, pCurInstrGC);
2105 RTRCPTR pNextInstrGC = pCurInstrGC + pCpu->cbInstr;
2129 && pCurInstrGC + pCpu->cbInstr - pInstrGC >= SIZEOF_NEARJUMP32
2130 && !(pCpu->pCurInstr->fOpType & DISOPTYPE_RELATIVE_CONTROLFLOW)
2134 RTRCPTR pNextInstrGC = pCurInstrGC + pCpu->cbInstr;
2137 Log(("patmRecompileCallback: end found for single instruction patch at %RRv cbInstr %d\n", pNextInstrGC, pCpu->cbInstr));
2192 * @param pCpu CPU disassembly state
2198 int patmr3DisasmCallback(PVM pVM, DISCPUSTATE *pCpu, RCPTRTYPE(uint8_t *) pInstrGC, RCPTRTYPE(uint8_t *) pCurInstrGC, PPATMP2GLOOKUPREC pCacheRec)
2203 if (pCpu->pCurInstr->uOpcode == OP_INT3)
2221 if ( pCpu->pCurInstr->uOpcode == OP_ILLUD2
2228 if ( (pCpu->pCurInstr->uOpcode == OP_CALL && !(pPatch->flags & PATMFL_SUPPORT_CALLS))
2229 || pCpu->pCurInstr->uOpcode == OP_INT
2230 || pCpu->pCurInstr->uOpcode == OP_IRET
2231 || pCpu->pCurInstr->uOpcode == OP_RETN
2232 || pCpu->pCurInstr->uOpcode == OP_RETF
2238 if (pCpu->pCurInstr->uOpcode == OP_ILLUD2)
3647 * @param pCpu Disassembly CPU structure ptr
3652 static int patmReplaceFunctionCall(PVM pVM, DISCPUSTATE *pCpu, RTRCPTR pInstrGC, PPATMP2GLOOKUPREC pCacheRec)
3663 Assert((pCpu->pCurInstr->uOpcode == OP_CALL || pCpu->pCurInstr->uOpcode == OP_JMP) && pCpu->cbInstr == SIZEOF_NEARJUMP32);
3665 if ((pCpu->pCurInstr->uOpcode != OP_CALL && pCpu->pCurInstr->uOpcode != OP_JMP) || pCpu->cbInstr != SIZEOF_NEARJUMP32)
3671 pTargetGC = PATMResolveBranch(pCpu, pInstrGC);
3674 Log(("We don't support far jumps here!! (%08X)\n", pCpu->Param1.fUse));
3729 pPatch->pInstrGCHighest = pInstrGC + pCpu->cbInstr;
3750 * @param pCpu Disassembly CPU structure ptr
3756 static int patmPatchMMIOInstr(PVM pVM, RTRCPTR pInstrGC, DISCPUSTATE *pCpu, PPATMP2GLOOKUPREC pCacheRec)
3766 if (pCpu->Param2.fUse != DISUSE_DISPLACEMENT32)
3774 if (patmPatchAddReloc32(pVM, pPatch, &pPB[pCpu->cbInstr - sizeof(RTRCPTR)], FIXUP_ABSOLUTE, pPatch->pPrivInstrGC,
3789 rc = PGMPhysSimpleDirtyWriteGCPtr(VMMGetCpu0(pVM), pInstrGC + pCpu->cbInstr - sizeof(RTRCPTR),
3922 * @param pCpu Disassembly CPU structure ptr
3928 int patmR3PatchInstrInt3(PVM pVM, RTRCPTR pInstrGC, R3PTRTYPE(uint8_t *) pInstrHC, DISCPUSTATE *pCpu, PPATCHINFO pPatch)
3950 pPatch->pInstrGCHighest = pInstrGC + pCpu->cbInstr;
3968 * @param pCpu Disassembly CPU structure ptr
3974 int patmPatchJump(PVM pVM, RTRCPTR pInstrGC, R3PTRTYPE(uint8_t *) pInstrHC, DISCPUSTATE *pCpu, PPATMPATCHREC pPatchRec)
3988 switch (pCpu->pCurInstr->uOpcode)
4008 Assert(pCpu->Param1.fUse & DISUSE_IMMEDIATE32_REL);
4009 if (!(pCpu->Param1.fUse & DISUSE_IMMEDIATE32_REL))
4012 Assert(pCpu->cbInstr == SIZEOF_NEARJUMP32 || pCpu->cbInstr == SIZEOF_NEAR_COND_JUMP32);
4013 if (pCpu->cbInstr != SIZEOF_NEARJUMP32 && pCpu->cbInstr != SIZEOF_NEAR_COND_JUMP32)
4016 if (PAGE_ADDRESS(pInstrGC) != PAGE_ADDRESS(pInstrGC + pCpu->cbInstr))
4031 Assert(pCpu->cbInstr <= sizeof(pPatch->aPrivInstr));
4032 Assert(pCpu->cbInstr >= SIZEOF_NEARJUMP32);
4033 pPatch->cbPatchJump = pCpu->cbInstr;
4043 RTRCPTR pJmpDest = patmR3GuestGCPtrToPatchGCPtrSimple(pVM, pInstrGC + pCpu->cbInstr + (int32_t)pCpu->Param1.uValue);
4045 AssertMsg(pJmpDest, ("patmR3GuestGCPtrToPatchGCPtrSimple failed for %RRv\n", pInstrGC + pCpu->cbInstr + (int32_t)pCpu->Param1.uValue));