Lines Matching defs:pSwitcher
144 * @param pSwitcher The switcher descriptor.
148 static void vmmR3Switcher32On64IdtInit(PVM pVM, PVMMSWITCHERDEF pSwitcher, uint8_t *pbDst, RTHCPHYS HCPhysDst)
150 AssertRelease(pSwitcher->offGCCode > 0 && pSwitcher->offGCCode < pSwitcher->cbCode);
151 AssertRelease(pSwitcher->cbCode < _64K);
154 PX86DESC64GATE paIdt = (PX86DESC64GATE)(pbDst + pSwitcher->offGCCode);
157 AssertRelease(((uint64_t *)&paIdt[i])[0] < pSwitcher->cbCode);
174 uint64_t uIdtr = HCPhysDst + pSwitcher->offGCCode; AssertRelease(uIdtr < UINT32_MAX);
184 * @param pSwitcher The switcher descriptor.
188 static void vmmR3Switcher32On64IdtRelocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, uint8_t *pbDst, RTHCPHYS HCPhysDst)
190 AssertRelease(pSwitcher->offGCCode > 0 && pSwitcher->offGCCode < pSwitcher->cbCode && pSwitcher->cbCode < _64K);
194 PX86DESC64GATE paIdt = (PX86DESC64GATE)(pbDst + pSwitcher->offGCCode);
201 uint64_t uIdtr = HCPhysDst + pSwitcher->offGCCode; AssertRelease(uIdtr < UINT32_MAX);
231 PVMMSWITCHERDEF pSwitcher = papSwitchers[iSwitcher];
232 if (pSwitcher)
234 AssertRelease((unsigned)pSwitcher->enmType == iSwitcher);
235 cbCoreCode += RT_ALIGN_32(pSwitcher->cbCode + 1, 32);
303 PVMMSWITCHERDEF pSwitcher = papSwitchers[iSwitcher];
304 if (pSwitcher)
307 memcpy(pbDst, pSwitcher->pvCode, pSwitcher->cbCode);
309 if ( pSwitcher->enmType == VMMSWITCHER_32_TO_AMD64
310 || pSwitcher->enmType == VMMSWITCHER_PAE_TO_AMD64)
311 vmmR3Switcher32On64IdtInit(pVM, pSwitcher, pbDst,
371 PVMMSWITCHERDEF pSwitcher = papSwitchers[iSwitcher];
372 if (pSwitcher && pSwitcher->pfnRelocate)
375 pSwitcher->pfnRelocate(pVM,
376 pSwitcher,
382 if ( pSwitcher->enmType == VMMSWITCHER_32_TO_AMD64
383 || pSwitcher->enmType == VMMSWITCHER_PAE_TO_AMD64)
384 vmmR3Switcher32On64IdtRelocate(pVM, pSwitcher,
394 PVMMSWITCHERDEF pSwitcher = papSwitchers[pVM->vmm.s.enmSwitcher];
395 if (pSwitcher)
398 pVM->vmm.s.pfnRCToHost = RCPtr + pSwitcher->offRCToHost;
399 pVM->vmm.s.pfnCallTrampolineRC = RCPtr + pSwitcher->offRCCallTrampoline;
400 pVM->pfnVMMRCToHostAsm = RCPtr + pSwitcher->offRCToHostAsm;
401 pVM->pfnVMMRCToHostAsmNoReturn = RCPtr + pSwitcher->offRCToHostAsmNoReturn;
419 * @param pSwitcher The switcher definition.
430 static void vmmR3SwitcherGenericRelocate(PVM pVM, PVMMSWITCHERDEF pSwitcher,
443 u.pv = pSwitcher->pvFixups;
455 Assert(offSrc < pSwitcher->cbCode);
474 Assert(offSrc - pSwitcher->offHCCode0 < pSwitcher->cbHCCode0 || offSrc - pSwitcher->offHCCode1 < pSwitcher->cbHCCode1);
476 Assert(offTrg - pSwitcher->offGCCode < pSwitcher->cbGCCode);
486 Assert(offSrc - pSwitcher->offHCCode0 < pSwitcher->cbHCCode0 || offSrc - pSwitcher->offHCCode1 < pSwitcher->cbHCCode1);
488 Assert(offTrg - pSwitcher->offIDCode0 < pSwitcher->cbIDCode0 || offTrg - pSwitcher->offIDCode1 < pSwitcher->cbIDCode1);
498 Assert(offSrc - pSwitcher->offGCCode < pSwitcher->cbGCCode);
500 Assert(offTrg - pSwitcher->offHCCode0 < pSwitcher->cbHCCode0 || offTrg - pSwitcher->offHCCode1 < pSwitcher->cbHCCode1);
510 AssertMsg(offSrc - pSwitcher->offGCCode < pSwitcher->cbGCCode, ("%x - %x < %x\n", offSrc, pSwitcher->offGCCode, pSwitcher->cbGCCode));
512 Assert(offTrg - pSwitcher->offIDCode0 < pSwitcher->cbIDCode0 || offTrg - pSwitcher->offIDCode1 < pSwitcher->cbIDCode1);
522 Assert(offSrc - pSwitcher->offIDCode0 < pSwitcher->cbIDCode0 || offSrc - pSwitcher->offIDCode1 < pSwitcher->cbIDCode1);
524 Assert(offTrg - pSwitcher->offHCCode0 < pSwitcher->cbHCCode0 || offTrg - pSwitcher->offHCCode1 < pSwitcher->cbHCCode1);
534 Assert(offSrc - pSwitcher->offIDCode0 < pSwitcher->cbIDCode0 || offSrc - pSwitcher->offIDCode1 < pSwitcher->cbIDCode1);
536 Assert(offTrg - pSwitcher->offGCCode < pSwitcher->cbGCCode);
547 Assert(offTrg - pSwitcher->offGCCode < pSwitcher->cbGCCode);
699 Assert(offTrg < pSwitcher->cbCode);
707 *uSrc.pu8++ = *((uint8_t *)pSwitcher->pvCode + offSrc);
708 *uSrc.pu32++ = *(uint32_t *)((uint8_t *)pSwitcher->pvCode + offSrc + 1);
720 Assert(offTrg < pSwitcher->cbCode);
728 *uSrc.pu8++ = *((uint8_t *)pSwitcher->pvCode + offSrc);
729 *uSrc.pu32++ = *(uint32_t *)((uint8_t *)pSwitcher->pvCode + offSrc + 1);
740 Assert(offTrg < pSwitcher->cbCode);
748 *uSrc.pu8++ = *((uint8_t *)pSwitcher->pvCode + offSrc);
749 *uSrc.pu32++ = *(uint32_t *)((uint8_t *)pSwitcher->pvCode + offSrc + 1);
760 Assert(offSrc < pSwitcher->cbCode);
761 Assert(offTrg - pSwitcher->offHCCode0 < pSwitcher->cbHCCode0 || offTrg - pSwitcher->offHCCode1 < pSwitcher->cbHCCode1);
772 Assert(offSrc < pSwitcher->cbCode);
786 Assert(offSrc < pSwitcher->cbCode);
797 Assert(offSrc < pSwitcher->cbCode);
798 Assert(offTrg - pSwitcher->offHCCode0 < pSwitcher->cbHCCode0 || offTrg - pSwitcher->offHCCode1 < pSwitcher->cbHCCode1);
819 Assert(offSrc < pSwitcher->cbCode);
820 Assert(offTrg - pSwitcher->offIDCode0 < pSwitcher->cbIDCode0 || offTrg - pSwitcher->offIDCode1 < pSwitcher->cbIDCode1);
832 Assert(offSrc < pSwitcher->cbCode);
833 Assert(u8 == FIX_HC_64BIT_NOCHECK || offTrg - pSwitcher->offIDCode0 < pSwitcher->cbIDCode0 || offTrg - pSwitcher->offIDCode1 < pSwitcher->cbIDCode1);
844 Assert(offSrc < pSwitcher->cbCode);
845 Assert(offTrg - pSwitcher->offIDCode0 < pSwitcher->cbIDCode0 || offTrg - pSwitcher->offIDCode1 < pSwitcher->cbIDCode1);
864 AssertReleaseMsgFailed(("Unknown fixup %d in switcher %s\n", u8, pSwitcher->pszDesc));
893 pSwitcher->enmType, pSwitcher->pszDesc, pSwitcher->cbCode,
908 while (offCode < pSwitcher->cbCode)
916 if (offCode - pSwitcher->offHCCode0 < pSwitcher->cbHCCode0)
920 offCode = pSwitcher->offHCCode0;
921 cbCode = pSwitcher->cbHCCode0;
923 else if (offCode - pSwitcher->offHCCode1 < pSwitcher->cbHCCode1)
927 offCode = pSwitcher->offHCCode1;
928 cbCode = pSwitcher->cbHCCode1;
930 else if (offCode - pSwitcher->offGCCode < pSwitcher->cbGCCode)
934 offCode = pSwitcher->offGCCode;
935 cbCode = pSwitcher->cbGCCode;
937 else if (offCode - pSwitcher->offIDCode0 < pSwitcher->cbIDCode0)
941 offCode = pSwitcher->offIDCode0;
942 cbCode = pSwitcher->cbIDCode0;
944 else if (offCode - pSwitcher->offIDCode1 < pSwitcher->cbIDCode1)
948 offCode = pSwitcher->offIDCode1;
949 cbCode = pSwitcher->cbIDCode1;
967 if (pSwitcher->offR0ToRawMode == offCode)
969 if (pSwitcher->offRCToHost == offCode)
971 if (pSwitcher->offRCCallTrampoline == offCode)
973 if (pSwitcher->offRCToHostAsm == offCode)
975 if (pSwitcher->offRCToHostAsmNoReturn == offCode)
1027 DECLCALLBACK(void) vmmR3Switcher32BitTo32Bit_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IDCode)
1029 vmmR3SwitcherGenericRelocate(pVM, pSwitcher, R0PtrCode, pu8CodeR3, GCPtrCode, u32IDCode,
1037 DECLCALLBACK(void) vmmR3Switcher32BitToPAE_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IDCode)
1039 vmmR3SwitcherGenericRelocate(pVM, pSwitcher, R0PtrCode, pu8CodeR3, GCPtrCode, u32IDCode,
1047 DECLCALLBACK(void) vmmR3Switcher32BitToAMD64_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IDCode)
1049 vmmR3SwitcherGenericRelocate(pVM, pSwitcher, R0PtrCode, pu8CodeR3, GCPtrCode, u32IDCode,
1057 DECLCALLBACK(void) vmmR3SwitcherPAETo32Bit_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IDCode)
1059 vmmR3SwitcherGenericRelocate(pVM, pSwitcher, R0PtrCode, pu8CodeR3, GCPtrCode, u32IDCode,
1067 DECLCALLBACK(void) vmmR3SwitcherPAEToPAE_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IDCode)
1069 vmmR3SwitcherGenericRelocate(pVM, pSwitcher, R0PtrCode, pu8CodeR3, GCPtrCode, u32IDCode,
1076 DECLCALLBACK(void) vmmR3SwitcherPAEToAMD64_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IDCode)
1078 vmmR3SwitcherGenericRelocate(pVM, pSwitcher, R0PtrCode, pu8CodeR3, GCPtrCode, u32IDCode,
1086 DECLCALLBACK(void) vmmR3SwitcherAMD64To32Bit_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IDCode)
1088 vmmR3SwitcherGenericRelocate(pVM, pSwitcher, R0PtrCode, pu8CodeR3, GCPtrCode, u32IDCode,
1096 DECLCALLBACK(void) vmmR3SwitcherAMD64ToPAE_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IDCode)
1098 vmmR3SwitcherGenericRelocate(pVM, pSwitcher, R0PtrCode, pu8CodeR3, GCPtrCode, u32IDCode,
1133 PVMMSWITCHERDEF pSwitcher = papSwitchers[enmSwitcher];
1134 if (pSwitcher)
1136 Log(("VMMR3SelectSwitcher: enmSwitcher %d -> %d %s\n", pVM->vmm.s.enmSwitcher, enmSwitcher, pSwitcher->pszDesc));
1140 pVM->vmm.s.pfnR0ToRawMode = pbCodeR0 + pSwitcher->offR0ToRawMode;
1143 pVM->vmm.s.pfnRCToHost = RCPtr + pSwitcher->offRCToHost;
1144 pVM->vmm.s.pfnCallTrampolineRC = RCPtr + pSwitcher->offRCCallTrampoline;
1145 pVM->pfnVMMRCToHostAsm = RCPtr + pSwitcher->offRCToHostAsm;
1146 pVM->pfnVMMRCToHostAsmNoReturn = RCPtr + pSwitcher->offRCToHostAsmNoReturn;
1178 PVMMSWITCHERDEF pSwitcher = papSwitchers[enmSwitcher];
1179 if (pSwitcher)
1183 return pbCodeR0 + pSwitcher->offR0ToRawMode;