Lines Matching defs:pVM

71 #define PATCHGEN_PROLOG_NODEF(pVM, pPatch, a_cbMaxEmit) \
74 if (RT_LIKELY((pPatch)->pPatchBlockOffset + pPatch->uCurPatchOffset + cbGivenPatchSize < pVM->patm.s.cbPatchMem)) \
78 pVM->patm.s.fOutOfMemory = true; \
81 (pPatch)->pPatchBlockOffset + pPatch->uCurPatchOffset + cbGivenPatchSize, pVM->patm.s.cbPatchMem)); \
86 #define PATCHGEN_PROLOG(pVM, pPatch, a_cbMaxEmit) \
89 PATCHGEN_PROLOG_NODEF(pVM, pPatch, a_cbMaxEmit)
101 int patmPatchAddReloc32(PVM pVM, PPATCHINFO pPatch, uint8_t *pRelocHC, uint32_t uType,
114 LogFlow(("patmPatchAddReloc32 type=%d pRelocGC=%RRv source=%RRv dest=%RRv\n", uType, pRelocHC - pVM->patm.s.pPatchMemGC + pVM->patm.s.pPatchMemGC , pSource, pDest));
116 pRec = (PRELOCREC)MMR3HeapAllocZ(pVM, MM_TAG_PATM_PATCH, sizeof(*pRec));
131 int patmPatchAddJump(PVM pVM, PPATCHINFO pPatch, uint8_t *pJumpHC, uint32_t offset, RTRCPTR pTargetGC, uint32_t opcode)
135 pRec = (PJUMPREC)MMR3HeapAllocZ(pVM, MM_TAG_PATM_PATCH, sizeof(*pRec));
151 static uint32_t patmPatchGenCode(PVM pVM, PPATCHINFO pPatch, uint8_t *pPB, PCPATCHASMRECORD pAsmRecord,
191 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uVMFlags);
194 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uPendingAction);
197 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Psp);
200 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, fPIF);
203 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, GCPtrInhibitInterrupts);
206 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Restore.uEAX);
209 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Restore.uECX);
212 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Restore.uEDI);
215 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Restore.eFlags);
218 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Restore.uFlags);
221 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, GCCallPatchTargetAddr);
224 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, GCCallReturnAddr);
228 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uPatchCalls);
231 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uIretEFlags);
234 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uIretCS);
237 dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uIretEIP);
244 dest = (RTGCUINTPTR32)pVM->patm.s.pPatchMemGC + pAsmRecord->aRelocs[i].uInfo
245 + (RTGCUINTPTR32)(pPB - pVM->patm.s.pPatchMemHC);
250 dest = patmPatchQueryStatAddress(pVM, pPatch);
258 dest = pVM->patm.s.pGCStackGC;
262 dest = pVM->patm.s.pGCStackGC + PATM_STACK_SIZE;
274 dest = (uintptr_t)pPB - (uintptr_t)pVM->patm.s.pPatchMemHC + pAsmRecord->cbFunction;
281 patmPatchAddJump(pVM, pPatch, &pPB[j-1], 1, pCallInfo->pTargetGC, OP_CALL);
286 dest = pVM->patm.s.pPatchMemGC;
303 RTRCPTR pInstrAfterCall = pVM->patm.s.pPatchMemGC
304 + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
305 Assert(pVM->patm.s.pfnHelperCallGC);
309 dest = pVM->patm.s.pfnHelperCallGC - pInstrAfterCall;
315 RTRCPTR pInstrAfterCall = pVM->patm.s.pPatchMemGC
316 + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
317 Assert(pVM->patm.s.pfnHelperRetGC);
321 dest = pVM->patm.s.pfnHelperRetGC - pInstrAfterCall;
327 RTRCPTR pInstrAfterCall = pVM->patm.s.pPatchMemGC
328 + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
329 Assert(pVM->patm.s.pfnHelperIretGC);
333 dest = pVM->patm.s.pfnHelperIretGC - pInstrAfterCall;
339 RTRCPTR pInstrAfterCall = pVM->patm.s.pPatchMemGC
340 + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
341 Assert(pVM->patm.s.pfnHelperJumpGC);
345 dest = pVM->patm.s.pfnHelperJumpGC - pInstrAfterCall;
350 dest = CPUMR3GetGuestCpuIdPatmStdMax(pVM);
353 dest = CPUMR3GetGuestCpuIdPatmExtMax(pVM);
356 dest = CPUMR3GetGuestCpuIdPatmCentaurMax(pVM);
364 dest = pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions);
368 dest = CPUMR3GetGuestCpuIdPatmDefRCPtr(pVM);
371 dest = CPUMR3GetGuestCpuIdPatmStdRCPtr(pVM);
374 dest = CPUMR3GetGuestCpuIdPatmExtRCPtr(pVM);
377 dest = CPUMR3GetGuestCpuIdPatmCentaurRCPtr(pVM);
386 int rc = PDMR3LdrGetSymbolRC(pVM, NULL, "CPUMPatchHlpCpuId", &dest);
407 RTRCUINTPTR RCPtrAfter = pVM->patm.s.pPatchMemGC
408 + (RTRCUINTPTR)(&pPB[j + sizeof(RTRCPTR)] - pVM->patm.s.pPatchMemHC);
416 patmPatchAddReloc32(pVM, pPatch, &pPB[j], uRelocType,
433 patmR3AddP2GLookupRecord(pVM, pPatch, &pPB[pAsmRecord->offJump - 1], pReturnAddrGC, PATM_LOOKUP_PATCH2GUEST);
436 patmPatchAddReloc32(pVM, pPatch, &pPB[pAsmRecord->offJump], FIXUP_REL_JMPTOGUEST,
449 static int patmPatchReadBytes(PVM pVM, uint8_t *pDest, RTRCPTR pSrc, uint32_t cb)
451 int rc = PGMPhysSimpleReadGCPtr(&pVM->aCpus[0], pDest, pSrc, cb);
460 int rc2 = PATMR3QueryOpcode(pVM, pSrc+i, &temp);
471 int patmPatchGenDuplicate(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RCPTRTYPE(uint8_t *) pCurInstrGC)
474 PATCHGEN_PROLOG(pVM, pPatch, cbInstrShutUpGcc);
476 int rc = patmPatchReadBytes(pVM, pPB, pCurInstrGC, cbInstrShutUpGcc);
482 int patmPatchGenIret(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC, bool fSizeOverride)
486 PCPATCHASMRECORD pPatchAsmRec = EMIsRawRing1Enabled(pVM) ? &g_patmIretRing1Record : &g_patmIretRecord;
488 PATCHGEN_PROLOG(pVM, pPatch, pPatchAsmRec->cbFunction);
493 size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false, &callInfo);
499 int patmPatchGenCli(PVM pVM, PPATCHINFO pPatch)
502 PATCHGEN_PROLOG(pVM, pPatch, g_patmCliRecord.cbFunction);
504 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmCliRecord, 0, false);
513 int patmPatchGenSti(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC, RTRCPTR pNextInstrGC)
519 PATCHGEN_PROLOG(pVM, pPatch, g_patmStiRecord.cbFunction);
521 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmStiRecord, 0, false, &callInfo);
528 int patmPatchGenPopf(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pReturnAddrGC, bool fSizeOverride, bool fGenJumpBack)
538 PATCHGEN_PROLOG(pVM, pPatch, pPatchAsmRec->cbFunction);
547 size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, pReturnAddrGC, fGenJumpBack, &callInfo);
550 STAM_COUNTER_INC(&pVM->patm.s.StatGenPopf);
554 int patmPatchGenPushf(PVM pVM, PPATCHINFO pPatch, bool fSizeOverride)
558 PATCHGEN_PROLOG(pVM, pPatch, pPatchAsmRec->cbFunction);
560 size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false);
566 int patmPatchGenPushCS(PVM pVM, PPATCHINFO pPatch)
569 PATCHGEN_PROLOG(pVM, pPatch, g_patmPushCSRecord.cbFunction);
570 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmPushCSRecord, 0, false);
575 int patmPatchGenLoop(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pTargetGC, uint32_t opcode, bool fSizeOverride)
599 PATCHGEN_PROLOG(pVM, pPatch, pPatchAsmRec->cbFunction);
603 size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false);
612 patmPatchAddJump(pVM, pPatch, &pPB[pPatchAsmRec->offRelJump - 1], 1, pTargetGC, opcode);
618 int patmPatchGenRelJump(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pTargetGC, uint32_t opcode, bool fSizeOverride)
621 PATCHGEN_PROLOG(pVM, pPatch, PATCHGEN_DEF_SIZE);
625 Assert(PATMIsPatchGCAddr(pVM, pTargetGC) == false);
681 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pTargetGC, PATM_LOOKUP_PATCH2GUEST);
690 return patmPatchGenLoop(pVM, pPatch, pTargetGC, opcode, fSizeOverride);
705 patmPatchAddJump(pVM, pPatch, pPB, offset, pTargetGC, opcode);
716 int patmPatchGenCall(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCurInstrGC, RTRCPTR pTargetGC, bool fIndirect)
727 rc = patmPatchGenClearPIF(pVM, pPatch, pCurInstrGC);
732 PATCHGEN_PROLOG(pVM, pPatch, PATCHGEN_DEF_SIZE);
756 rc = patmPatchReadBytes(pVM, &pPB[offset], (RTRCPTR)((RTGCUINTPTR32)pCurInstrGC + i), pCpu->cbInstr - i);
762 AssertMsg(PATMIsPatchGCAddr(pVM, pTargetGC) == false, ("Target is already a patch address (%RRv)?!?\n", pTargetGC));
793 PATCHGEN_PROLOG_NODEF(pVM, pPatch, pPatchAsmRec->cbFunction);
796 size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false, &callInfo);
800 rc = patmPatchGenSetPIF(pVM, pPatch, pCurInstrGC);
805 STAM_COUNTER_INC(&pVM->patm.s.StatGenCall);
813 * @param pVM Pointer to the VM.
818 int patmPatchGenJump(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCurInstrGC)
826 rc = patmPatchGenClearPIF(pVM, pPatch, pCurInstrGC);
831 PATCHGEN_PROLOG(pVM, pPatch, PATCHGEN_DEF_SIZE);
854 rc = patmPatchReadBytes(pVM, &pPB[offset], (RTRCPTR)((RTGCUINTPTR32)pCurInstrGC + i), pCpu->cbInstr - i);
870 PATCHGEN_PROLOG_NODEF(pVM, pPatch, g_patmJumpIndirectRecord.cbFunction);
873 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmJumpIndirectRecord, 0, false, &callInfo);
876 STAM_COUNTER_INC(&pVM->patm.s.StatGenJump);
884 * @param pVM Pointer to the VM.
890 int patmPatchGenRet(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RCPTRTYPE(uint8_t *) pCurInstrGC)
904 STAM_COUNTER_INC(&pVM->patm.s.StatGenRetReused);
906 return patmPatchGenPatchJump(pVM, pPatch, pCurInstrGC, pPatch->pTempInfo->pPatchRetInstrGC);
910 Assert(!patmFindActivePatchByEntrypoint(pVM, pCurInstrGC));
911 int rc = patmPatchGenCheckIF(pVM, pPatch, pCurInstrGC);
915 PATCHGEN_PROLOG(pVM, pPatch, 4);
924 PATCHGEN_PROLOG_NODEF(pVM, pPatch, g_patmRetRecord.cbFunction);
925 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmRetRecord, 0, false);
928 STAM_COUNTER_INC(&pVM->patm.s.StatGenRet);
930 rc = patmPatchGenDuplicate(pVM, pPatch, pCpu, pCurInstrGC);
944 * @param pVM Pointer to the VM.
948 int patmPatchGenGlobalFunctions(PVM pVM, PPATCHINFO pPatch)
950 pVM->patm.s.pfnHelperCallGC = PATCHCODE_PTR_GC(pPatch) + pPatch->uCurPatchOffset;
951 PATCHGEN_PROLOG(pVM, pPatch, g_patmLookupAndCallRecord.cbFunction);
952 uint32_t size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmLookupAndCallRecord, 0, false);
958 pVM->patm.s.pfnHelperRetGC = PATCHCODE_PTR_GC(pPatch) + pPatch->uCurPatchOffset;
959 PATCHGEN_PROLOG_NODEF(pVM, pPatch, g_patmRetFunctionRecord.cbFunction);
960 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmRetFunctionRecord, 0, false);
966 pVM->patm.s.pfnHelperJumpGC = PATCHCODE_PTR_GC(pPatch) + pPatch->uCurPatchOffset;
967 PATCHGEN_PROLOG_NODEF(pVM, pPatch, g_patmLookupAndJumpRecord.cbFunction);
968 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmLookupAndJumpRecord, 0, false);
974 pVM->patm.s.pfnHelperIretGC = PATCHCODE_PTR_GC(pPatch) + pPatch->uCurPatchOffset;
975 PATCHGEN_PROLOG_NODEF(pVM, pPatch, g_patmIretFunctionRecord.cbFunction);
976 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmIretFunctionRecord, 0, false);
979 Log(("pfnHelperCallGC %RRv\n", pVM->patm.s.pfnHelperCallGC));
980 Log(("pfnHelperRetGC %RRv\n", pVM->patm.s.pfnHelperRetGC));
981 Log(("pfnHelperJumpGC %RRv\n", pVM->patm.s.pfnHelperJumpGC));
982 Log(("pfnHelperIretGC %RRv\n", pVM->patm.s.pfnHelperIretGC));
991 * @param pVM Pointer to the VM.
995 int patmPatchGenIllegalInstr(PVM pVM, PPATCHINFO pPatch)
997 PATCHGEN_PROLOG(pVM, pPatch, 1);
1009 * @param pVM Pointer to the VM.
1014 int patmPatchGenCheckIF(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC)
1018 PATCHGEN_PROLOG(pVM, pPatch, g_patmCheckIFRecord.cbFunction);
1021 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pCurInstrGC, PATM_LOOKUP_PATCH2GUEST);
1024 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmCheckIFRecord, pCurInstrGC, true);
1034 * @param pVM Pointer to the VM.
1039 int patmPatchGenSetPIF(PVM pVM, PPATCHINFO pPatch, RTRCPTR pInstrGC)
1041 PATCHGEN_PROLOG(pVM, pPatch, g_patmSetPIFRecord.cbFunction);
1044 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pInstrGC, PATM_LOOKUP_PATCH2GUEST);
1046 uint32_t size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmSetPIFRecord, 0, false);
1055 * @param pVM Pointer to the VM.
1060 int patmPatchGenClearPIF(PVM pVM, PPATCHINFO pPatch, RTRCPTR pInstrGC)
1062 PATCHGEN_PROLOG(pVM, pPatch, g_patmSetPIFRecord.cbFunction);
1065 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pInstrGC, PATM_LOOKUP_PATCH2GUEST);
1067 uint32_t size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmClearPIFRecord, 0, false);
1077 * @param pVM Pointer to the VM.
1081 int patmPatchGenClearInhibitIRQ(PVM pVM, PPATCHINFO pPatch, RTRCPTR pNextInstrGC)
1086 PATCHGEN_PROLOG(pVM, pPatch, pPatchAsmRec->cbFunction);
1091 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pNextInstrGC, PATM_LOOKUP_PATCH2GUEST);
1095 uint32_t size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false, &callInfo);
1105 * @param pVM Pointer to the VM.
1111 int patmPatchGenIntEntry(PVM pVM, PPATCHINFO pPatch, RTRCPTR pIntHandlerGC)
1115 if (!EMIsRawRing1Enabled(pVM)) /* direct passthru of interrupts is not allowed in the ring-1 support case as we can't
1122 PATCHGEN_PROLOG(pVM, pPatch, pPatchAsmRec->cbFunction);
1125 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pIntHandlerGC, PATM_LOOKUP_PATCH2GUEST);
1128 size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false);
1134 rc = patmPatchGenCli(pVM, pPatch);
1144 * @param pVM Pointer to the VM.
1148 int patmPatchGenTrapEntry(PVM pVM, PPATCHINFO pPatch, RTRCPTR pTrapHandlerGC)
1154 Assert(!EMIsRawRing1Enabled(pVM));
1156 PATCHGEN_PROLOG(pVM, pPatch, pPatchAsmRec->cbFunction);
1159 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pTrapHandlerGC, PATM_LOOKUP_PATCH2GUEST);
1162 size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, pTrapHandlerGC, true);
1169 int patmPatchGenStats(PVM pVM, PPATCHINFO pPatch, RTRCPTR pInstrGC)
1173 PATCHGEN_PROLOG(pVM, pPatch, g_patmStatsRecord.cbFunction);
1176 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pInstrGC, PATM_LOOKUP_PATCH2GUEST);
1179 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmStatsRecord, pInstrGC, false);
1194 int patmPatchGenMovDebug(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu)
1200 PATCHGEN_PROLOG(pVM, pPatch, PATCHGEN_DEF_SIZE);
1232 *(RTRCPTR *)&pPB[2] = pVM->patm.s.pCPUMCtxGC + offset;
1233 patmPatchAddReloc32(pVM, pPatch, &pPB[2], FIXUP_ABSOLUTE);
1244 int patmPatchGenMovControl(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu)
1250 PATCHGEN_PROLOG(pVM, pPatch, PATCHGEN_DEF_SIZE);
1298 *(RTRCPTR *)&pPB[2] = pVM->patm.s.pCPUMCtxGC + offset;
1299 patmPatchAddReloc32(pVM, pPatch, &pPB[2], FIXUP_ABSOLUTE);
1308 int patmPatchGenMovFromSS(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCurInstrGC)
1316 PATCHGEN_PROLOG(pVM, pPatch, g_patmClearPIFRecord.cbFunction + 2 + g_patmMovFromSSRecord.cbFunction + 2 + g_patmSetPIFRecord.cbFunction);
1317 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmClearPIFRecord, 0, false);
1321 PATCHGEN_PROLOG_NODEF(pVM, pPatch, 2);
1329 PATCHGEN_PROLOG_NODEF(pVM, pPatch, g_patmMovFromSSRecord.cbFunction);
1330 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmMovFromSSRecord, 0, false);
1334 PATCHGEN_PROLOG_NODEF(pVM, pPatch, 2);
1342 PATCHGEN_PROLOG_NODEF(pVM, pPatch, g_patmSetPIFRecord.cbFunction);
1343 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmSetPIFRecord, 0, false);
1354 * @param pVM Pointer to the VM.
1359 int patmPatchGenSldtStr(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCurInstrGC)
1369 PATCHGEN_PROLOG(pVM, pPatch, PATCHGEN_DEF_SIZE);
1384 *(RTRCPTR *)&pPB[offset] = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, tr);
1388 *(RTRCPTR *)&pPB[offset] = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, ldtr);
1390 patmPatchAddReloc32(pVM, pPatch, &pPB[offset], FIXUP_ABSOLUTE);
1421 rc = patmPatchReadBytes(pVM, &pPB[offset], (RTRCPTR)((RTGCUINTPTR32)pCurInstrGC + i), pCpu->cbInstr - i);
1429 *(RTRCPTR *)&pPB[offset] = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, tr);
1433 *(RTRCPTR *)&pPB[offset] = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, ldtr);
1435 patmPatchAddReloc32(pVM, pPatch, &pPB[offset], FIXUP_ABSOLUTE);
1455 * @param pVM Pointer to the VM.
1460 int patmPatchGenSxDT(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCurInstrGC)
1498 PATCHGEN_PROLOG(pVM, pPatch, PATCHGEN_DEF_SIZE);
1515 rc = patmPatchReadBytes(pVM, &pPB[offset], (RTRCPTR)((RTGCUINTPTR32)pCurInstrGC + i), pCpu->cbInstr - i);
1521 *(RTRCPTR *)&pPB[offset] = pVM->patm.s.pCPUMCtxGC + offset_limit;
1522 patmPatchAddReloc32(pVM, pPatch, &pPB[offset], FIXUP_ABSOLUTE);
1530 *(RTRCPTR *)&pPB[offset] = pVM->patm.s.pCPUMCtxGC + offset_base;
1531 patmPatchAddReloc32(pVM, pPatch, &pPB[offset], FIXUP_ABSOLUTE);
1550 * @param pVM Pointer to the VM.
1554 int patmPatchGenCpuid(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC)
1557 PATCHGEN_PROLOG(pVM, pPatch, g_patmCpuidRecord.cbFunction);
1559 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmCpuidRecord, 0, false);
1570 * @param pVM Pointer to the VM.
1575 int patmPatchGenJumpToGuest(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pReturnAddrGC, bool fClearInhibitIRQs)
1582 rc = patmPatchGenClearInhibitIRQ(pVM, pPatch, pReturnAddrGC);
1588 PATCHGEN_PROLOG(pVM, pPatch, PATMJumpToGuest_IF1Record.cbFunction);
1591 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pReturnAddrGC, PATM_LOOKUP_PATCH2GUEST);
1594 size = patmPatchGenCode(pVM, pPatch, pPB, &PATMJumpToGuest_IF1Record, pReturnAddrGC, true);
1603 int patmPatchGenPatchJump(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC, RCPTRTYPE(uint8_t *) pPatchAddrGC, bool fAddLookupRecord)
1608 Assert(PATMIsPatchGCAddr(pVM, pPatchAddrGC));
1609 PATCHGEN_PROLOG(pVM, pPatch, SIZEOF_NEARJUMP32);
1614 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pCurInstrGC, PATM_LOOKUP_PATCH2GUEST);