Lines Matching defs:pPB
75 pPB = PATCHCODE_PTR_HC(pPatch) + pPatch->uCurPatchOffset; \
87 uint8_t *pPB; \
151 static uint32_t patmPatchGenCode(PVM pVM, PPATCHINFO pPatch, uint8_t *pPB, PCPATCHASMRECORD pAsmRecord,
161 memcpy(pPB, pAsmRecord->pbFunction, pAsmRecord->cbFunction);
169 if (*(uint32_t*)&pPB[j] == pAsmRecord->aRelocs[i].uType)
245 + (RTGCUINTPTR32)(pPB - pVM->patm.s.pPatchMemHC);
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);
304 + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
316 + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
328 + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
340 + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
408 + (RTRCUINTPTR)(&pPB[j + sizeof(RTRCPTR)] - pVM->patm.s.pPatchMemHC);
412 *(PRTRCPTR)&pPB[j] = dest;
416 patmPatchAddReloc32(pVM, pPatch, &pPB[j], uRelocType,
432 Assert(pPB[pAsmRecord->offJump - 1] == 0xE9);
433 patmR3AddP2GLookupRecord(pVM, pPatch, &pPB[pAsmRecord->offJump - 1], pReturnAddrGC, PATM_LOOKUP_PATCH2GUEST);
435 *(uint32_t *)&pPB[pAsmRecord->offJump] = displ;
436 patmPatchAddReloc32(pVM, pPatch, &pPB[pAsmRecord->offJump], FIXUP_REL_JMPTOGUEST,
476 int rc = patmPatchReadBytes(pVM, pPB, pCurInstrGC, cbInstrShutUpGcc);
493 size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false, &callInfo);
504 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmCliRecord, 0, false);
521 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmStiRecord, 0, false, &callInfo);
547 size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, pReturnAddrGC, fGenJumpBack, &callInfo);
560 size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false);
570 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmPushCSRecord, 0, false);
603 size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false);
607 pPB[pPatchAsmRec->offSizeOverride] = 0x66; // ecx -> cx or vice versa
610 *(RTRCPTR *)&pPB[pPatchAsmRec->offRelJump] = 0xDEADBEEF;
612 patmPatchAddJump(pVM, pPatch, &pPB[pPatchAsmRec->offRelJump - 1], 1, pTargetGC, opcode);
630 pPB[1] = 0x80;
633 pPB[1] = 0x81;
636 pPB[1] = 0x82;
639 pPB[1] = 0x83;
642 pPB[1] = 0x84;
645 pPB[1] = 0x85;
648 pPB[1] = 0x86;
651 pPB[1] = 0x87;
654 pPB[1] = 0x88;
657 pPB[1] = 0x89;
660 pPB[1] = 0x8A;
663 pPB[1] = 0x8B;
666 pPB[1] = 0x8C;
669 pPB[1] = 0x8D;
672 pPB[1] = 0x8E;
675 pPB[1] = 0x8F;
681 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pTargetGC, PATM_LOOKUP_PATCH2GUEST);
683 pPB[0] = 0xE9;
698 pPB[0] = 0xF;
703 *(RTRCPTR *)&pPB[offset] = 0xDEADBEEF;
705 patmPatchAddJump(pVM, pPatch, pPB, offset, pTargetGC, opcode);
747 pPB[offset++] = DISQuerySegPrefixByte(pCpu);
748 pPB[offset++] = 0xFF; // push r/m32
749 pPB[offset++] = MAKE_MODRM(pCpu->ModRM.Bits.Mod, 6 /* group 5 */, pCpu->ModRM.Bits.Rm);
756 rc = patmPatchReadBytes(pVM, &pPB[offset], (RTRCPTR)((RTGCUINTPTR32)pCurInstrGC + i), pCpu->cbInstr - i);
775 pPB[offset++] = 0x68; // push %Iv
776 *(RTRCPTR *)&pPB[offset] = pTargetGC;
781 size = (RTHCUINTPTR)&pPB[offset] & 3;
787 pPB[offset++] = 0x90; /* nop */
796 size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false, &callInfo);
844 pPB[offset++] = DISQuerySegPrefixByte(pCpu);
846 pPB[offset++] = 0xFF; // push r/m32
847 pPB[offset++] = MAKE_MODRM(pCpu->ModRM.Bits.Mod, 6 /* group 5 */, pCpu->ModRM.Bits.Rm);
854 rc = patmPatchReadBytes(pVM, &pPB[offset], (RTRCPTR)((RTGCUINTPTR32)pCurInstrGC + i), pCpu->cbInstr - i);
859 size = (RTHCUINTPTR)&pPB[offset] & 3;
865 pPB[offset++] = 0x90; /* nop */
873 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmJumpIndirectRecord, 0, false, &callInfo);
916 uint32_t size = (RTHCUINTPTR)pPB & 3;
921 pPB[i] = 0x90; /* nop */
925 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmRetRecord, 0, false);
952 uint32_t size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmLookupAndCallRecord, 0, false);
960 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmRetFunctionRecord, 0, false);
968 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmLookupAndJumpRecord, 0, false);
976 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmIretFunctionRecord, 0, false);
999 pPB[0] = 0xCC;
1021 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pCurInstrGC, PATM_LOOKUP_PATCH2GUEST);
1024 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmCheckIFRecord, pCurInstrGC, true);
1044 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pInstrGC, PATM_LOOKUP_PATCH2GUEST);
1046 uint32_t size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmSetPIFRecord, 0, false);
1065 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pInstrGC, PATM_LOOKUP_PATCH2GUEST);
1067 uint32_t size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmClearPIFRecord, 0, false);
1091 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pNextInstrGC, PATM_LOOKUP_PATCH2GUEST);
1095 uint32_t size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false, &callInfo);
1125 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pIntHandlerGC, PATM_LOOKUP_PATCH2GUEST);
1128 size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false);
1159 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pTrapHandlerGC, PATM_LOOKUP_PATCH2GUEST);
1162 size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, pTrapHandlerGC, true);
1176 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pInstrGC, PATM_LOOKUP_PATCH2GUEST);
1179 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmStatsRecord, pInstrGC, false);
1209 pPB[0] = 0x89; //mov disp32, GPR
1222 pPB[0] = 0x8B; // mov GPR, disp32
1227 pPB[1] = MAKE_MODRM(mod, reg, rm);
1232 *(RTRCPTR *)&pPB[2] = pVM->patm.s.pCPUMCtxGC + offset;
1233 patmPatchAddReloc32(pVM, pPatch, &pPB[2], FIXUP_ABSOLUTE);
1259 pPB[0] = 0x89; //mov disp32, GPR
1271 pPB[0] = 0x8B; // mov GPR, disp32
1276 pPB[1] = MAKE_MODRM(mod, reg, rm);
1298 *(RTRCPTR *)&pPB[2] = pVM->patm.s.pCPUMCtxGC + offset;
1299 patmPatchAddReloc32(pVM, pPatch, &pPB[2], FIXUP_ABSOLUTE);
1317 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmClearPIFRecord, 0, false);
1324 pPB[offset++] = 0x66; /* size override -> 16 bits push */
1325 pPB[offset++] = 0x16;
1330 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmMovFromSSRecord, 0, false);
1337 pPB[offset++] = 0x66; /* size override -> 16 bits pop */
1338 pPB[offset++] = 0x58 + pCpu->Param1.Base.idxGenReg;
1343 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmSetPIFRecord, 0, false);
1377 pPB[offset++] = 0x66;
1379 pPB[offset++] = 0x8B; // mov destreg, CPUMCTX.tr/ldtr
1381 pPB[offset++] = MAKE_MODRM(0, pCpu->Param1.Base.idxGenReg, 5);
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);
1404 pPB[offset++] = 0x50; // push eax
1405 pPB[offset++] = 0x52; // push edx
1409 pPB[offset++] = DISQuerySegPrefixByte(pCpu);
1411 pPB[offset++] = 0x8D; // lea edx, dword ptr [dest]
1413 pPB[offset++] = MAKE_MODRM(pCpu->ModRM.Bits.Mod, DISGREG_EDX , pCpu->ModRM.Bits.Rm);
1421 rc = patmPatchReadBytes(pVM, &pPB[offset], (RTRCPTR)((RTGCUINTPTR32)pCurInstrGC + i), pCpu->cbInstr - i);
1425 pPB[offset++] = 0x66; // mov ax, CPUMCTX.tr/ldtr
1426 pPB[offset++] = 0xA1;
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);
1438 pPB[offset++] = 0x66; // mov word ptr [edx],ax
1439 pPB[offset++] = 0x89;
1440 pPB[offset++] = 0x02;
1442 pPB[offset++] = 0x5A; // pop edx
1443 pPB[offset++] = 0x58; // pop eax
1499 pPB[offset++] = 0x50; // push eax
1500 pPB[offset++] = 0x52; // push edx
1504 pPB[offset++] = DISQuerySegPrefixByte(pCpu);
1506 pPB[offset++] = 0x8D; // lea edx, dword ptr [dest]
1508 pPB[offset++] = MAKE_MODRM(pCpu->ModRM.Bits.Mod, DISGREG_EDX , pCpu->ModRM.Bits.Rm);
1515 rc = patmPatchReadBytes(pVM, &pPB[offset], (RTRCPTR)((RTGCUINTPTR32)pCurInstrGC + i), pCpu->cbInstr - i);
1519 pPB[offset++] = 0x66; // mov ax, CPUMCTX.gdtr.limit
1520 pPB[offset++] = 0xA1;
1521 *(RTRCPTR *)&pPB[offset] = pVM->patm.s.pCPUMCtxGC + offset_limit;
1522 patmPatchAddReloc32(pVM, pPatch, &pPB[offset], FIXUP_ABSOLUTE);
1525 pPB[offset++] = 0x66; // mov word ptr [edx],ax
1526 pPB[offset++] = 0x89;
1527 pPB[offset++] = 0x02;
1529 pPB[offset++] = 0xA1; // mov eax, CPUMCTX.gdtr.base
1530 *(RTRCPTR *)&pPB[offset] = pVM->patm.s.pCPUMCtxGC + offset_base;
1531 patmPatchAddReloc32(pVM, pPatch, &pPB[offset], FIXUP_ABSOLUTE);
1534 pPB[offset++] = 0x89; // mov dword ptr [edx+2],eax
1535 pPB[offset++] = 0x42;
1536 pPB[offset++] = 0x02;
1538 pPB[offset++] = 0x5A; // pop edx
1539 pPB[offset++] = 0x58; // pop eax
1559 size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmCpuidRecord, 0, false);
1591 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pReturnAddrGC, PATM_LOOKUP_PATCH2GUEST);
1594 size = patmPatchGenCode(pVM, pPatch, pPB, &PATMJumpToGuest_IF1Record, pReturnAddrGC, true);
1614 patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pCurInstrGC, PATM_LOOKUP_PATCH2GUEST);
1617 pPB[0] = 0xE9; //JMP
1621 *(uint32_t *)&pPB[1] = displ;