VirtualBox

Changeset 60601 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Apr 20, 2016 2:03:01 PM (9 years ago)
Author:
vboxsync
Message:

VMM/APIC: Saved-state, work-in-progress.

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/APICAll.cpp

    r60593 r60601  
    105105
    106106/**
    107  * Atomically tests and sets the PIB notification bit.
    108  *
    109  * @returns true if the bit was already set, false otherwise.
    110  * @param   pvPib           Opaque pointer to the PIB.
    111  */
    112 DECLINLINE(bool) apicSetNotificationBitInPib(volatile void *pvPib)
    113 {
    114     return ASMAtomicBitTestAndSet(pvPib, XAPIC_PIB_NOTIFICATION_BIT);
     107 * Atomically sets the PIB notification bit.
     108 *
     109 * @returns non-zero if the bit was already set, 0 otherwise.
     110 * @param   pApicPib        Pointer to the PIB.
     111 */
     112DECLINLINE(uint32_t) apicSetNotificationBitInPib(PAPICPIB pApicPib)
     113{
     114    return ASMAtomicXchgU32(&pApicPib->fOutstandingNotification, RT_BIT_32(31));
    115115}
    116116
     
    119119 * Atomically tests and clears the PIB notification bit.
    120120 *
    121  * @returns true if the bit was already set, false otherwise.
    122  */
    123 DECLINLINE(bool) apicClearNotificationBitInPib(volatile void *pvPib)
    124 {
    125     return ASMAtomicBitTestAndClear(pvPib, XAPIC_PIB_NOTIFICATION_BIT);
     121 * @returns non-zero if the bit was already set, 0 otherwise.
     122 * @param   pApicPib        Pointer to the PIB.
     123 */
     124DECLINLINE(uint32_t) apicClearNotificationBitInPib(PAPICPIB pApicPib)
     125{
     126    return ASMAtomicXchgU32(&pApicPib->fOutstandingNotification, UINT32_C(0));
    126127}
    127128
     
    24422443                else
    24432444                {
    2444                     Assert(CTX_SUFF(pApicCpu->pvApicPib));
    2445                     apicSetVectorInPib(CTX_SUFF(pApicCpu->pvApicPib), uVector);
    2446                     bool const fAlreadySet = apicSetNotificationBitInPib(CTX_SUFF(pApicCpu->pvApicPib));
     2445                    apicSetVectorInPib(pApicCpu->CTX_SUFF(pvApicPib), uVector);
     2446                    uint32_t const fAlreadySet = apicSetNotificationBitInPib((PAPICPIB)pApicCpu->CTX_SUFF(pvApicPib));
    24472447                    if (!fAlreadySet)
    24482448                        APICSetInterruptFF(pVCpu, PDMAPICIRQ_HARDWARE);
     
    24552455                 * delivered asynchronously.
    24562456                 */
    2457                 apicSetVectorInPib(&pApicCpu->ApicPibLevel.aVectorBitmap[0], uVector);
    2458                 bool const fAlreadySet = apicSetNotificationBitInPib(&pApicCpu->ApicPibLevel.aVectorBitmap[0]);
     2457                apicSetVectorInPib(&pApicCpu->ApicPibLevel, uVector);
     2458                uint32_t const fAlreadySet = apicSetNotificationBitInPib((PAPICPIB)&pApicCpu->ApicPibLevel);
    24592459                if (!fAlreadySet)
    24602460                    APICSetInterruptFF(pVCpu, PDMAPICIRQ_HARDWARE);
     
    26362636    for (;;)
    26372637    {
    2638         bool const fAlreadySet = apicClearNotificationBitInPib(CTX_SUFF(pApicCpu->pvApicPib));
     2638        uint32_t const fAlreadySet = apicClearNotificationBitInPib((PAPICPIB)pApicCpu->CTX_SUFF(pvApicPib));
    26392639        if (!fAlreadySet)
    26402640            break;
     
    26632663    for (;;)
    26642664    {
    2665         bool const fAlreadySet = apicClearNotificationBitInPib(&pApicCpu->ApicPibLevel);
     2665        uint32_t const fAlreadySet = apicClearNotificationBitInPib((PAPICPIB)&pApicCpu->ApicPibLevel);
    26662666        if (!fAlreadySet)
    26672667            break;
  • trunk/src/VBox/VMM/VMMR3/APIC.cpp

    r60593 r60601  
    148148};
    149149
     150/** Saved state field descriptors for APICPIB. */
     151static const SSMFIELD g_aApicPibFields[] =
     152{
     153    SSMFIELD_ENTRY(APICPIB,    aVectorBitmap[0]),
     154    SSMFIELD_ENTRY(APICPIB,    aVectorBitmap[1]),
     155    SSMFIELD_ENTRY(APICPIB,    aVectorBitmap[2]),
     156    SSMFIELD_ENTRY(APICPIB,    aVectorBitmap[3]),
     157    SSMFIELD_ENTRY(APICPIB,    fOutstandingNotification),
     158    SSMFIELD_ENTRY_TERM()
     159};
    150160
    151161/**
     
    655665        PCAPICCPU pApicCpu = VMCPU_TO_APICCPU(pVCpu);
    656666
     667        /* Save the auxiliary data. */
    657668        SSMR3PutU64(pSSM, pApicCpu->uApicBaseMsr);
    658 
    659         /** @todo  */
     669        SSMR3PutU32(pSSM, pApicCpu->uEsrInternal);
     670
     671        /* Save the APIC page. */
     672        if (XAPIC_IN_X2APIC_MODE(pVCpu))
     673            SSMR3PutStruct(pSSM, (const void *)pApicCpu->pvApicPageR3, g_aX2ApicPageFields);
     674        else
     675            SSMR3PutStruct(pSSM, (const void *)pApicCpu->pvApicPageR3, g_aXApicPageFields);
     676
     677        /* Save the PIBs: We could in theory push them to vIRR and avoid saving them,
     678           but in case of posted-interrupts we can't do that at this point, so save in all cases. */
     679        SSMR3PutStruct(pSSM, (const void *)pApicCpu->pvApicPibR3,   g_aApicPibFields);
     680        SSMR3PutStruct(pSSM, (const void *)&pApicCpu->ApicPibLevel, g_aApicPibFields);
     681
     682        /* Save the timer. */
     683        TMR3TimerSave(pApicCpu->pTimerR3, pSSM);
     684        SSMR3PutU64(pSSM, pApicCpu->u64TimerInitial);
     685
     686        /** @todo anything else? */
    660687    }
    661688
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette