- Timestamp:
- Nov 14, 2016 10:46:07 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/apic.h
r63634 r64655 170 170 #endif /* IN_RING0 */ 171 171 172 VMMDECL(bool) APICQueueInterruptToService(PVMCPU pVCpu, uint8_t u8PendingIntr); 173 VMMDECL(void) APICDequeueInterruptFromService(PVMCPU pVCpu, uint8_t u8PendingIntr); 172 /* These functions are exported as they are called from external modules (recompiler). */ 174 173 VMMDECL(void) APICUpdatePendingInterrupts(PVMCPU pVCpu); 175 VMMDECL(bool) APICGetHighestPendingInterrupt(PVMCPU pVCpu, uint8_t *pu8PendingIntr); 174 VMMDECL(int) APICGetTpr(PVMCPU pVCpu, uint8_t *pu8Tpr, bool *pfPending, uint8_t *pu8PendingIntr); 175 VMMDECL(int) APICSetTpr(PVMCPU pVCpu, uint8_t u8Tpr); 176 177 /* These functions are VMM internal. */ 178 VMM_INT_DECL(bool) APICGetHighestPendingInterrupt(PVMCPU pVCpu, uint8_t *pu8PendingIntr); 179 VMM_INT_DECL(bool) APICQueueInterruptToService(PVMCPU pVCpu, uint8_t u8PendingIntr); 180 VMM_INT_DECL(void) APICDequeueInterruptFromService(PVMCPU pVCpu, uint8_t u8PendingIntr); 181 VMM_INT_DECL(VBOXSTRICTRC) APICReadMsr(PVMCPU pVCpu, uint32_t u32Reg, uint64_t *pu64Value); 182 VMM_INT_DECL(VBOXSTRICTRC) APICWriteMsr(PVMCPU pVCpu, uint32_t u32Reg, uint64_t u64Value); 183 VMM_INT_DECL(int) APICGetTimerFreq(PVM pVM, uint64_t *pu64Value); 184 VMM_INT_DECL(VBOXSTRICTRC) APICLocalInterrupt(PVMCPU pVCpu, uint8_t u8Pin, uint8_t u8Level, int rcRZ); 185 VMM_INT_DECL(uint64_t) APICGetBaseMsrNoCheck(PVMCPU pVCpu); 186 VMM_INT_DECL(VBOXSTRICTRC) APICGetBaseMsr(PVMCPU pVCpu, uint64_t *pu64Value); 187 VMM_INT_DECL(VBOXSTRICTRC) APICSetBaseMsr(PVMCPU pVCpu, uint64_t u64BaseMsr); 188 VMM_INT_DECL(int) APICGetInterrupt(PVMCPU pVCpu, uint8_t *pu8Vector, uint32_t *pu32TagSrc); 189 VMM_INT_DECL(int) APICBusDeliver(PVM pVM, uint8_t uDest, uint8_t uDestMode, uint8_t uDeliveryMode, uint8_t uVector, 190 uint8_t uPolarity, uint8_t uTriggerMode, uint32_t uTagSrc); 176 191 177 192 /** @name Hyper-V interface (Ring-3 and all-context API). -
trunk/include/VBox/vmm/pdmapi.h
r64596 r64655 51 51 VMM_INT_DECL(int) PDMIoApicBroadcastEoi(PVM pVM, uint8_t uVector); 52 52 VMM_INT_DECL(int) PDMIoApicSendMsi(PVM pVM, RTGCPHYS GCAddr, uint32_t uValue, uint32_t uTagSrc); 53 VMM_INT_DECL(bool) PDMHasApic(PVM pVM);54 VMMDECL(VBOXSTRICTRC) PDMApicSetBaseMsr(PVMCPU pVCpu, uint64_t u64Base);55 VMMDECL(VBOXSTRICTRC) PDMApicGetBaseMsr(PVMCPU pVCpu, uint64_t *pu64Base, bool fIgnoreErrors);56 VMMDECL(void) PDMApicUpdateInterrupts(PVMCPU pVCpu);57 VMMDECL(int) PDMApicSetTPR(PVMCPU pVCpu, uint8_t u8TPR);58 VMMDECL(int) PDMApicGetTPR(PVMCPU pVCpu, uint8_t *pu8TPR, bool *pfPending, uint8_t *pu8PendingIntr);59 VMM_INT_DECL(VBOXSTRICTRC) PDMApicWriteMsr(PVMCPU pVCpu, uint32_t u32Reg, uint64_t u64Value);60 VMM_INT_DECL(VBOXSTRICTRC) PDMApicReadMsr(PVMCPU pVCpu, uint32_t u32Reg, uint64_t *pu64Value);61 VMM_INT_DECL(int) PDMApicGetTimerFreq(PVM pVM, uint64_t *pu64Value);62 53 VMM_INT_DECL(int) PDMVmmDevHeapR3ToGCPhys(PVM pVM, RTR3PTR pv, RTGCPHYS *pGCPhys); 63 54 VMM_INT_DECL(bool) PDMVmmDevHeapIsEnabled(PVM pVM); -
trunk/include/VBox/vmm/pdmdev.h
r64596 r64655 1152 1152 1153 1153 /** 1154 * Advanced Programmable Interrupt Controller registration structure. 1155 */ 1156 typedef struct PDMAPICREG 1157 { 1158 /** Structure version number. PDM_APICREG_VERSION defines the current version. */ 1159 uint32_t u32Version; 1160 1161 /** 1162 * Get a pending interrupt. 1163 * 1164 * @returns VBox status code. 1165 * @param pDevIns Device instance of the APIC. 1166 * @param pVCpu The cross context virtual CPU structure. 1167 * @param pu8Vector Where to store the vector. 1168 * @param pu32TagSrc Where to return the tag source (tracing 1169 * purposes). 1170 * @remarks Caller enters the PDM critical section. 1171 */ 1172 DECLR3CALLBACKMEMBER(int, pfnGetInterruptR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint8_t *pu8Vector, uint32_t *pu32TagSrc)); 1173 1174 /** 1175 * Set the APIC base. 1176 * 1177 * @param pDevIns Device instance of the APIC. 1178 * @param pVCpu The cross context virtual CPU structure. 1179 * @param u64BaseMsr The base MSR value. 1180 * @remarks Caller enters the PDM critical section (might not be the case with 1181 * the new APIC code) 1182 */ 1183 DECLR3CALLBACKMEMBER(VBOXSTRICTRC, pfnSetBaseMsrR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint64_t u64BaseMsr)); 1184 1185 /** 1186 * Get the APIC base. 1187 * 1188 * @returns Current base. 1189 * @param pDevIns Device instance of the APIC. 1190 * @param pVCpu The cross context virtual CPU structure. 1191 * @remarks Caller enters the PDM critical section. 1192 */ 1193 DECLR3CALLBACKMEMBER(uint64_t, pfnGetBaseMsrR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu)); 1194 1195 /** 1196 * Set the TPR (task priority register). 1197 * 1198 * @param pDevIns Device instance of the APIC. 1199 * @param pVCpu The cross context virtual CPU structure. 1200 * @param u8Tpr The new TPR. 1201 * @remarks Caller enters the PDM critical section. 1202 */ 1203 DECLR3CALLBACKMEMBER(void, pfnSetTprR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint8_t u8Tpr)); 1204 1205 /** 1206 * Get the TPR (task priority register). 1207 * 1208 * @returns The current TPR. 1209 * @param pDevIns Device instance of the APIC. 1210 * @param pVCpu The cross context virtual CPU structure. 1211 * @param pfPending Where to store if there is an interrupt pending 1212 * (optional, can be NULL). 1213 * @param pu8PendingIntr Where to store the pending interrupt vector 1214 * (optional, can be NULL). 1215 * @remarks Caller enters the PDM critical section. 1216 */ 1217 DECLR3CALLBACKMEMBER(uint8_t, pfnGetTprR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu, bool *pfPending, uint8_t *pu8PendingIntr)); 1218 1219 /** 1220 * Write to a MSR in APIC range. 1221 * 1222 * @returns Strict VBox status code. 1223 * @param pDevIns Device instance of the APIC. 1224 * @param pVCpu The cross context virtual CPU structure. 1225 * @param u32Reg The MSR begin written to. 1226 * @param u64Value The value to write. 1227 * 1228 * @remarks Unlike the other callbacks, the PDM lock is not taken before 1229 * calling this method. 1230 */ 1231 DECLR3CALLBACKMEMBER(VBOXSTRICTRC, pfnWriteMsrR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint32_t u32Reg, uint64_t u64Value)); 1232 1233 /** 1234 * Read from a MSR in APIC range. 1235 * 1236 * @returns Strict VBox status code. 1237 * @param pDevIns Device instance of the APIC. 1238 * @param pVCpu The cross context virtual CPU structure. 1239 * @param u32Reg MSR to read. 1240 * @param pu64Value Where to return the read value. 1241 * 1242 * @remarks Unlike the other callbacks, the PDM lock is not taken before 1243 * calling this method. 1244 */ 1245 DECLR3CALLBACKMEMBER(VBOXSTRICTRC, pfnReadMsrR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint32_t u32Reg, uint64_t *pu64Value)); 1246 1247 /** 1248 * Private interface between the IOAPIC and APIC. 1249 * 1250 * This is a low-level, APIC/IOAPIC implementation specific interface which 1251 * is registered with PDM only because it makes life so much simpler right 1252 * now (GC bits). This is a bad bad hack! The correct way of doing this 1253 * would involve some way of querying GC interfaces and relocating them. 1254 * Perhaps doing some kind of device init in GC... 1255 * 1256 * @returns VBox status code. 1257 * @param pDevIns Device instance of the APIC. 1258 * @param uDest The destination mask. 1259 * @param uDestMode The destination mode, see XAPICDESTMODE. 1260 * @param uDeliveryMode The delivery mode, see XAPICDELIVERYMODE. 1261 * @param uVector The interrupt vector. 1262 * @param uPolarity The input pin polarity. 1263 * @param uTriggerMode The trigger mode, see XAPICTRIGGERMODE. 1264 * @param uTagSrc The IRQ tag and source (for tracing). 1265 * @remarks Caller enters the PDM critical section. 1266 */ 1267 DECLR3CALLBACKMEMBER(int, pfnBusDeliverR3,(PPDMDEVINS pDevIns, uint8_t uDest, uint8_t uDestMode, uint8_t uDeliveryMode, 1268 uint8_t uVector, uint8_t uPolarity, uint8_t uTriggerMode, uint32_t uTagSrc)); 1269 1270 /** 1271 * Deliver a signal to CPU's local interrupt pins (LINT0/LINT1). 1272 * 1273 * Used for virtual wire mode when interrupts from the PIC are passed through 1274 * LAPIC. 1275 * 1276 * @returns Strict VBox status code. 1277 * @param pDevIns Device instance of the APIC. 1278 * @param pVCpu The cross context virtual CPU structure. 1279 * @param u8Pin Local pin number (0 or 1 for current CPUs). 1280 * @param u8Level The level. 1281 * @param rcRZ The return code if the operation cannot be 1282 * performed in the current context. 1283 * @remarks Caller enters the PDM critical section 1284 */ 1285 DECLR3CALLBACKMEMBER(VBOXSTRICTRC, pfnLocalInterruptR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint8_t u8Pin, uint8_t u8Level, 1286 int rcRZ)); 1287 1288 /** 1289 * Get the APIC timer frequency (in Hz). 1290 * 1291 * @returns The frequency of the APIC timer. 1292 * @param pDevIns Device instance of the APIC. 1293 */ 1294 DECLR3CALLBACKMEMBER(uint64_t, pfnGetTimerFreqR3,(PPDMDEVINS pDevIns)); 1295 1296 /** The name of the RC GetInterrupt entry point. */ 1297 const char *pszGetInterruptRC; 1298 /** The name of the RC SetBaseMsr entry point. */ 1299 const char *pszSetBaseMsrRC; 1300 /** The name of the RC GetBaseMsr entry point. */ 1301 const char *pszGetBaseMsrRC; 1302 /** The name of the RC SetTpr entry point. */ 1303 const char *pszSetTprRC; 1304 /** The name of the RC GetTpr entry point. */ 1305 const char *pszGetTprRC; 1306 /** The name of the RC WriteMsr entry point. */ 1307 const char *pszWriteMsrRC; 1308 /** The name of the RC ReadMsr entry point. */ 1309 const char *pszReadMsrRC; 1310 /** The name of the RC BusDeliver entry point. */ 1311 const char *pszBusDeliverRC; 1312 /** The name of the RC LocalInterrupt entry point. */ 1313 const char *pszLocalInterruptRC; 1314 /** The name of the RC GetTimerFreq entry point. */ 1315 const char *pszGetTimerFreqRC; 1316 1317 /** The name of the R0 GetInterrupt entry point. */ 1318 const char *pszGetInterruptR0; 1319 /** The name of the R0 SetBaseMsr entry point. */ 1320 const char *pszSetBaseMsrR0; 1321 /** The name of the R0 GetBaseMsr entry point. */ 1322 const char *pszGetBaseMsrR0; 1323 /** The name of the R0 SetTpr entry point. */ 1324 const char *pszSetTprR0; 1325 /** The name of the R0 GetTpr entry point. */ 1326 const char *pszGetTprR0; 1327 /** The name of the R0 WriteMsr entry point. */ 1328 const char *pszWriteMsrR0; 1329 /** The name of the R0 ReadMsr entry point. */ 1330 const char *pszReadMsrR0; 1331 /** The name of the R0 BusDeliver entry point. */ 1332 const char *pszBusDeliverR0; 1333 /** The name of the R0 LocalInterrupt entry point. */ 1334 const char *pszLocalInterruptR0; 1335 /** The name of the R0 GetTimerFreq entry point. */ 1336 const char *pszGetTimerFreqR0; 1337 } PDMAPICREG; 1338 /** Pointer to an APIC registration structure. */ 1339 typedef PDMAPICREG *PPDMAPICREG; 1340 1341 /** Current PDMAPICREG version number. */ 1342 #define PDM_APICREG_VERSION PDM_VERSION_MAKE(0xfff6, 4, 0) 1343 1344 1345 /** 1346 * APIC mode argument for pfnChangeFeature. 1347 * 1348 * Also used in saved-states, don't change existing values. 1154 * APIC mode argument for apicR3SetCpuIdFeatureLevel. 1155 * 1156 * Also used in saved-states, CFGM don't change existing values. 1349 1157 */ 1350 1158 typedef enum PDMAPICMODE … … 1467 1275 * @param u8DestMode See APIC implementation. 1468 1276 * @param u8DeliveryMode See APIC implementation. 1469 * @param iVector See APIC implementation.1277 * @param uVector See APIC implementation. 1470 1278 * @param u8Polarity See APIC implementation. 1471 1279 * @param u8TriggerMode See APIC implementation. … … 1473 1281 */ 1474 1282 DECLRCCALLBACKMEMBER(int, pfnApicBusDeliver,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode, 1475 uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc));1283 uint8_t uVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc)); 1476 1284 1477 1285 /** … … 1522 1330 * @param u8DestMode See APIC implementation. 1523 1331 * @param u8DeliveryMode See APIC implementation. 1524 * @param iVector See APIC implementation.1332 * @param uVector See APIC implementation. 1525 1333 * @param u8Polarity See APIC implementation. 1526 1334 * @param u8TriggerMode See APIC implementation. … … 1528 1336 */ 1529 1337 DECLR0CALLBACKMEMBER(int, pfnApicBusDeliver,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode, 1530 uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc));1338 uint8_t uVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc)); 1531 1339 1532 1340 /** … … 1576 1384 * @param u8DestMode See APIC implementation. 1577 1385 * @param u8DeliveryMode See APIC implementation. 1578 * @param iVector See APIC implementation.1386 * @param uVector See APIC implementation. 1579 1387 * @param u8Polarity See APIC implementation. 1580 1388 * @param u8TriggerMode See APIC implementation. … … 1582 1390 */ 1583 1391 DECLR3CALLBACKMEMBER(int, pfnApicBusDeliver,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode, 1584 uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc));1392 uint8_t uVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc)); 1585 1393 1586 1394 /** … … 3189 2997 * @returns VBox status code. 3190 2998 * @param pDevIns The device instance. 3191 * @param pApicReg Pointer to a APIC registration structure. 3192 */ 3193 DECLR3CALLBACKMEMBER(int, pfnAPICRegister,(PPDMDEVINS pDevIns, PPDMAPICREG pApicReg)); 2999 */ 3000 DECLR3CALLBACKMEMBER(int, pfnAPICRegister,(PPDMDEVINS pDevIns)); 3194 3001 3195 3002 /** … … 5219 5026 * @copydoc PDMDEVHLPR3::pfnAPICRegister 5220 5027 */ 5221 DECLINLINE(int) PDMDevHlpAPICRegister(PPDMDEVINS pDevIns , PPDMAPICREG pApicReg)5222 { 5223 return pDevIns->pHlpR3->pfnAPICRegister(pDevIns , pApicReg);5028 DECLINLINE(int) PDMDevHlpAPICRegister(PPDMDEVINS pDevIns) 5029 { 5030 return pDevIns->pHlpR3->pfnAPICRegister(pDevIns); 5224 5031 } 5225 5032 -
trunk/src/VBox/VMM/VMMAll/APICAll.cpp
r64596 r64655 228 228 /* 7 */ { "write reserved bits of MSR", "", VINF_CPUM_R3_MSR_WRITE }, 229 229 /* 8 */ { "write an invalid value to MSR", "", VINF_CPUM_R3_MSR_WRITE }, 230 /* 9 */ { "write MSR", "disallowed by configuration", VINF_CPUM_R3_MSR_WRITE } 230 /* 9 */ { "write MSR", "disallowed by configuration", VINF_CPUM_R3_MSR_WRITE }, 231 /* 10 */ { "read MSR", "disallowed by configuration", VINF_CPUM_R3_MSR_READ } 231 232 }; 232 233 AssertCompile(RT_ELEMENTS(s_aAccess) == APICMSRACCESS_COUNT); … … 1858 1859 1859 1860 /** 1860 * @interface_method_impl{PDMAPICREG,pfnReadMsrR3} 1861 */ 1862 APICBOTHCBDECL(VBOXSTRICTRC) apicReadMsr(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint32_t u32Reg, uint64_t *pu64Value) 1861 * Reads an APIC MSR. 1862 * 1863 * @returns Strict VBox status code. 1864 * @param pVCpu The cross context virtual CPU structure. 1865 * @param u32Reg The MSR being read. 1866 * @param pu64Value Where to store the read value. 1867 */ 1868 VMM_INT_DECL(VBOXSTRICTRC) APICReadMsr(PVMCPU pVCpu, uint32_t u32Reg, uint64_t *pu64Value) 1863 1869 { 1864 1870 /* … … 1868 1874 Assert(u32Reg >= MSR_IA32_X2APIC_ID && u32Reg <= MSR_IA32_X2APIC_SELF_IPI); 1869 1875 Assert(pu64Value); 1870 RT_NOREF_PV(pDevIns); 1871 1876 1877 /* 1878 * Is the APIC enabled? 1879 */ 1872 1880 PCAPIC pApic = VM_TO_APIC(pVCpu->CTX_SUFF(pVM)); 1881 if (apicIsEnabled(pVCpu)) 1882 { /* likely */ } 1883 else 1884 { 1885 return apicMsrAccessError(pVCpu, u32Reg, pApic->enmMaxMode == PDMAPICMODE_NONE ? 1886 APICMSRACCESS_READ_DISALLOWED_CONFIG : APICMSRACCESS_READ_RSVD_OR_UNKNOWN); 1887 } 1888 1873 1889 #ifndef IN_RING3 1874 1890 if (pApic->fRZEnabled) … … 1962 1978 1963 1979 /** 1964 * @interface_method_impl{PDMAPICREG,pfnWriteMsrR3} 1965 */ 1966 APICBOTHCBDECL(VBOXSTRICTRC) apicWriteMsr(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint32_t u32Reg, uint64_t u64Value) 1980 * Writes an APIC MSR. 1981 * 1982 * @returns Strict VBox status code. 1983 * @param pVCpu The cross context virtual CPU structure. 1984 * @param u32Reg The MSR being written. 1985 * @param pu64Value The value to write. 1986 */ 1987 VMM_INT_DECL(VBOXSTRICTRC) APICWriteMsr(PVMCPU pVCpu, uint32_t u32Reg, uint64_t u64Value) 1967 1988 { 1968 1989 /* … … 1971 1992 VMCPU_ASSERT_EMT(pVCpu); 1972 1993 Assert(u32Reg >= MSR_IA32_X2APIC_ID && u32Reg <= MSR_IA32_X2APIC_SELF_IPI); 1973 RT_NOREF_PV(pDevIns); 1974 1994 1995 /* 1996 * Is the APIC enabled? 1997 */ 1975 1998 PCAPIC pApic = VM_TO_APIC(pVCpu->CTX_SUFF(pVM)); 1999 if (apicIsEnabled(pVCpu)) 2000 { /* likely */ } 2001 else 2002 { 2003 return apicMsrAccessError(pVCpu, u32Reg, pApic->enmMaxMode == PDMAPICMODE_NONE ? 2004 APICMSRACCESS_WRITE_DISALLOWED_CONFIG : APICMSRACCESS_WRITE_RSVD_OR_UNKNOWN); 2005 } 2006 1976 2007 #ifndef IN_RING3 1977 2008 if (pApic->fRZEnabled) … … 2123 2154 2124 2155 /** 2125 * @interface_method_impl{PDMAPICREG,pfnSetBaseMsrR3} 2126 */ 2127 APICBOTHCBDECL(VBOXSTRICTRC) apicSetBaseMsr(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint64_t u64BaseMsr) 2156 * Sets the APIC base MSR. 2157 * 2158 * @returns Strict VBox status code. 2159 * @param pVCpu The cross context virtual CPU structure. 2160 * @param u64BaseMsr The value to set. 2161 */ 2162 VMM_INT_DECL(VBOXSTRICTRC) APICSetBaseMsr(PVMCPU pVCpu, uint64_t u64BaseMsr) 2128 2163 { 2129 2164 Assert(pVCpu); 2130 NOREF(pDevIns);2131 2165 2132 2166 #ifdef IN_RING3 … … 2255 2289 2256 2290 #else /* !IN_RING3 */ 2257 RT_NOREF_PV(pDevIns);2258 2291 RT_NOREF_PV(pVCpu); 2259 2292 RT_NOREF_PV(u64BaseMsr); … … 2264 2297 2265 2298 /** 2266 * @interface_method_impl{PDMAPICREG,pfnGetBaseMsrR3} 2267 */ 2268 APICBOTHCBDECL(uint64_t) apicGetBaseMsr(PPDMDEVINS pDevIns, PVMCPU pVCpu) 2269 { 2270 RT_NOREF_PV(pDevIns); 2299 * Gets the APIC base MSR (no checks are performed wrt APIC hardware or its 2300 * state). 2301 * 2302 * @returns The base MSR value. 2303 * @param pVCpu The cross context virtual CPU structure. 2304 */ 2305 VMM_INT_DECL(uint64_t) APICGetBaseMsrNoCheck(PVMCPU pVCpu) 2306 { 2271 2307 VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu); 2272 2273 2308 PCAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu); 2274 2309 return pApicCpu->uApicBaseMsr; … … 2277 2312 2278 2313 /** 2279 * @interface_method_impl{PDMAPICREG,pfnSetTprR3} 2280 */ 2281 APICBOTHCBDECL(void) apicSetTpr(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint8_t u8Tpr) 2282 { 2283 RT_NOREF_PV(pDevIns); 2284 apicSetTprEx(pVCpu, u8Tpr, false /* fForceX2ApicBehaviour */); 2314 * Gets the APIC base MSR. 2315 * 2316 * @returns Strict VBox status code. 2317 * @param pVCpu The cross context virtual CPU structure. 2318 * @param pu64Value Where to store the MSR value. 2319 */ 2320 VMM_INT_DECL(VBOXSTRICTRC) APICGetBaseMsr(PVMCPU pVCpu, uint64_t *pu64Value) 2321 { 2322 VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu); 2323 2324 PCAPIC pApic = VM_TO_APIC(pVCpu->CTX_SUFF(pVM)); 2325 if (pApic->enmMaxMode != PDMAPICMODE_NONE) 2326 { 2327 *pu64Value = APICGetBaseMsrNoCheck(pVCpu); 2328 return VINF_SUCCESS; 2329 } 2330 2331 #ifdef IN_RING3 2332 LogRelMax(5, ("APIC%u: Reading APIC base MSR (%#x) when there is no APIC -> #GP(0)\n", pVCpu->idCpu, MSR_IA32_APICBASE)); 2333 return VERR_CPUM_RAISE_GP_0; 2334 #else 2335 return VINF_CPUM_R3_MSR_WRITE; 2336 #endif 2337 } 2338 2339 2340 /** 2341 * Sets the TPR (Task Priority Register). 2342 * 2343 * @returns VBox status code. 2344 * @param pVCpu The cross context virtual CPU structure. 2345 * @param u8Tpr The TPR value to set. 2346 */ 2347 VMMDECL(int) APICSetTpr(PVMCPU pVCpu, uint8_t u8Tpr) 2348 { 2349 if (apicIsEnabled(pVCpu)) 2350 return VBOXSTRICTRC_VAL(apicSetTprEx(pVCpu, u8Tpr, false /* fForceX2ApicBehaviour */)); 2351 return VERR_PDM_NO_APIC_INSTANCE; 2285 2352 } 2286 2353 … … 2310 2377 2311 2378 /** 2312 * @interface_method_impl{PDMAPICREG,pfnGetTprR3} 2313 */ 2314 APICBOTHCBDECL(uint8_t) apicGetTpr(PPDMDEVINS pDevIns, PVMCPU pVCpu, bool *pfPending, uint8_t *pu8PendingIntr) 2315 { 2316 RT_NOREF_PV(pDevIns); 2379 * Gets the APIC TPR (Task Priority Register). 2380 * 2381 * @returns VBox status code. 2382 * @param pVCpu The cross context virtual CPU structure. 2383 * @param pu8Tpr Where to store the TPR. 2384 * @param pfPending Where to store whether there is a pending interrupt 2385 * (optional, can be NULL). 2386 * @param pu8PendingIntr Where to store the highest-priority pending 2387 * interrupt (optional, can be NULL). 2388 */ 2389 VMMDECL(int) APICGetTpr(PVMCPU pVCpu, uint8_t *pu8Tpr, bool *pfPending, uint8_t *pu8PendingIntr) 2390 { 2317 2391 VMCPU_ASSERT_EMT(pVCpu); 2318 PCXAPICPAGE pXApicPage = VMCPU_TO_CXAPICPAGE(pVCpu); 2319 2320 if (pfPending) 2321 { 2322 /* 2323 * Just return whatever the highest pending interrupt is in the IRR. 2324 * The caller is responsible for figuring out if it's masked by the TPR etc. 2325 */ 2326 *pfPending = apicGetHighestPendingInterrupt(pVCpu, pu8PendingIntr); 2327 } 2328 2329 return pXApicPage->tpr.u8Tpr; 2330 } 2331 2332 2333 /** 2334 * @interface_method_impl{PDMAPICREG,pfnGetTimerFreqR3} 2335 */ 2336 APICBOTHCBDECL(uint64_t) apicGetTimerFreq(PPDMDEVINS pDevIns) 2337 { 2338 PVM pVM = PDMDevHlpGetVM(pDevIns); 2339 PVMCPU pVCpu = &pVM->aCpus[0]; 2340 PAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu); 2341 uint64_t uTimer = TMTimerGetFreq(pApicCpu->CTX_SUFF(pTimer)); 2342 return uTimer; 2343 } 2344 2345 2346 /** 2347 * @interface_method_impl{PDMAPICREG,pfnBusDeliverR3} 2348 * @remarks This is a private interface between the IOAPIC and the APIC. 2349 */ 2350 APICBOTHCBDECL(int) apicBusDeliver(PPDMDEVINS pDevIns, uint8_t uDest, uint8_t uDestMode, uint8_t uDeliveryMode, uint8_t uVector, 2351 uint8_t uPolarity, uint8_t uTriggerMode, uint32_t uTagSrc) 2392 if (apicIsEnabled(pVCpu)) 2393 { 2394 PCXAPICPAGE pXApicPage = VMCPU_TO_CXAPICPAGE(pVCpu); 2395 if (pfPending) 2396 { 2397 /* 2398 * Just return whatever the highest pending interrupt is in the IRR. 2399 * The caller is responsible for figuring out if it's masked by the TPR etc. 2400 */ 2401 *pfPending = apicGetHighestPendingInterrupt(pVCpu, pu8PendingIntr); 2402 } 2403 2404 *pu8Tpr = pXApicPage->tpr.u8Tpr; 2405 return VINF_SUCCESS; 2406 } 2407 2408 *pu8Tpr = 0; 2409 return VERR_PDM_NO_APIC_INSTANCE; 2410 } 2411 2412 2413 /** 2414 * Gets the APIC timer frequency. 2415 * 2416 * @returns Strict VBox status code. 2417 * @param 2418 */ 2419 VMM_INT_DECL(int) APICGetTimerFreq(PVM pVM, uint64_t *pu64Value) 2420 { 2421 /* 2422 * Validate. 2423 */ 2424 Assert(pVM); 2425 AssertPtrReturn(pu64Value, VERR_INVALID_PARAMETER); 2426 2427 PVMCPU pVCpu = &pVM->aCpus[0]; 2428 if (apicIsEnabled(pVCpu)) 2429 { 2430 PCAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu); 2431 *pu64Value = TMTimerGetFreq(pApicCpu->CTX_SUFF(pTimer)); 2432 return VINF_SUCCESS; 2433 } 2434 return VERR_PDM_NO_APIC_INSTANCE; 2435 } 2436 2437 2438 /** 2439 * Delivers an interrupt message via the system bus. 2440 * 2441 * @returns VBox status code. 2442 * @param pVM The cross context VM structure. 2443 * @param uDest The destination mask. 2444 * @param uDestMode The destination mode. 2445 * @param uDeliveryMode The delivery mode. 2446 * @param uVector The interrupt vector. 2447 * @param uPolarity The interrupt line polarity. 2448 * @param uTriggerMode The trigger mode. 2449 * @param uTagSrc The interrupt tag (debugging). 2450 */ 2451 VMM_INT_DECL(int) APICBusDeliver(PVM pVM, uint8_t uDest, uint8_t uDestMode, uint8_t uDeliveryMode, uint8_t uVector, 2452 uint8_t uPolarity, uint8_t uTriggerMode, uint32_t uTagSrc) 2352 2453 { 2353 2454 NOREF(uPolarity); 2354 2455 NOREF(uTagSrc); 2355 PVM pVM = PDMDevHlpGetVM(pDevIns); 2456 2457 /* 2458 * If the APIC isn't enabled, do nothing and pretend success. 2459 */ 2460 if (apicIsEnabled(&pVM->aCpus[0])) 2461 { /* likely */ } 2462 else 2463 return VINF_SUCCESS; 2356 2464 2357 2465 /* … … 2382 2490 2383 2491 /** 2384 * @interface_method_impl{PDMAPICREG,pfnLocalInterruptR3} 2385 * @remarks This is a private interface between the PIC and the APIC. 2386 */ 2387 APICBOTHCBDECL(VBOXSTRICTRC) apicLocalInterrupt(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint8_t u8Pin, uint8_t u8Level, int rcRZ) 2388 { 2389 NOREF(pDevIns); 2492 * Assert/de-assert the local APIC's LINT0/LINT1 interrupt pins. 2493 * 2494 * @returns Strict VBox status code. 2495 * @param pVCpu The cross context virtual CPU structure. 2496 * @param u8Pin The interrupt pin (0 for LINT0 or 1 for LINT1). 2497 * @param u8Level The level (0 for low or 1 for high). 2498 * @param rcRZ The return code if the operation cannot be performed in 2499 * the current context. 2500 */ 2501 VMM_INT_DECL(VBOXSTRICTRC) APICLocalInterrupt(PVMCPU pVCpu, uint8_t u8Pin, uint8_t u8Level, int rcRZ) 2502 { 2390 2503 AssertReturn(u8Pin <= 1, VERR_INVALID_PARAMETER); 2391 2504 AssertReturn(u8Level <= 1, VERR_INVALID_PARAMETER); … … 2544 2657 2545 2658 /** 2546 * @interface_method_impl{PDMAPICREG,pfnGetInterruptR3} 2547 */ 2548 APICBOTHCBDECL(int) apicGetInterrupt(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint8_t *pu8Vector, uint32_t *pu32TagSrc) 2549 { 2550 RT_NOREF_PV(pDevIns); 2659 * Gets the next highest-priority interrupt from the APIC, marking it as an 2660 * "in-service" interrupt. 2661 * 2662 * @returns VBox status code. 2663 * @param pVCpu The cross context virtual CPU structure. 2664 * @param pu8Vector Where to store the vector. 2665 * @param pu32TagSrc The source tag (debugging). 2666 */ 2667 VMM_INT_DECL(int) APICGetInterrupt(PVMCPU pVCpu, uint8_t *pu8Vector, uint32_t *pu32TagSrc) 2668 { 2551 2669 VMCPU_ASSERT_EMT(pVCpu); 2552 2670 Assert(pu8Vector); … … 2905 3023 * interrupt shadow etc.) 2906 3024 */ 2907 VMM DECL(bool) APICQueueInterruptToService(PVMCPU pVCpu, uint8_t u8PendingIntr)3025 VMM_INT_DECL(bool) APICQueueInterruptToService(PVMCPU pVCpu, uint8_t u8PendingIntr) 2908 3026 { 2909 3027 VMCPU_ASSERT_EMT(pVCpu); … … 2937 3055 * in-service. 2938 3056 */ 2939 VMM DECL(void) APICDequeueInterruptFromService(PVMCPU pVCpu, uint8_t u8PendingIntr)3057 VMM_INT_DECL(void) APICDequeueInterruptFromService(PVMCPU pVCpu, uint8_t u8PendingIntr) 2940 3058 { 2941 3059 VMCPU_ASSERT_EMT(pVCpu); … … 3044 3162 * interrupt is pending. 3045 3163 */ 3046 VMM DECL(bool) APICGetHighestPendingInterrupt(PVMCPU pVCpu, uint8_t *pu8PendingIntr)3164 VMM_INT_DECL(bool) APICGetHighestPendingInterrupt(PVMCPU pVCpu, uint8_t *pu8PendingIntr) 3047 3165 { 3048 3166 VMCPU_ASSERT_EMT(pVCpu); -
trunk/src/VBox/VMM/VMMAll/CPUMAllMsrs.cpp
r62606 r64655 22 22 #define LOG_GROUP LOG_GROUP_CPUM 23 23 #include <VBox/vmm/cpum.h> 24 #include <VBox/vmm/ pdmapi.h>24 #include <VBox/vmm/apic.h> 25 25 #include <VBox/vmm/hm.h> 26 26 #include <VBox/vmm/tm.h> … … 217 217 { 218 218 RT_NOREF_PV(idMsr); RT_NOREF_PV(pRange); 219 return PDMApicGetBaseMsr(pVCpu, puValue, false /* fIgnoreErrors */);219 return APICGetBaseMsr(pVCpu, puValue); 220 220 } 221 221 … … 225 225 { 226 226 RT_NOREF_PV(pVCpu); RT_NOREF_PV(idMsr); RT_NOREF_PV(pRange); RT_NOREF_PV(uValue); RT_NOREF_PV(uRawValue); 227 return PDMApicSetBaseMsr(pVCpu, uValue);227 return APICSetBaseMsr(pVCpu, uValue); 228 228 } 229 229 … … 1215 1215 { 1216 1216 RT_NOREF_PV(pRange); 1217 return PDMApicReadMsr(pVCpu, idMsr, puValue);1217 return APICReadMsr(pVCpu, idMsr, puValue); 1218 1218 } 1219 1219 … … 1223 1223 { 1224 1224 RT_NOREF_PV(pRange); RT_NOREF_PV(uRawValue); 1225 return PDMApicWriteMsr(pVCpu, idMsr, uValue);1225 return APICWriteMsr(pVCpu, idMsr, uValue); 1226 1226 } 1227 1227 -
trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp
r62601 r64655 24 24 #include <VBox/vmm/patm.h> 25 25 #include <VBox/vmm/dbgf.h> 26 #include <VBox/vmm/ pdm.h>26 #include <VBox/vmm/apic.h> 27 27 #include <VBox/vmm/pgm.h> 28 28 #include <VBox/vmm/mm.h> … … 1059 1059 { 1060 1060 uint8_t u8Tpr; 1061 int rc = PDMApicGetTPR(pVCpu, &u8Tpr, NULL /* pfPending */, NULL /* pu8PendingIrq */);1061 int rc = APICGetTpr(pVCpu, &u8Tpr, NULL /* pfPending */, NULL /* pu8PendingIrq */); 1062 1062 if (RT_FAILURE(rc)) 1063 1063 { … … 1066 1066 return rc; 1067 1067 } 1068 *pValue = u8Tpr >> 4; /* bits 7-4 contain the task priority that go in cr8, bits 3-0 */1068 *pValue = u8Tpr >> 4; /* bits 7-4 contain the task priority that go in cr8, bits 3-0 */ 1069 1069 break; 1070 1070 } -
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r63560 r64655 3250 3250 3251 3251 case DISCREG_CR8: 3252 return PDMApicSetTPR(pVCpu, val << 4); /* cr8 bits 3-0 correspond to bits 7-4 of the task priority mmio register. */3252 return APICSetTpr(pVCpu, val << 4); /* cr8 bits 3-0 correspond to bits 7-4 of the task priority mmio register. */ 3253 3253 3254 3254 default: -
trunk/src/VBox/VMM/VMMAll/GIMAllHv.cpp
r63651 r64655 560 560 case MSR_GIM_HV_APIC_FREQ: 561 561 { 562 int rc = PDMApicGetTimerFreq(pVM, puValue);562 int rc = APICGetTimerFreq(pVM, puValue); 563 563 if (RT_FAILURE(rc)) 564 564 return VERR_CPUM_RAISE_GP_0; -
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r64545 r64655 96 96 #include <VBox/vmm/iem.h> 97 97 #include <VBox/vmm/cpum.h> 98 #include <VBox/vmm/apic.h> 98 99 #include <VBox/vmm/pdm.h> 99 100 #include <VBox/vmm/pgm.h> -
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
r64033 r64655 4958 4958 { 4959 4959 uint8_t uTpr; 4960 int rc = PDMApicGetTPR(pVCpu, &uTpr, NULL, NULL);4960 int rc = APICGetTpr(pVCpu, &uTpr, NULL, NULL); 4961 4961 if (RT_SUCCESS(rc)) 4962 4962 crX = uTpr >> 4; … … 5271 5271 5272 5272 if (!IEM_FULL_VERIFICATION_ENABLED(pVCpu)) 5273 PDMApicSetTPR(pVCpu, (uint8_t)uNewCrX << 4);5273 APICSetTpr(pVCpu, (uint8_t)uNewCrX << 4); 5274 5274 rcStrict = VINF_SUCCESS; 5275 5275 break; -
trunk/src/VBox/VMM/VMMAll/PDMAll.cpp
r64626 r64655 62 62 { 63 63 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC); 64 Assert(pVM->pdm.s.Apic.CTX_SUFF(pDevIns));65 Assert(pVM->pdm.s.Apic.CTX_SUFF(pfnGetInterrupt));66 64 uint32_t uTagSrc; 67 65 uint8_t uVector; 68 rc = pVM->pdm.s.Apic.CTX_SUFF(pfnGetInterrupt)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns),pVCpu, &uVector, &uTagSrc);66 rc = APICGetInterrupt(pVCpu, &uVector, &uTagSrc); 69 67 if (RT_SUCCESS(rc)) 70 68 { … … 260 258 261 259 /** 262 * Returns the presence of a Local APIC.263 *264 * @returns VBox true if a Local APIC is present.265 * @param pVM The cross context VM structure.266 */267 VMM_INT_DECL(bool) PDMHasApic(PVM pVM)268 {269 return pVM->pdm.s.Apic.CTX_SUFF(pDevIns) != NULL;270 }271 272 273 /**274 * Set the APIC base.275 *276 * @returns Strict VBox status code.277 * @param pVCpu The cross context virtual CPU structure.278 * @param u64Base The new base.279 */280 VMMDECL(VBOXSTRICTRC) PDMApicSetBaseMsr(PVMCPU pVCpu, uint64_t u64Base)281 {282 PVM pVM = pVCpu->CTX_SUFF(pVM);283 if (pVM->pdm.s.Apic.CTX_SUFF(pDevIns))284 {285 Assert(pVM->pdm.s.Apic.CTX_SUFF(pfnSetBaseMsr));286 VBOXSTRICTRC rcStrict = pVM->pdm.s.Apic.CTX_SUFF(pfnSetBaseMsr)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), pVCpu, u64Base);287 288 /* Update CPUM's copy of the APIC base. */289 PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu);290 Assert(pCtx);291 pCtx->msrApicBase = pVM->pdm.s.Apic.CTX_SUFF(pfnGetBaseMsr)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), pVCpu);292 293 return rcStrict;294 }295 296 #ifdef IN_RING3297 LogRelMax(5, ("PDM: APIC%U: Writing APIC base MSR (%#x) invalid since there isn't an APIC -> #GP(0)\n", pVCpu->idCpu,298 MSR_IA32_APICBASE));299 return VERR_CPUM_RAISE_GP_0;300 #else301 return VINF_CPUM_R3_MSR_WRITE;302 #endif303 }304 305 306 /**307 * Get the APIC base MSR from the APIC device.308 *309 * @returns Strict VBox status code.310 * @param pVCpu The cross context virtual CPU structure.311 * @param pu64Base Where to store the APIC base.312 * @param fIgnoreErrors Whether to ignore errors (i.e. not a real guest MSR313 * access).314 */315 VMMDECL(VBOXSTRICTRC) PDMApicGetBaseMsr(PVMCPU pVCpu, uint64_t *pu64Base, bool fIgnoreErrors)316 {317 PVM pVM = pVCpu->CTX_SUFF(pVM);318 if (pVM->pdm.s.Apic.CTX_SUFF(pDevIns))319 {320 Assert(pVM->pdm.s.Apic.CTX_SUFF(pfnGetBaseMsr));321 VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu);322 *pu64Base = pVM->pdm.s.Apic.CTX_SUFF(pfnGetBaseMsr)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), pVCpu);323 return VINF_SUCCESS;324 }325 326 *pu64Base = 0;327 if (fIgnoreErrors)328 return VINF_SUCCESS;329 330 #ifdef IN_RING3331 LogRelMax(5, ("PDM: APIC%u: Reading APIC base MSR (%#x) invalid without an APIC instance -> #GP(0)\n", pVCpu->idCpu,332 MSR_IA32_APICBASE));333 return VERR_CPUM_RAISE_GP_0;334 #else335 return VINF_CPUM_R3_MSR_WRITE;336 #endif337 }338 339 340 /**341 * Set the TPR (Task Priority Register).342 *343 * @returns VBox status code.344 * @param pVCpu The cross context virtual CPU structure.345 * @param u8TPR The new TPR.346 */347 VMMDECL(int) PDMApicSetTPR(PVMCPU pVCpu, uint8_t u8TPR)348 {349 PVM pVM = pVCpu->CTX_SUFF(pVM);350 if (pVM->pdm.s.Apic.CTX_SUFF(pDevIns))351 {352 Assert(pVM->pdm.s.Apic.CTX_SUFF(pfnSetTpr));353 pVM->pdm.s.Apic.CTX_SUFF(pfnSetTpr)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), pVCpu, u8TPR);354 return VINF_SUCCESS;355 }356 return VERR_PDM_NO_APIC_INSTANCE;357 }358 359 360 /**361 * Get the TPR (Task Priority Register).362 *363 * @returns VINF_SUCCESS or VERR_PDM_NO_APIC_INSTANCE.364 * @param pVCpu The cross context virtual CPU structure.365 * @param pu8TPR Where to store the TRP.366 * @param pfPending Where to store whether there is a pending interrupt367 * (out, optional).368 * @param pu8PendingIntr Where to store the highest-priority pending369 * interrupt (out, optional).370 *371 * @remarks No-long-jump zone!!!372 */373 VMMDECL(int) PDMApicGetTPR(PVMCPU pVCpu, uint8_t *pu8TPR, bool *pfPending, uint8_t *pu8PendingIntr)374 {375 PVM pVM = pVCpu->CTX_SUFF(pVM);376 PPDMDEVINS pApicIns = pVM->pdm.s.Apic.CTX_SUFF(pDevIns);377 if (pApicIns)378 {379 /*380 * Note! We don't acquire the PDM lock here as we're just reading381 * information. Doing so causes massive contention as this382 * function is called very often by each and every VCPU.383 */384 Assert(pVM->pdm.s.Apic.CTX_SUFF(pfnGetTpr));385 *pu8TPR = pVM->pdm.s.Apic.CTX_SUFF(pfnGetTpr)(pApicIns, pVCpu, pfPending, pu8PendingIntr);386 return VINF_SUCCESS;387 }388 *pu8TPR = 0;389 return VERR_PDM_NO_APIC_INSTANCE;390 }391 392 393 /**394 * Write a MSR in APIC range.395 *396 * @returns Strict VBox status code.397 * @param pVCpu The cross context virtual CPU structure.398 * @param u32Reg MSR to write.399 * @param u64Value Value to write.400 */401 VMM_INT_DECL(VBOXSTRICTRC) PDMApicWriteMsr(PVMCPU pVCpu, uint32_t u32Reg, uint64_t u64Value)402 {403 PVM pVM = pVCpu->CTX_SUFF(pVM);404 if (pVM->pdm.s.Apic.CTX_SUFF(pDevIns))405 {406 AssertPtr(pVM->pdm.s.Apic.CTX_SUFF(pfnWriteMsr));407 return pVM->pdm.s.Apic.CTX_SUFF(pfnWriteMsr)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), pVCpu, u32Reg, u64Value);408 }409 return VERR_CPUM_RAISE_GP_0;410 }411 412 413 /**414 * Read a MSR in APIC range.415 *416 * @returns Strict VBox status code.417 * @param pVCpu The cross context virtual CPU structure.418 * @param u32Reg MSR to read.419 * @param pu64Value Where to store the value read.420 */421 VMM_INT_DECL(VBOXSTRICTRC) PDMApicReadMsr(PVMCPU pVCpu, uint32_t u32Reg, uint64_t *pu64Value)422 {423 PVM pVM = pVCpu->CTX_SUFF(pVM);424 if (pVM->pdm.s.Apic.CTX_SUFF(pDevIns))425 {426 AssertPtr(pVM->pdm.s.Apic.CTX_SUFF(pfnReadMsr));427 return pVM->pdm.s.Apic.CTX_SUFF(pfnReadMsr)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), pVCpu, u32Reg, pu64Value);428 }429 return VERR_CPUM_RAISE_GP_0;430 }431 432 433 /**434 * Gets the frequency of the APIC timer.435 *436 * @returns VBox status code.437 * @param pVM The cross context VM structure.438 * @param pu64Value Where to store the frequency.439 */440 VMM_INT_DECL(int) PDMApicGetTimerFreq(PVM pVM, uint64_t *pu64Value)441 {442 if (pVM->pdm.s.Apic.CTX_SUFF(pDevIns))443 {444 AssertPtr(pVM->pdm.s.Apic.CTX_SUFF(pfnGetTimerFreq));445 *pu64Value = pVM->pdm.s.Apic.CTX_SUFF(pfnGetTimerFreq)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns));446 return VINF_SUCCESS;447 }448 return VERR_PDM_NO_APIC_INSTANCE;449 }450 451 452 /**453 260 * Locks PDM. 454 261 * This might call back to Ring-3 in order to deal with lock contention in GC and R3. -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r64626 r64655 1610 1610 bool fPendingIntr; 1611 1611 uint8_t u8Tpr; 1612 int rc = PDMApicGetTPR(pVCpu, &u8Tpr, &fPendingIntr, NULL /* pu8PendingIrq */);1612 int rc = APICGetTpr(pVCpu, &u8Tpr, &fPendingIntr, NULL /* pu8PendingIrq */); 1613 1613 AssertRCReturn(rc, rc); 1614 1614 … … 3290 3290 && (pMixedCtx->msrLSTAR & 0xff) != pSvmTransient->u8GuestTpr) 3291 3291 { 3292 int rc = PDMApicSetTPR(pVCpu, pMixedCtx->msrLSTAR & 0xff);3292 int rc = APICSetTpr(pVCpu, pMixedCtx->msrLSTAR & 0xff); 3293 3293 AssertRC(rc); 3294 3294 HMCPU_CF_SET(pVCpu, HM_CHANGED_SVM_GUEST_APIC_STATE); … … 3296 3296 else if (pSvmTransient->u8GuestTpr != pVmcb->ctrl.IntCtrl.n.u8VTPR) 3297 3297 { 3298 int rc = PDMApicSetTPR(pVCpu, pVmcb->ctrl.IntCtrl.n.u8VTPR << 4);3298 int rc = APICSetTpr(pVCpu, pVmcb->ctrl.IntCtrl.n.u8VTPR << 4); 3299 3299 AssertRC(rc); 3300 3300 HMCPU_CF_SET(pVCpu, HM_CHANGED_SVM_GUEST_APIC_STATE); … … 4004 4004 case HMTPRINSTR_READ: 4005 4005 { 4006 int rc = PDMApicGetTPR(pVCpu, &u8Tpr, &fPending, NULL /* pu8PendingIrq */);4006 int rc = APICGetTpr(pVCpu, &u8Tpr, &fPending, NULL /* pu8PendingIrq */); 4007 4007 AssertRC(rc); 4008 4008 … … 4026 4026 u8Tpr = (uint8_t)pPatch->uSrcOperand; 4027 4027 4028 int rc2 = PDMApicSetTPR(pVCpu, u8Tpr);4028 int rc2 = APICSetTpr(pVCpu, u8Tpr); 4029 4029 AssertRC(rc2); 4030 4030 HMCPU_CF_SET(pVCpu, HM_CHANGED_SVM_GUEST_APIC_STATE); … … 4657 4657 { 4658 4658 /* Our patch code uses LSTAR for TPR caching for 32-bit guests. */ 4659 int rc2 = PDMApicSetTPR(pVCpu, pCtx->eax & 0xff);4659 int rc2 = APICSetTpr(pVCpu, pCtx->eax & 0xff); 4660 4660 AssertRC(rc2); 4661 4661 HMCPU_CF_SET(pVCpu, HM_CHANGED_SVM_GUEST_APIC_STATE); -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r64626 r64655 3417 3417 uint8_t u8Tpr = 0; 3418 3418 uint8_t u8PendingIntr = 0; 3419 rc = PDMApicGetTPR(pVCpu, &u8Tpr, &fPendingIntr, &u8PendingIntr);3419 rc = APICGetTpr(pVCpu, &u8Tpr, &fPendingIntr, &u8PendingIntr); 3420 3420 AssertRCReturn(rc, rc); 3421 3421 … … 8962 8962 /* 8963 8963 * If the TPR was raised by the guest, it wouldn't cause a VM-exit immediately. Instead we sync the TPR lazily whenever 8964 * we eventually get a VM-exit for any reason. This maybe expensive as PDMApicSetTPR() can longjmp to ring-3 and which is 8965 * why it's done here as it's easier and no less efficient to deal with it here than making hmR0VmxSaveGuestState() 8966 * cope with longjmps safely (see VMCPU_FF_HM_UPDATE_CR3 handling). 8964 * we eventually get a VM-exit for any reason. 8965 * 8966 * This maybe expensive as PDMApicSetTPR() can longjmp to ring-3 and which is why it's done here as it's easier and 8967 * no less efficient to deal with it here than making hmR0VmxSaveGuestState() cope with longjmps safely 8968 * (see VMCPU_FF_HM_UPDATE_CR3 handling). 8967 8969 */ 8970 /** @todo r=ramshankar: The 2nd para in the above comment is 8971 * outdated, we no longer longjmp to ring-3 on setting 8972 * the TPR, but regardless we can probably rework this 8973 * portion of the code a bit. */ 8968 8974 if ( (pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_TPR_SHADOW) 8969 8975 && pVmxTransient->u8GuestTpr != pVCpu->hm.s.vmx.pbVirtApic[0x80]) 8970 8976 { 8971 rc = PDMApicSetTPR(pVCpu, pVCpu->hm.s.vmx.pbVirtApic[0x80]);8977 rc = APICSetTpr(pVCpu, pVCpu->hm.s.vmx.pbVirtApic[0x80]); 8972 8978 AssertRC(rc); 8973 8979 HMCPU_CF_SET(pVCpu, HM_CHANGED_VMX_GUEST_APIC_STATE); -
trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp
r64596 r64655 30 30 #include <VBox/vmm/patm.h> 31 31 #include <VBox/vmm/hm.h> 32 #include <VBox/vmm/apic.h> 32 33 33 34 #include <VBox/log.h> … … 447 448 PVM pVM = pDevIns->Internal.s.pVMR0; 448 449 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 449 450 if (pVM->pdm.s.Apic.pfnLocalInterruptR0) 451 { 452 LogFlow(("pdmR0PicHlp_SetInterruptFF: caller='%p'/%d: Setting local interrupt on LAPIC\n", 453 pDevIns, pDevIns->iInstance)); 454 /* Raise the LAPIC's LINT0 line instead of signaling the CPU directly. */ 455 /** @todo rcRZ propagation to pfnLocalInterrupt from caller. */ 456 pVM->pdm.s.Apic.pfnLocalInterruptR0(pVM->pdm.s.Apic.pDevInsR0, pVCpu, 0 /* u8Pin */, 1 /* u8Level */, 457 VINF_SUCCESS /* rcRZ */); 458 return; 459 } 460 461 LogFlow(("pdmR0PicHlp_SetInterruptFF: caller=%p/%d: VMCPU_FF_INTERRUPT_PIC %d -> 1\n", 462 pDevIns, pDevIns->iInstance, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC))); 463 464 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC); 450 /** @todo r=ramshankar: Propagating rcRZ and make all callers handle it? */ 451 APICLocalInterrupt(pVCpu, 0 /* u8Pin */, 1 /* u8Level */, VINF_SUCCESS /* rcRZ */); 465 452 } 466 453 … … 472 459 PVM pVM = pDevIns->Internal.s.pVMR0; 473 460 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 474 475 if (pVM->pdm.s.Apic.pfnLocalInterruptR0) 476 { 477 /* Raise the LAPIC's LINT0 line instead of signaling the CPU directly. */ 478 LogFlow(("pdmR0PicHlp_ClearInterruptFF: caller='%s'/%d: Clearing local interrupt on LAPIC\n", 479 pDevIns, pDevIns->iInstance)); 480 /* Lower the LAPIC's LINT0 line instead of signaling the CPU directly. */ 481 /** @todo rcRZ propagation to pfnLocalInterrupt from caller. */ 482 pVM->pdm.s.Apic.pfnLocalInterruptR0(pVM->pdm.s.Apic.pDevInsR0, pVCpu, 0 /* u8Pin */, 0 /* u8Level */, 483 VINF_SUCCESS /* rcRZ */); 484 return; 485 } 486 487 LogFlow(("pdmR0PicHlp_ClearInterruptFF: caller=%p/%d: VMCPU_FF_INTERRUPT_PIC %d -> 0\n", 488 pDevIns, pDevIns->iInstance, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC))); 489 490 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC); 461 /** @todo r=ramshankar: Propagating rcRZ and make all callers handle it? */ 462 APICLocalInterrupt(pVCpu, 0 /* u8Pin */, 0 /* u8Level */, VINF_SUCCESS /* rcRZ */); 491 463 } 492 464 … … 529 501 530 502 /** @interface_method_impl{PDMIOAPICHLPR0,pfnApicBusDeliver} */ 531 static DECLCALLBACK(int) pdmR0IoApicHlp_ApicBusDeliver(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode, 532 uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc) 503 static DECLCALLBACK(int) pdmR0IoApicHlp_ApicBusDeliver(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, 504 uint8_t u8DeliveryMode, uint8_t uVector, uint8_t u8Polarity, 505 uint8_t u8TriggerMode, uint32_t uTagSrc) 533 506 { 534 507 PDMDEV_ASSERT_DEVINS(pDevIns); 535 508 PVM pVM = pDevIns->Internal.s.pVMR0; 536 LogFlow(("pdmR0IoApicHlp_ApicBusDeliver: caller=%p/%d: u8Dest=%RX8 u8DestMode=%RX8 u8DeliveryMode=%RX8 iVector=%RX8 u8Polarity=%RX8 u8TriggerMode=%RX8 uTagSrc=%#x\n", 537 pDevIns, pDevIns->iInstance, u8Dest, u8DestMode, u8DeliveryMode, iVector, u8Polarity, u8TriggerMode, uTagSrc)); 538 Assert(pVM->pdm.s.Apic.pDevInsR0); 539 if (pVM->pdm.s.Apic.pfnBusDeliverR0) 540 return pVM->pdm.s.Apic.pfnBusDeliverR0(pVM->pdm.s.Apic.pDevInsR0, u8Dest, u8DestMode, u8DeliveryMode, iVector, 541 u8Polarity, u8TriggerMode, uTagSrc); 542 return VINF_SUCCESS; 509 LogFlow(("pdmR0IoApicHlp_ApicBusDeliver: caller=%p/%d: u8Dest=%RX8 u8DestMode=%RX8 u8DeliveryMode=%RX8 uVector=%RX8 u8Polarity=%RX8 u8TriggerMode=%RX8 uTagSrc=%#x\n", 510 pDevIns, pDevIns->iInstance, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc)); 511 return APICBusDeliver(pVM, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc); 543 512 } 544 513 -
trunk/src/VBox/VMM/VMMR3/APIC.cpp
r64596 r64655 1687 1687 * Register the APIC with PDM. 1688 1688 */ 1689 PDMAPICREG ApicReg; 1690 RT_ZERO(ApicReg); 1691 ApicReg.u32Version = PDM_APICREG_VERSION; 1692 ApicReg.pfnGetInterruptR3 = apicGetInterrupt; 1693 ApicReg.pfnSetBaseMsrR3 = apicSetBaseMsr; 1694 ApicReg.pfnGetBaseMsrR3 = apicGetBaseMsr; 1695 ApicReg.pfnSetTprR3 = apicSetTpr; 1696 ApicReg.pfnGetTprR3 = apicGetTpr; 1697 ApicReg.pfnWriteMsrR3 = apicWriteMsr; 1698 ApicReg.pfnReadMsrR3 = apicReadMsr; 1699 ApicReg.pfnBusDeliverR3 = apicBusDeliver; 1700 ApicReg.pfnLocalInterruptR3 = apicLocalInterrupt; 1701 ApicReg.pfnGetTimerFreqR3 = apicGetTimerFreq; 1702 1703 /* 1704 * We always require R0 functionality (e.g. apicGetTpr() called by HMR0 VT-x/AMD-V code). 1705 * Hence, 'fRZEnabled' strictly only applies to MMIO and MSR read/write handlers returning 1706 * to ring-3. We still need other handlers like apicGetTpr() in ring-0 for now. 1707 */ 1708 { 1709 ApicReg.pszGetInterruptRC = "apicGetInterrupt"; 1710 ApicReg.pszSetBaseMsrRC = "apicSetBaseMsr"; 1711 ApicReg.pszGetBaseMsrRC = "apicGetBaseMsr"; 1712 ApicReg.pszSetTprRC = "apicSetTpr"; 1713 ApicReg.pszGetTprRC = "apicGetTpr"; 1714 ApicReg.pszWriteMsrRC = "apicWriteMsr"; 1715 ApicReg.pszReadMsrRC = "apicReadMsr"; 1716 ApicReg.pszBusDeliverRC = "apicBusDeliver"; 1717 ApicReg.pszLocalInterruptRC = "apicLocalInterrupt"; 1718 ApicReg.pszGetTimerFreqRC = "apicGetTimerFreq"; 1719 1720 ApicReg.pszGetInterruptR0 = "apicGetInterrupt"; 1721 ApicReg.pszSetBaseMsrR0 = "apicSetBaseMsr"; 1722 ApicReg.pszGetBaseMsrR0 = "apicGetBaseMsr"; 1723 ApicReg.pszSetTprR0 = "apicSetTpr"; 1724 ApicReg.pszGetTprR0 = "apicGetTpr"; 1725 ApicReg.pszWriteMsrR0 = "apicWriteMsr"; 1726 ApicReg.pszReadMsrR0 = "apicReadMsr"; 1727 ApicReg.pszBusDeliverR0 = "apicBusDeliver"; 1728 ApicReg.pszLocalInterruptR0 = "apicLocalInterrupt"; 1729 ApicReg.pszGetTimerFreqR0 = "apicGetTimerFreq"; 1730 } 1731 1732 rc = PDMDevHlpAPICRegister(pDevIns, &ApicReg); 1689 rc = PDMDevHlpAPICRegister(pDevIns); 1733 1690 AssertLogRelRCReturn(rc, rc); 1734 1691 … … 1736 1693 * Initialize the APIC state. 1737 1694 */ 1738 /* First insert/remove the MSR range of the x2APIC. */1739 1695 if (pApic->enmMaxMode == PDMAPICMODE_X2APIC) 1740 1696 { … … 1751 1707 /* Tell CPUM about the APIC feature level so it can adjust APICBASE MSR GP mask and CPUID bits. */ 1752 1708 apicR3SetCpuIdFeatureLevel(pVM, pApic->enmMaxMode); 1753 1754 /* Initialize the state. */ 1709 /* Finally, initialize the state. */ 1755 1710 rc = apicR3InitState(pVM); 1756 1711 AssertRCReturn(rc, rc); -
trunk/src/VBox/VMM/VMMR3/CPUM.cpp
r64626 r64655 111 111 #include <VBox/vmm/cpumctx-v1_6.h> 112 112 #include <VBox/vmm/pgm.h> 113 #include <VBox/vmm/ pdmapi.h>113 #include <VBox/vmm/apic.h> 114 114 #include <VBox/vmm/mm.h> 115 115 #include <VBox/vmm/em.h> … … 1158 1158 * continues to reside in the APIC device and we cache it here in the VCPU for all further accesses. 1159 1159 */ 1160 PDMApicGetBaseMsr(pVCpu, &pCtx->msrApicBase, true /* fIgnoreErrors */);1160 pCtx->msrApicBase = APICGetBaseMsrNoCheck(pVCpu); 1161 1161 LogRel(("CPUM%u: Cached APIC base MSR = %#RX64\n", pVCpu->idCpu, pVCpu->cpum.s.Guest.msrApicBase)); 1162 1162 } … … 1608 1608 1609 1609 /* Cache the local APIC base from the APIC device. During init. this is done in CPUMR3ResetCpu(). */ 1610 PDMApicGetBaseMsr(pVCpu, &pVCpu->cpum.s.Guest.msrApicBase, true /* fIgnoreErrors */);1610 pVCpu->cpum.s.Guest.msrApicBase = APICGetBaseMsrNoCheck(pVCpu); 1611 1611 LogRel(("CPUM%u: Cached APIC base MSR = %#RX64\n", idCpu, pVCpu->cpum.s.Guest.msrApicBase)); 1612 1612 … … 2530 2530 { 2531 2531 PVMCPU pVCpu = &pVM->aCpus[i]; 2532 PDMApicGetBaseMsr(pVCpu, &pVCpu->cpum.s.Guest.msrApicBase, true /* fIgnoreErrors */);2532 pVCpu->cpum.s.Guest.msrApicBase = APICGetBaseMsrNoCheck(pVCpu); 2533 2533 LogRel(("CPUM%u: Cached APIC base MSR = %#RX64\n", i, pVCpu->cpum.s.Guest.msrApicBase)); 2534 2534 } -
trunk/src/VBox/VMM/VMMR3/CPUMDbg.cpp
r63465 r64655 23 23 #include <VBox/vmm/cpum.h> 24 24 #include <VBox/vmm/dbgf.h> 25 #include <VBox/vmm/ pdmapi.h>25 #include <VBox/vmm/apic.h> 26 26 #include "CPUMInternal.h" 27 27 #include <VBox/vmm/vm.h> … … 422 422 case 3: rc = CPUMSetGuestCR3(pVCpu, u64Value); break; 423 423 case 4: rc = CPUMSetGuestCR4(pVCpu, u64Value); break; 424 case 8: rc = PDMApicSetTPR(pVCpu, (uint8_t)(u64Value << 4)); break;424 case 8: rc = APICSetTpr(pVCpu, (uint8_t)(u64Value << 4)); break; 425 425 default: 426 426 AssertFailedReturn(VERR_IPE_NOT_REACHED_DEFAULT_CASE); -
trunk/src/VBox/VMM/VMMR3/GIMMinimal.cpp
r62591 r64655 24 24 #include <VBox/vmm/cpum.h> 25 25 #include <VBox/vmm/tm.h> 26 #include <VBox/vmm/ pdmapi.h>26 #include <VBox/vmm/apic.h> 27 27 #include "GIMInternal.h" 28 28 #include <VBox/vmm/vm.h> … … 97 97 * 98 98 * This is done in the init. completed routine as we need PDM to be 99 * initialized (otherwise PDMApicGetTimerFreq() would fail).99 * initialized (otherwise APICGetTimerFreq() would fail). 100 100 */ 101 101 CPUMCPUIDLEAF HyperLeaf; … … 114 114 */ 115 115 uint64_t uApicFreq; 116 rc = PDMApicGetTimerFreq(pVM, &uApicFreq);116 rc = APICGetTimerFreq(pVM, &uApicFreq); 117 117 AssertLogRelRCReturn(rc, rc); 118 118 -
trunk/src/VBox/VMM/VMMR3/PDM.cpp
r64397 r64655 530 530 */ 531 531 if (pVM->pdm.s.Apic.pDevInsRC) 532 {533 532 pVM->pdm.s.Apic.pDevInsRC += offDelta; 534 pVM->pdm.s.Apic.pfnGetInterruptRC += offDelta;535 pVM->pdm.s.Apic.pfnSetBaseMsrRC += offDelta;536 pVM->pdm.s.Apic.pfnGetBaseMsrRC += offDelta;537 pVM->pdm.s.Apic.pfnSetTprRC += offDelta;538 pVM->pdm.s.Apic.pfnGetTprRC += offDelta;539 pVM->pdm.s.Apic.pfnWriteMsrRC += offDelta;540 pVM->pdm.s.Apic.pfnReadMsrRC += offDelta;541 pVM->pdm.s.Apic.pfnBusDeliverRC += offDelta;542 if (pVM->pdm.s.Apic.pfnLocalInterruptRC)543 pVM->pdm.s.Apic.pfnLocalInterruptRC += offDelta;544 pVM->pdm.s.Apic.pfnGetTimerFreqRC += offDelta;545 }546 533 547 534 /* -
trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
r64596 r64655 2845 2845 2846 2846 /** @interface_method_impl{PDMDEVHLPR3,pfnAPICRegister} */ 2847 static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns , PPDMAPICREG pApicReg)2847 static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns) 2848 2848 { 2849 2849 PDMDEV_ASSERT_DEVINS(pDevIns); 2850 2850 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3); 2851 LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: pApicReg=%p:{.u32Version=%#x, .pfnGetInterruptR3=%p, .pfnSetBaseMsrR3=%p, .pfnGetBaseMsrR3=%p, "2852 ".pfnSetTprR3=%p, .pfnGetTprR3=%p, .pfnWriteMsr3=%p, .pfnReadMsr3=%p, .pfnBusDeliverR3=%p, .pfnLocalInterruptR3=%p .pfnGetTimerFreqR3=%p, pszGetInterruptRC=%p:{%s}, pszSetBaseMsrRC=%p:{%s}, pszGetBaseMsrRC=%p:{%s}, "2853 ".pszSetTprRC=%p:{%s}, .pszGetTprRC=%p:{%s}, .pszWriteMsrRC=%p:{%s}, .pszReadMsrRC=%p:{%s}, .pszBusDeliverRC=%p:{%s}, .pszLocalInterruptRC=%p:{%s}, .pszGetTimerFreqRC=%p:{%s}}\n",2854 pDevIns->pReg->szName, pDevIns->iInstance, pApicReg, pApicReg->u32Version, pApicReg->pfnGetInterruptR3, pApicReg->pfnSetBaseMsrR3,2855 pApicReg->pfnGetBaseMsrR3, pApicReg->pfnSetTprR3, pApicReg->pfnGetTprR3, pApicReg->pfnWriteMsrR3, pApicReg->pfnReadMsrR3, pApicReg->pfnBusDeliverR3, pApicReg->pfnLocalInterruptR3, pApicReg->pfnGetTimerFreqR3, pApicReg->pszGetInterruptRC,2856 pApicReg->pszGetInterruptRC, pApicReg->pszSetBaseMsrRC, pApicReg->pszSetBaseMsrRC, pApicReg->pszGetBaseMsrRC, pApicReg->pszGetBaseMsrRC,2857 pApicReg->pszSetTprRC, pApicReg->pszSetTprRC, pApicReg->pszGetTprRC, pApicReg->pszGetTprRC, pApicReg->pszWriteMsrRC, pApicReg->pszWriteMsrRC, pApicReg->pszReadMsrRC, pApicReg->pszReadMsrRC, pApicReg->pszBusDeliverRC,2858 pApicReg->pszBusDeliverRC, pApicReg->pszLocalInterruptRC, pApicReg->pszLocalInterruptRC, pApicReg->pszGetTimerFreqRC, pApicReg->pszGetTimerFreqRC));2859 2860 /*2861 * Validate input.2862 */2863 if (pApicReg->u32Version != PDM_APICREG_VERSION)2864 {2865 AssertMsgFailed(("u32Version=%#x expected %#x\n", pApicReg->u32Version, PDM_APICREG_VERSION));2866 LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: returns %Rrc (version)\n", pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER));2867 return VERR_INVALID_PARAMETER;2868 }2869 if ( !pApicReg->pfnGetInterruptR32870 || !pApicReg->pfnSetBaseMsrR32871 || !pApicReg->pfnGetBaseMsrR32872 || !pApicReg->pfnSetTprR32873 || !pApicReg->pfnGetTprR32874 || !pApicReg->pfnWriteMsrR32875 || !pApicReg->pfnReadMsrR32876 || !pApicReg->pfnBusDeliverR32877 || !pApicReg->pfnLocalInterruptR32878 || !pApicReg->pfnGetTimerFreqR3)2879 {2880 Assert(pApicReg->pfnGetInterruptR3);2881 Assert(pApicReg->pfnSetBaseMsrR3);2882 Assert(pApicReg->pfnGetBaseMsrR3);2883 Assert(pApicReg->pfnSetTprR3);2884 Assert(pApicReg->pfnGetTprR3);2885 Assert(pApicReg->pfnWriteMsrR3);2886 Assert(pApicReg->pfnReadMsrR3);2887 Assert(pApicReg->pfnBusDeliverR3);2888 Assert(pApicReg->pfnLocalInterruptR3);2889 Assert(pApicReg->pfnGetTimerFreqR3);2890 LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: returns %Rrc (R3 callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER));2891 return VERR_INVALID_PARAMETER;2892 }2893 if ( ( pApicReg->pszGetInterruptRC2894 || pApicReg->pszSetBaseMsrRC2895 || pApicReg->pszGetBaseMsrRC2896 || pApicReg->pszSetTprRC2897 || pApicReg->pszGetTprRC2898 || pApicReg->pszWriteMsrRC2899 || pApicReg->pszReadMsrRC2900 || pApicReg->pszBusDeliverRC2901 || pApicReg->pszLocalInterruptRC2902 || pApicReg->pszGetTimerFreqRC)2903 && ( !VALID_PTR(pApicReg->pszGetInterruptRC)2904 || !VALID_PTR(pApicReg->pszSetBaseMsrRC)2905 || !VALID_PTR(pApicReg->pszGetBaseMsrRC)2906 || !VALID_PTR(pApicReg->pszSetTprRC)2907 || !VALID_PTR(pApicReg->pszGetTprRC)2908 || !VALID_PTR(pApicReg->pszWriteMsrRC)2909 || !VALID_PTR(pApicReg->pszReadMsrRC)2910 || !VALID_PTR(pApicReg->pszBusDeliverRC)2911 || !VALID_PTR(pApicReg->pszLocalInterruptRC)2912 || !VALID_PTR(pApicReg->pszGetTimerFreqRC))2913 )2914 {2915 Assert(VALID_PTR(pApicReg->pszGetInterruptRC));2916 Assert(VALID_PTR(pApicReg->pszSetBaseMsrRC));2917 Assert(VALID_PTR(pApicReg->pszGetBaseMsrRC));2918 Assert(VALID_PTR(pApicReg->pszSetTprRC));2919 Assert(VALID_PTR(pApicReg->pszGetTprRC));2920 Assert(VALID_PTR(pApicReg->pszReadMsrRC));2921 Assert(VALID_PTR(pApicReg->pszWriteMsrRC));2922 Assert(VALID_PTR(pApicReg->pszBusDeliverRC));2923 Assert(VALID_PTR(pApicReg->pszLocalInterruptRC));2924 Assert(VALID_PTR(pApicReg->pszGetTimerFreqRC));2925 LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: returns %Rrc (RC callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER));2926 return VERR_INVALID_PARAMETER;2927 }2928 if ( ( pApicReg->pszGetInterruptR02929 || pApicReg->pszSetBaseMsrR02930 || pApicReg->pszGetBaseMsrR02931 || pApicReg->pszSetTprR02932 || pApicReg->pszGetTprR02933 || pApicReg->pszWriteMsrR02934 || pApicReg->pszReadMsrR02935 || pApicReg->pszBusDeliverR02936 || pApicReg->pszLocalInterruptR02937 || pApicReg->pszGetTimerFreqR0)2938 && ( !VALID_PTR(pApicReg->pszGetInterruptR0)2939 || !VALID_PTR(pApicReg->pszSetBaseMsrR0)2940 || !VALID_PTR(pApicReg->pszGetBaseMsrR0)2941 || !VALID_PTR(pApicReg->pszSetTprR0)2942 || !VALID_PTR(pApicReg->pszGetTprR0)2943 || !VALID_PTR(pApicReg->pszReadMsrR0)2944 || !VALID_PTR(pApicReg->pszWriteMsrR0)2945 || !VALID_PTR(pApicReg->pszBusDeliverR0)2946 || !VALID_PTR(pApicReg->pszLocalInterruptR0)2947 || !VALID_PTR(pApicReg->pszGetTimerFreqR0))2948 )2949 {2950 Assert(VALID_PTR(pApicReg->pszGetInterruptR0));2951 Assert(VALID_PTR(pApicReg->pszSetBaseMsrR0));2952 Assert(VALID_PTR(pApicReg->pszGetBaseMsrR0));2953 Assert(VALID_PTR(pApicReg->pszSetTprR0));2954 Assert(VALID_PTR(pApicReg->pszGetTprR0));2955 Assert(VALID_PTR(pApicReg->pszReadMsrR0));2956 Assert(VALID_PTR(pApicReg->pszWriteMsrR0));2957 Assert(VALID_PTR(pApicReg->pszBusDeliverR0));2958 Assert(VALID_PTR(pApicReg->pszLocalInterruptR0));2959 Assert(VALID_PTR(pApicReg->pszGetTimerFreqR0));2960 LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: returns %Rrc (R0 callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER));2961 return VERR_INVALID_PARAMETER;2962 }2963 2851 2964 2852 /* … … 2969 2857 if (pVM->pdm.s.Apic.pDevInsR3) 2970 2858 { 2971 AssertMsgFailed(("Only one apicdevice is supported!\n"));2859 AssertMsgFailed(("Only one APIC device is supported!\n")); 2972 2860 LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER)); 2973 2861 return VERR_INVALID_PARAMETER; … … 2975 2863 2976 2864 /* 2977 * Resolve & initialize the RC bits. 2978 */ 2979 if (pApicReg->pszGetInterruptRC) 2980 { 2981 int rc = pdmR3DevGetSymbolRCLazy(pDevIns, pApicReg->pszGetInterruptRC, &pVM->pdm.s.Apic.pfnGetInterruptRC); 2982 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszGetInterruptRC, rc)); 2983 if (RT_SUCCESS(rc)) 2984 { 2985 rc = pdmR3DevGetSymbolRCLazy(pDevIns, pApicReg->pszSetBaseMsrRC, &pVM->pdm.s.Apic.pfnSetBaseMsrRC); 2986 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszSetBaseMsrRC, rc)); 2987 } 2988 if (RT_SUCCESS(rc)) 2989 { 2990 rc = pdmR3DevGetSymbolRCLazy(pDevIns, pApicReg->pszGetBaseMsrRC, &pVM->pdm.s.Apic.pfnGetBaseMsrRC); 2991 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszGetBaseMsrRC, rc)); 2992 } 2993 if (RT_SUCCESS(rc)) 2994 { 2995 rc = pdmR3DevGetSymbolRCLazy(pDevIns, pApicReg->pszSetTprRC, &pVM->pdm.s.Apic.pfnSetTprRC); 2996 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszSetTprRC, rc)); 2997 } 2998 if (RT_SUCCESS(rc)) 2999 { 3000 rc = pdmR3DevGetSymbolRCLazy(pDevIns, pApicReg->pszGetTprRC, &pVM->pdm.s.Apic.pfnGetTprRC); 3001 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszGetTprRC, rc)); 3002 } 3003 if (RT_SUCCESS(rc)) 3004 { 3005 rc = pdmR3DevGetSymbolRCLazy(pDevIns, pApicReg->pszWriteMsrRC, &pVM->pdm.s.Apic.pfnWriteMsrRC); 3006 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszWriteMsrRC, rc)); 3007 } 3008 if (RT_SUCCESS(rc)) 3009 { 3010 rc = pdmR3DevGetSymbolRCLazy(pDevIns, pApicReg->pszReadMsrRC, &pVM->pdm.s.Apic.pfnReadMsrRC); 3011 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszReadMsrRC, rc)); 3012 } 3013 if (RT_SUCCESS(rc)) 3014 { 3015 rc = pdmR3DevGetSymbolRCLazy(pDevIns, pApicReg->pszBusDeliverRC, &pVM->pdm.s.Apic.pfnBusDeliverRC); 3016 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszBusDeliverRC, rc)); 3017 } 3018 if (RT_SUCCESS(rc)) 3019 { 3020 rc = pdmR3DevGetSymbolRCLazy(pDevIns, pApicReg->pszLocalInterruptRC, &pVM->pdm.s.Apic.pfnLocalInterruptRC); 3021 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszLocalInterruptRC, rc)); 3022 } 3023 if (RT_SUCCESS(rc)) 3024 { 3025 rc = pdmR3DevGetSymbolRCLazy(pDevIns, pApicReg->pszGetTimerFreqRC, &pVM->pdm.s.Apic.pfnGetTimerFreqRC); 3026 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszGetTimerFreqRC, rc)); 3027 } 3028 if (RT_FAILURE(rc)) 3029 { 3030 LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); 3031 return rc; 3032 } 3033 pVM->pdm.s.Apic.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 3034 } 3035 else 3036 { 3037 pVM->pdm.s.Apic.pDevInsRC = 0; 3038 pVM->pdm.s.Apic.pfnGetInterruptRC = 0; 3039 pVM->pdm.s.Apic.pfnSetBaseMsrRC = 0; 3040 pVM->pdm.s.Apic.pfnGetBaseMsrRC = 0; 3041 pVM->pdm.s.Apic.pfnSetTprRC = 0; 3042 pVM->pdm.s.Apic.pfnGetTprRC = 0; 3043 pVM->pdm.s.Apic.pfnWriteMsrRC = 0; 3044 pVM->pdm.s.Apic.pfnReadMsrRC = 0; 3045 pVM->pdm.s.Apic.pfnBusDeliverRC = 0; 3046 pVM->pdm.s.Apic.pfnLocalInterruptRC = 0; 3047 pVM->pdm.s.Apic.pfnGetTimerFreqRC = 0; 3048 } 3049 3050 /* 3051 * Resolve & initialize the R0 bits. 3052 */ 3053 if (pApicReg->pszGetInterruptR0) 3054 { 3055 int rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pApicReg->pszGetInterruptR0, &pVM->pdm.s.Apic.pfnGetInterruptR0); 3056 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszGetInterruptR0, rc)); 3057 if (RT_SUCCESS(rc)) 3058 { 3059 rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pApicReg->pszSetBaseMsrR0, &pVM->pdm.s.Apic.pfnSetBaseMsrR0); 3060 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszSetBaseMsrR0, rc)); 3061 } 3062 if (RT_SUCCESS(rc)) 3063 { 3064 rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pApicReg->pszGetBaseMsrR0, &pVM->pdm.s.Apic.pfnGetBaseMsrR0); 3065 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszGetBaseMsrR0, rc)); 3066 } 3067 if (RT_SUCCESS(rc)) 3068 { 3069 rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pApicReg->pszSetTprR0, &pVM->pdm.s.Apic.pfnSetTprR0); 3070 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszSetTprR0, rc)); 3071 } 3072 if (RT_SUCCESS(rc)) 3073 { 3074 rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pApicReg->pszGetTprR0, &pVM->pdm.s.Apic.pfnGetTprR0); 3075 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszGetTprR0, rc)); 3076 } 3077 if (RT_SUCCESS(rc)) 3078 { 3079 rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pApicReg->pszWriteMsrR0, &pVM->pdm.s.Apic.pfnWriteMsrR0); 3080 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszWriteMsrR0, rc)); 3081 } 3082 if (RT_SUCCESS(rc)) 3083 { 3084 rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pApicReg->pszReadMsrR0, &pVM->pdm.s.Apic.pfnReadMsrR0); 3085 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszReadMsrR0, rc)); 3086 } 3087 if (RT_SUCCESS(rc)) 3088 { 3089 rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pApicReg->pszBusDeliverR0, &pVM->pdm.s.Apic.pfnBusDeliverR0); 3090 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszBusDeliverR0, rc)); 3091 } 3092 if (RT_SUCCESS(rc)) 3093 { 3094 rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pApicReg->pszLocalInterruptR0, &pVM->pdm.s.Apic.pfnLocalInterruptR0); 3095 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszLocalInterruptR0, rc)); 3096 } 3097 if (RT_SUCCESS(rc)) 3098 { 3099 rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pApicReg->pszGetTimerFreqR0, &pVM->pdm.s.Apic.pfnGetTimerFreqR0); 3100 AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszGetTimerFreqR0, rc)); 3101 } 3102 if (RT_FAILURE(rc)) 3103 { 3104 LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); 3105 return rc; 3106 } 3107 pVM->pdm.s.Apic.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 3108 Assert(pVM->pdm.s.Apic.pDevInsR0); 3109 } 3110 else 3111 { 3112 pVM->pdm.s.Apic.pfnGetInterruptR0 = 0; 3113 pVM->pdm.s.Apic.pfnSetBaseMsrR0 = 0; 3114 pVM->pdm.s.Apic.pfnGetBaseMsrR0 = 0; 3115 pVM->pdm.s.Apic.pfnSetTprR0 = 0; 3116 pVM->pdm.s.Apic.pfnGetTprR0 = 0; 3117 pVM->pdm.s.Apic.pfnWriteMsrR0 = 0; 3118 pVM->pdm.s.Apic.pfnReadMsrR0 = 0; 3119 pVM->pdm.s.Apic.pfnBusDeliverR0 = 0; 3120 pVM->pdm.s.Apic.pfnLocalInterruptR0 = 0; 3121 pVM->pdm.s.Apic.pfnGetTimerFreqR0 = 0; 3122 pVM->pdm.s.Apic.pDevInsR0 = 0; 3123 } 3124 3125 /* 3126 * Initialize the HC bits. 3127 */ 3128 pVM->pdm.s.Apic.pDevInsR3 = pDevIns; 3129 pVM->pdm.s.Apic.pfnGetInterruptR3 = pApicReg->pfnGetInterruptR3; 3130 pVM->pdm.s.Apic.pfnSetBaseMsrR3 = pApicReg->pfnSetBaseMsrR3; 3131 pVM->pdm.s.Apic.pfnGetBaseMsrR3 = pApicReg->pfnGetBaseMsrR3; 3132 pVM->pdm.s.Apic.pfnSetTprR3 = pApicReg->pfnSetTprR3; 3133 pVM->pdm.s.Apic.pfnGetTprR3 = pApicReg->pfnGetTprR3; 3134 pVM->pdm.s.Apic.pfnWriteMsrR3 = pApicReg->pfnWriteMsrR3; 3135 pVM->pdm.s.Apic.pfnReadMsrR3 = pApicReg->pfnReadMsrR3; 3136 pVM->pdm.s.Apic.pfnBusDeliverR3 = pApicReg->pfnBusDeliverR3; 3137 pVM->pdm.s.Apic.pfnLocalInterruptR3 = pApicReg->pfnLocalInterruptR3; 3138 pVM->pdm.s.Apic.pfnGetTimerFreqR3 = pApicReg->pfnGetTimerFreqR3; 3139 Log(("PDM: Registered APIC device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns)); 3140 2865 * Initialize the RC, R0 and HC bits. 2866 */ 2867 pVM->pdm.s.Apic.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2868 Assert(pVM->pdm.s.Apic.pDevInsRC); 2869 2870 pVM->pdm.s.Apic.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 2871 Assert(pVM->pdm.s.Apic.pDevInsR0); 2872 2873 pVM->pdm.s.Apic.pDevInsR3 = pDevIns; 3141 2874 LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS)); 3142 2875 return VINF_SUCCESS; -
trunk/src/VBox/VMM/VMMR3/PDMDevMiscHlp.cpp
r64596 r64655 25 25 #include <VBox/vmm/pgm.h> 26 26 #include <VBox/vmm/hm.h> 27 #include <VBox/vmm/apic.h> 27 28 #ifdef VBOX_WITH_REM 28 29 # include <VBox/vmm/rem.h> … … 51 52 { 52 53 PDMDEV_ASSERT_DEVINS(pDevIns); 53 PVM pVM = pDevIns->Internal.s.pVMR3;54 PVM pVM = pDevIns->Internal.s.pVMR3; 54 55 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 55 56 if (pVM->pdm.s.Apic.pfnLocalInterruptR3) 57 { 58 LogFlow(("pdmR3PicHlp_SetInterruptFF: caller='%s'/%d: Setting local interrupt on LAPIC\n", 59 pDevIns->pReg->szName, pDevIns->iInstance)); 60 61 /* Raise the LAPIC's LINT0 line instead of signaling the CPU directly. */ 62 /** @todo 'rcRZ' propagation to pfnLocalInterrupt from caller. */ 63 pVM->pdm.s.Apic.pfnLocalInterruptR3(pVM->pdm.s.Apic.pDevInsR3, pVCpu, 0 /* u8Pin */, 1 /* u8Level */, 64 VINF_SUCCESS /* rcRZ */); 65 return; 66 } 67 68 LogFlow(("pdmR3PicHlp_SetInterruptFF: caller='%s'/%d: VMCPU_FF_INTERRUPT_PIC %d -> 1\n", 69 pDevIns->pReg->szName, pDevIns->iInstance, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC))); 70 71 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC); 72 #ifdef VBOX_WITH_REM 73 REMR3NotifyInterruptSet(pVM, pVCpu); 74 #endif 75 VMR3NotifyCpuFFU(pVCpu->pUVCpu, VMNOTIFYFF_FLAGS_DONE_REM | VMNOTIFYFF_FLAGS_POKE); 56 APICLocalInterrupt(pVCpu, 0 /* u8Pin */, 1 /* u8Level */, VINF_SUCCESS /* rcRZ */); 76 57 } 77 58 … … 83 64 PVM pVM = pDevIns->Internal.s.pVMR3; 84 65 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 85 86 if (pVM->pdm.s.Apic.pfnLocalInterruptR3) 87 { 88 /* Raise the LAPIC's LINT0 line instead of signaling the CPU directly. */ 89 LogFlow(("pdmR3PicHlp_ClearInterruptFF: caller='%s'/%d: Clearing local interrupt on LAPIC\n", 90 pDevIns->pReg->szName, pDevIns->iInstance)); 91 92 /* Lower the LAPIC's LINT0 line instead of signaling the CPU directly. */ 93 /** @todo 'rcRZ' propagation to pfnLocalInterrupt from caller. */ 94 pVM->pdm.s.Apic.pfnLocalInterruptR3(pVM->pdm.s.Apic.pDevInsR3, pVCpu, 0 /* u8Pin */, 0 /* u8Level */, 95 VINF_SUCCESS /* rcRZ */); 96 return; 97 } 98 99 LogFlow(("pdmR3PicHlp_ClearInterruptFF: caller='%s'/%d: VMCPU_FF_INTERRUPT_PIC %d -> 0\n", 100 pDevIns->pReg->szName, pDevIns->iInstance, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC))); 101 102 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC); 103 #ifdef VBOX_WITH_REM 104 REMR3NotifyInterruptClear(pVM, pVCpu); 105 #endif 66 APICLocalInterrupt(pVCpu, 0 /* u8Pin */, 0 /* u8Level */, VINF_SUCCESS /* rcRZ */); 106 67 } 107 68 … … 183 144 184 145 /** @interface_method_impl{PDMIOAPICHLPR3,pfnApicBusDeliver} */ 185 static DECLCALLBACK(int) pdmR3IoApicHlp_ApicBusDeliver(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode, 186 uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc) 187 { 188 PDMDEV_ASSERT_DEVINS(pDevIns); 189 PVM pVM = pDevIns->Internal.s.pVMR3; 190 LogFlow(("pdmR3IoApicHlp_ApicBusDeliver: caller='%s'/%d: u8Dest=%RX8 u8DestMode=%RX8 u8DeliveryMode=%RX8 iVector=%RX8 u8Polarity=%RX8 u8TriggerMode=%RX8 uTagSrc=%#x\n", 191 pDevIns->pReg->szName, pDevIns->iInstance, u8Dest, u8DestMode, u8DeliveryMode, iVector, u8Polarity, u8TriggerMode, uTagSrc)); 192 if (pVM->pdm.s.Apic.pfnBusDeliverR3) 193 return pVM->pdm.s.Apic.pfnBusDeliverR3(pVM->pdm.s.Apic.pDevInsR3, u8Dest, u8DestMode, u8DeliveryMode, iVector, u8Polarity, u8TriggerMode, uTagSrc); 194 return VINF_SUCCESS; 146 static DECLCALLBACK(int) pdmR3IoApicHlp_ApicBusDeliver(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, 147 uint8_t u8DeliveryMode, uint8_t uVector, uint8_t u8Polarity, 148 uint8_t u8TriggerMode, uint32_t uTagSrc) 149 { 150 PDMDEV_ASSERT_DEVINS(pDevIns); 151 PVM pVM = pDevIns->Internal.s.pVMR3; 152 LogFlow(("pdmR3IoApicHlp_ApicBusDeliver: caller='%s'/%d: u8Dest=%RX8 u8DestMode=%RX8 u8DeliveryMode=%RX8 uVector=%RX8 u8Polarity=%RX8 u8TriggerMode=%RX8 uTagSrc=%#x\n", 153 pDevIns->pReg->szName, pDevIns->iInstance, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc)); 154 return APICBusDeliver(pVM, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc); 195 155 } 196 156 -
trunk/src/VBox/VMM/VMMRC/PDMRCDevice.cpp
r64596 r64655 29 29 #include <VBox/vmm/vmm.h> 30 30 #include <VBox/vmm/patm.h> 31 #include <VBox/vmm/apic.h> 31 32 32 33 #include <VBox/log.h> … … 432 433 PVM pVM = pDevIns->Internal.s.pVMRC; 433 434 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 434 435 if (pVM->pdm.s.Apic.pfnLocalInterruptRC) 436 { 437 LogFlow(("pdmRCPicHlp_SetInterruptFF: caller='%p'/%d: Setting local interrupt on LAPIC\n", 438 pDevIns, pDevIns->iInstance)); 439 /* Raise the LAPIC's LINT0 line instead of signaling the CPU directly. */ 440 /** @todo 'rcRZ' propagation to pfnLocalInterrupt from caller. */ 441 pVM->pdm.s.Apic.pfnLocalInterruptRC(pVM->pdm.s.Apic.pDevInsRC, pVCpu, 0 /* u8Pin */, 1 /* u8Level*/, 442 VINF_SUCCESS /*rcRZ*/); 443 return; 444 } 445 446 LogFlow(("pdmRCPicHlp_SetInterruptFF: caller=%p/%d: VMMCPU_FF_INTERRUPT_PIC %d -> 1\n", 447 pDevIns, pDevIns->iInstance, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC))); 448 449 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC); 435 /** @todo r=ramshankar: Propagating rcRZ and make all callers handle it? */ 436 APICLocalInterrupt(pVCpu, 0 /* u8Pin */, 1 /* u8Level */, VINF_SUCCESS /* rcRZ */); 450 437 } 451 438 … … 457 444 PVM pVM = pDevIns->Internal.s.CTX_SUFF(pVM); 458 445 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 459 460 if (pVM->pdm.s.Apic.pfnLocalInterruptRC) 461 { 462 /* Raise the LAPIC's LINT0 line instead of signaling the CPU directly. */ 463 LogFlow(("pdmRCPicHlp_ClearInterruptFF: caller='%s'/%d: Clearing local interrupt on LAPIC\n", 464 pDevIns, pDevIns->iInstance)); 465 /* Lower the LAPIC's LINT0 line instead of signaling the CPU directly. */ 466 /** @todo 'rcRZ' propagation to pfnLocalInterrupt from caller. */ 467 pVM->pdm.s.Apic.pfnLocalInterruptRC(pVM->pdm.s.Apic.pDevInsRC, pVCpu, 0 /* u8Pin */, 0 /* u8Level */, 468 VINF_SUCCESS /* rcRZ */); 469 return; 470 } 471 472 LogFlow(("pdmRCPicHlp_ClearInterruptFF: caller=%p/%d: VMCPU_FF_INTERRUPT_PIC %d -> 0\n", 473 pDevIns, pDevIns->iInstance, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC))); 474 475 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC); 446 /** @todo r=ramshankar: Propagating rcRZ and make all callers handle it? */ 447 APICLocalInterrupt(pVCpu, 0 /* u8Pin */, 0 /* u8Level */, VINF_SUCCESS /* rcRZ */); 476 448 } 477 449 … … 514 486 515 487 /** @interface_method_impl{PDMIOAPICHLPRC,pfnApicBusDeliver} */ 516 static DECLCALLBACK(int) pdmRCIoApicHlp_ApicBusDeliver(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, uint8_t u8DeliveryMode, 517 uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc) 488 static DECLCALLBACK(int) pdmRCIoApicHlp_ApicBusDeliver(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, 489 uint8_t u8DeliveryMode, uint8_t uVector, uint8_t u8Polarity, 490 uint8_t u8TriggerMode, uint32_t uTagSrc) 518 491 { 519 492 PDMDEV_ASSERT_DEVINS(pDevIns); 520 493 PVM pVM = pDevIns->Internal.s.pVMRC; 521 LogFlow(("pdmRCIoApicHlp_ApicBusDeliver: caller=%p/%d: u8Dest=%RX8 u8DestMode=%RX8 u8DeliveryMode=%RX8 iVector=%RX8 u8Polarity=%RX8 u8TriggerMode=%RX8 uTagSrc=%#x\n", 522 pDevIns, pDevIns->iInstance, u8Dest, u8DestMode, u8DeliveryMode, iVector, u8Polarity, u8TriggerMode, uTagSrc)); 523 Assert(pVM->pdm.s.Apic.pDevInsRC); 524 if (pVM->pdm.s.Apic.pfnBusDeliverRC) 525 return pVM->pdm.s.Apic.pfnBusDeliverRC(pVM->pdm.s.Apic.pDevInsRC, u8Dest, u8DestMode, u8DeliveryMode, iVector, 526 u8Polarity, u8TriggerMode, uTagSrc); 527 return VINF_SUCCESS; 494 LogFlow(("pdmRCIoApicHlp_ApicBusDeliver: caller=%p/%d: u8Dest=%RX8 u8DestMode=%RX8 u8DeliveryMode=%RX8 uVector=%RX8 u8Polarity=%RX8 u8TriggerMode=%RX8 uTagSrc=%#x\n", 495 pDevIns, pDevIns->iInstance, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc)); 496 return APICBusDeliver(pVM, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc); 528 497 } 529 498 -
trunk/src/VBox/VMM/include/APICInternal.h
r64596 r64655 1042 1042 /** MSR write disallowed due to incompatible config. */ 1043 1043 APICMSRACCESS_WRITE_DISALLOWED_CONFIG, 1044 /** MSR read disallowed due to incompatible config. */ 1045 APICMSRACCESS_READ_DISALLOWED_CONFIG, 1044 1046 /* Count of enum members (don't use). */ 1045 1047 APICMSRACCESS_COUNT -
trunk/src/VBox/VMM/include/PDMInternal.h
r64596 r64655 556 556 /** Pointer to the APIC device instance - R3 Ptr. */ 557 557 PPDMDEVINSR3 pDevInsR3; 558 /** @copydoc PDMAPICREG::pfnGetInterruptR3 */559 DECLR3CALLBACKMEMBER(int, pfnGetInterruptR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint8_t *pu8Vector,560 uint32_t *pu32TagSrc));561 /** @copydoc PDMAPICREG::pfnSetBaseMsrR3 */562 DECLR3CALLBACKMEMBER(VBOXSTRICTRC, pfnSetBaseMsrR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint64_t u64Base));563 /** @copydoc PDMAPICREG::pfnGetBaseMsrR3 */564 DECLR3CALLBACKMEMBER(uint64_t, pfnGetBaseMsrR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu));565 /** @copydoc PDMAPICREG::pfnSetTprR3 */566 DECLR3CALLBACKMEMBER(void, pfnSetTprR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint8_t u8Tpr));567 /** @copydoc PDMAPICREG::pfnGetTprR3 */568 DECLR3CALLBACKMEMBER(uint8_t, pfnGetTprR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu, bool *pfPending, uint8_t *pu8PendingIntr));569 /** @copydoc PDMAPICREG::pfnWriteMsrR3 */570 DECLR3CALLBACKMEMBER(VBOXSTRICTRC, pfnWriteMsrR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint32_t u32Reg, uint64_t u64Value));571 /** @copydoc PDMAPICREG::pfnReadMsrR3 */572 DECLR3CALLBACKMEMBER(VBOXSTRICTRC, pfnReadMsrR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint32_t u32Reg, uint64_t *pu64Value));573 /** @copydoc PDMAPICREG::pfnBusDeliverR3 */574 DECLR3CALLBACKMEMBER(int, pfnBusDeliverR3,(PPDMDEVINS pDevIns, uint8_t uDest, uint8_t uDestMode,575 uint8_t uDeliveryMode, uint8_t uVector, uint8_t uPolarity,576 uint8_t uTriggerMode, uint32_t uTagSrc));577 /** @copydoc PDMAPICREG::pfnLocalInterruptR3 */578 DECLR3CALLBACKMEMBER(VBOXSTRICTRC, pfnLocalInterruptR3,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint8_t u8Pin, uint8_t u8Level,579 int rcRZ));580 /** @copydoc PDMAPICREG::pfnGetTimerFreqR3 */581 DECLR3CALLBACKMEMBER(uint64_t, pfnGetTimerFreqR3,(PPDMDEVINS pDevIns));582 583 558 /** Pointer to the APIC device instance - R0 Ptr. */ 584 559 PPDMDEVINSR0 pDevInsR0; 585 /** @copydoc PDMAPICREG::pfnGetInterruptR3 */586 DECLR0CALLBACKMEMBER(int, pfnGetInterruptR0,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint8_t *pu8Vector,587 uint32_t *pu32TagSrc));588 /** @copydoc PDMAPICREG::pfnSetBaseMsrR3 */589 DECLR0CALLBACKMEMBER(VBOXSTRICTRC, pfnSetBaseMsrR0,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint64_t u64Base));590 /** @copydoc PDMAPICREG::pfnGetBaseMsrR3 */591 DECLR0CALLBACKMEMBER(uint64_t, pfnGetBaseMsrR0,(PPDMDEVINS pDevIns, PVMCPU pVCpu));592 /** @copydoc PDMAPICREG::pfnSetTprR3 */593 DECLR0CALLBACKMEMBER(void, pfnSetTprR0,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint8_t u8Tpr));594 /** @copydoc PDMAPICREG::pfnGetTprR3 */595 DECLR0CALLBACKMEMBER(uint8_t, pfnGetTprR0,(PPDMDEVINS pDevIns, PVMCPU pVCpu, bool *pfPending, uint8_t *pu8PendingIntr));596 /** @copydoc PDMAPICREG::pfnWriteMsrR3 */597 DECLR0CALLBACKMEMBER(VBOXSTRICTRC, pfnWriteMsrR0,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint32_t u32Reg, uint64_t u64Value));598 /** @copydoc PDMAPICREG::pfnReadMsrR3 */599 DECLR0CALLBACKMEMBER(VBOXSTRICTRC, pfnReadMsrR0,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint32_t u32Reg, uint64_t *pu64Value));600 /** @copydoc PDMAPICREG::pfnBusDeliverR3 */601 DECLR0CALLBACKMEMBER(int, pfnBusDeliverR0,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode,602 uint8_t u8DeliveryMode, uint8_t iVector, uint8_t u8Polarity,603 uint8_t u8TriggerMode, uint32_t uTagSrc));604 /** @copydoc PDMAPICREG::pfnLocalInterruptR3 */605 DECLR0CALLBACKMEMBER(VBOXSTRICTRC, pfnLocalInterruptR0,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint8_t u8Pin, uint8_t u8Level,606 int rcRZ));607 /** @copydoc PDMAPICREG::pfnGetTimerFreqR3 */608 DECLR0CALLBACKMEMBER(uint64_t, pfnGetTimerFreqR0,(PPDMDEVINS pDevIns));609 610 560 /** Pointer to the APIC device instance - RC Ptr. */ 611 561 PPDMDEVINSRC pDevInsRC; 612 /** @copydoc PDMAPICREG::pfnGetInterruptR3 */613 DECLRCCALLBACKMEMBER(int, pfnGetInterruptRC,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint8_t *pu8Vector,614 uint32_t *pu32TagSrc));615 /** @copydoc PDMAPICREG::pfnSetBaseMsrR3 */616 DECLRCCALLBACKMEMBER(VBOXSTRICTRC, pfnSetBaseMsrRC,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint64_t u64Base));617 /** @copydoc PDMAPICREG::pfnGetBaseMsrR3 */618 DECLRCCALLBACKMEMBER(uint64_t, pfnGetBaseMsrRC,(PPDMDEVINS pDevIns, PVMCPU pVCpu));619 /** @copydoc PDMAPICREG::pfnSetTprR3 */620 DECLRCCALLBACKMEMBER(void, pfnSetTprRC,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint8_t u8Tpr));621 /** @copydoc PDMAPICREG::pfnGetTprR3 */622 DECLRCCALLBACKMEMBER(uint8_t, pfnGetTprRC,(PPDMDEVINS pDevIns, PVMCPU pVCpu, bool *pfPending, uint8_t *pu8PendingIntr));623 /** @copydoc PDMAPICREG::pfnWriteMsrR3 */624 DECLRCCALLBACKMEMBER(VBOXSTRICTRC, pfnWriteMsrRC,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint32_t u32Reg, uint64_t u64Value));625 /** @copydoc PDMAPICREG::pfnReadMsrR3 */626 DECLRCCALLBACKMEMBER(VBOXSTRICTRC, pfnReadMsrRC,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint32_t u32Reg, uint64_t *pu64Value));627 /** @copydoc PDMAPICREG::pfnBusDeliverR3 */628 DECLRCCALLBACKMEMBER(int, pfnBusDeliverRC,(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode,629 uint8_t u8DeliveryMode, uint8_t iVector, uint8_t u8Polarity,630 uint8_t u8TriggerMode, uint32_t uTagSrc));631 /** @copydoc PDMAPICREG::pfnLocalInterruptR3 */632 DECLRCCALLBACKMEMBER(VBOXSTRICTRC, pfnLocalInterruptRC,(PPDMDEVINS pDevIns, PVMCPU pVCpu, uint8_t u8Pin, uint8_t u8Level,633 int rcRZ));634 /** @copydoc PDMAPICREG::pfnGetTimerFreqR3 */635 DECLRCCALLBACKMEMBER(uint64_t, pfnGetTimerFreqRC,(PPDMDEVINS pDevIns));636 637 562 uint8_t Alignment[4]; 638 563 } PDMAPIC; -
trunk/src/VBox/VMM/testcase/tstVMStruct.h
r64626 r64655 446 446 GEN_CHECK_OFF(PDM, Apic); 447 447 GEN_CHECK_OFF_DOT(PDM, Apic.pDevInsR3); 448 GEN_CHECK_OFF_DOT(PDM, Apic.pfnGetInterruptR3);449 GEN_CHECK_OFF_DOT(PDM, Apic.pfnSetBaseMsrR3);450 GEN_CHECK_OFF_DOT(PDM, Apic.pfnGetBaseMsrR3);451 GEN_CHECK_OFF_DOT(PDM, Apic.pfnSetTprR3);452 GEN_CHECK_OFF_DOT(PDM, Apic.pfnWriteMsrR3);453 GEN_CHECK_OFF_DOT(PDM, Apic.pfnReadMsrR3);454 GEN_CHECK_OFF_DOT(PDM, Apic.pfnGetTprR3);455 GEN_CHECK_OFF_DOT(PDM, Apic.pfnBusDeliverR3);456 448 GEN_CHECK_OFF_DOT(PDM, Apic.pDevInsR0); 457 GEN_CHECK_OFF_DOT(PDM, Apic.pfnGetInterruptR0);458 GEN_CHECK_OFF_DOT(PDM, Apic.pfnSetBaseMsrR0);459 GEN_CHECK_OFF_DOT(PDM, Apic.pfnGetBaseMsrR0);460 GEN_CHECK_OFF_DOT(PDM, Apic.pfnSetTprR0);461 GEN_CHECK_OFF_DOT(PDM, Apic.pfnGetTprR0);462 GEN_CHECK_OFF_DOT(PDM, Apic.pfnWriteMsrR0);463 GEN_CHECK_OFF_DOT(PDM, Apic.pfnReadMsrR0);464 GEN_CHECK_OFF_DOT(PDM, Apic.pfnBusDeliverR0);465 449 GEN_CHECK_OFF_DOT(PDM, Apic.pDevInsRC); 466 GEN_CHECK_OFF_DOT(PDM, Apic.pfnGetInterruptRC);467 GEN_CHECK_OFF_DOT(PDM, Apic.pfnSetBaseMsrRC);468 GEN_CHECK_OFF_DOT(PDM, Apic.pfnGetBaseMsrRC);469 GEN_CHECK_OFF_DOT(PDM, Apic.pfnSetTprRC);470 GEN_CHECK_OFF_DOT(PDM, Apic.pfnGetTprRC);471 GEN_CHECK_OFF_DOT(PDM, Apic.pfnWriteMsrRC);472 GEN_CHECK_OFF_DOT(PDM, Apic.pfnReadMsrRC);473 GEN_CHECK_OFF_DOT(PDM, Apic.pfnBusDeliverRC);474 450 GEN_CHECK_OFF(PDM, IoApic); 475 451 GEN_CHECK_OFF_DOT(PDM, IoApic.pDevInsR3); -
trunk/src/recompiler/VBoxREMWrapper.cpp
r64626 r64655 538 538 { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL } 539 539 }; 540 static const REMPARMDESC g_aArgsAPICGetTpr[] = 541 { 542 { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL }, 543 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *), NULL }, 544 { REMPARMDESC_FLAGS_INT, sizeof(bool *), NULL }, 545 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *), NULL } 546 }; 547 static const REMPARMDESC g_aArgsAPICSetTpr[] = 548 { 549 { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL }, 550 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t), NULL } 551 }; 540 552 static const REMPARMDESC g_aArgsCPUMGetGuestCpl[] = 541 553 { … … 737 749 { REMPARMDESC_FLAGS_INT, sizeof(RTRCPTR), NULL }, 738 750 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *), NULL } 739 };740 static const REMPARMDESC g_aArgsPDMApicGetBase[] =741 {742 { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },743 { REMPARMDESC_FLAGS_INT, sizeof(uint64_t *), NULL }744 };745 static const REMPARMDESC g_aArgsPDMApicGetTPR[] =746 {747 { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },748 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *), NULL },749 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *), NULL },750 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *), NULL }751 };752 static const REMPARMDESC g_aArgsPDMApicSetBase[] =753 {754 { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },755 { REMPARMDESC_FLAGS_INT, sizeof(uint64_t), NULL }756 };757 static const REMPARMDESC g_aArgsPDMApicSetTPR[] =758 {759 { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },760 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t), NULL }761 751 }; 762 752 static const REMPARMDESC g_aArgsPDMGetInterrupt[] = … … 1216 1206 { 1217 1207 { "APICUpdatePendingInterrupts", VMM_FN(APICUpdatePendingInterrupts), &g_aArgsAPICUpdatePendingInterrupts[0], RT_ELEMENTS(g_aArgsAPICUpdatePendingInterrupts), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, 1208 { "APICGetTpr", VMM_FN(APICGetTpr), &g_aArgsAPICGetTpr[0], RT_ELEMENTS(g_aArgsAPICGetTpr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1209 { "APICSetTpr", VMM_FN(APICSetTpr), &g_aArgsAPICSetTpr[0], RT_ELEMENTS(g_aArgsAPICSetTpr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1218 1210 { "CPUMR3RemEnter", VMM_FN(CPUMR3RemEnter), &g_aArgsCPUMR3RemEnter[0], RT_ELEMENTS(g_aArgsCPUMR3RemEnter), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL }, 1219 1211 { "CPUMR3RemLeave", VMM_FN(CPUMR3RemLeave), &g_aArgsCPUMR3RemLeave[0], RT_ELEMENTS(g_aArgsCPUMR3RemLeave), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, … … 1266 1258 { "PATMIsPatchGCAddr", VMM_FN(PATMIsPatchGCAddr), &g_aArgsPATMIsPatchGCAddr[0], RT_ELEMENTS(g_aArgsPATMIsPatchGCAddr), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL }, 1267 1259 { "PATMR3QueryOpcode", VMM_FN(PATMR3QueryOpcode), &g_aArgsPATMR3QueryOpcode[0], RT_ELEMENTS(g_aArgsPATMR3QueryOpcode), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1268 { "PDMApicGetBaseMsr", VMM_FN(PDMApicGetBaseMsr), &g_aArgsPDMApicGetBaseMsr[0], RT_ELEMENTS(g_aArgsPDMApicGetBase), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },1269 { "PDMApicGetTPR", VMM_FN(PDMApicGetTPR), &g_aArgsPDMApicGetTPR[0], RT_ELEMENTS(g_aArgsPDMApicGetTPR), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },1270 { "PDMApicSetBase", VMM_FN(PDMApicSetBaseMsr), &g_aArgsPDMApicSetBaseMsr[0], RT_ELEMENTS(g_aArgsPDMApicSetBase), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },1271 { "PDMApicSetTPR", VMM_FN(PDMApicSetTPR), &g_aArgsPDMApicSetTPR[0], RT_ELEMENTS(g_aArgsPDMApicSetTPR), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },1272 1260 { "PDMR3DmaRun", VMM_FN(PDMR3DmaRun), &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, 1273 1261 { "PDMR3CritSectInit", VMM_FN(PDMR3CritSectInit), &g_aArgsPDMR3CritSectInit[0], RT_ELEMENTS(g_aArgsPDMR3CritSectInit), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, -
trunk/src/recompiler/VBoxRecompiler.c
r64626 r64655 4543 4543 void cpu_set_apic_tpr(CPUX86State *env, uint8_t val) 4544 4544 { 4545 int rc = PDMApicSetTPR(env->pVCpu, val << 4); /* cr8 bits 3-0 correspond to bits 7-4 of the task priority mmio register. */4545 int rc = APICSetTpr(env->pVCpu, val << 4); /* cr8 bits 3-0 correspond to bits 7-4 of the task priority mmio register. */ 4546 4546 LogFlow(("cpu_set_apic_tpr: val=%#x rc=%Rrc\n", val, rc)); NOREF(rc); 4547 4547 } … … 4550 4550 { 4551 4551 uint8_t u8; 4552 int rc = PDMApicGetTPR(env->pVCpu, &u8, NULL, NULL);4552 int rc = APICGetTpr(env->pVCpu, &u8, NULL, NULL); 4553 4553 if (RT_SUCCESS(rc)) 4554 4554 {
Note:
See TracChangeset
for help on using the changeset viewer.