VirtualBox

Changeset 47280 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Jul 19, 2013 6:58:17 PM (12 years ago)
Author:
vboxsync
Message:

IEM: TPR access.

Location:
trunk/src/VBox/VMM/VMMAll
Files:
3 edited

Legend:

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

    r47279 r47280  
    8383#include <VBox/vmm/iem.h>
    8484#include <VBox/vmm/cpum.h>
     85#include <VBox/vmm/pdm.h>
    8586#include <VBox/vmm/pgm.h>
    8687#include <internal/pgm.h>
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h

    r47271 r47280  
    31573157        case 4: crX = pCtx->cr4; break;
    31583158        case 8:
    3159             if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
    3160                 IEM_RETURN_ASPECT_NOT_IMPLEMENTED_LOG(("Implement CR8/TPR read\n")); /** @todo implement CR8 reading and writing. */
     3159        {
     3160            uint8_t uTpr;
     3161            int rc = PDMApicGetTPR(IEMCPU_TO_VMCPU(pIemCpu), &uTpr, NULL, NULL);
     3162            if (RT_SUCCESS(rc))
     3163                crX = uTpr >> 4;
    31613164            else
    3162                 crX = 0xff;
     3165                crX = 0;
    31633166            break;
     3167        }
    31643168        IEM_NOT_REACHED_DEFAULT_CASE_RET(); /* call checks */
    31653169    }
     
    34483452         */
    34493453        case 8:
     3454            if (uNewCrX & ~(uint64_t)0xf)
     3455            {
     3456                Log(("Trying to set reserved CR8 bits (%#RX64)\n", uNewCrX));
     3457                return iemRaiseGeneralProtectionFault0(pIemCpu);
     3458            }
     3459
    34503460            if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
    3451                 IEM_RETURN_ASPECT_NOT_IMPLEMENTED_LOG(("Implement CR8/TPR read\n")); /** @todo implement CR8 reading and writing. */
    3452             else
    3453                 rcStrict = VINF_SUCCESS;
     3461                PDMApicSetTPR(IEMCPU_TO_VMCPU(pIemCpu), (uint8_t)uNewCrX << 4);
     3462            rcStrict = VINF_SUCCESS;
    34543463            break;
    34553464
  • trunk/src/VBox/VMM/VMMAll/PDMAll.cpp

    r46420 r47280  
    313313 * Get the TPR (task priority register).
    314314 *
    315  * @returns The current TPR.
     315 * @returns VINF_SUCCESS or VERR_PDM_NO_APIC_INSTANCE.
    316316 * @param   pVCpu           Pointer to the VMCPU.
    317317 * @param   pu8TPR          Where to store the TRP.
    318  * @param   pfPending       Pending interrupt state (out).
     318 * @param   pfPending       Pending interrupt state (out, optional).
    319319 * @param   pu8PendingIrq   Where to store the highest-priority pending IRQ
    320  *                          (optional, can be NULL) (out).
     320 *                          (out, optional).
    321321 *
    322322 * @remarks No-long-jump zone!!!
     
    324324VMMDECL(int) PDMApicGetTPR(PVMCPU pVCpu, uint8_t *pu8TPR, bool *pfPending, uint8_t *pu8PendingIrq)
    325325{
    326     PVM pVM = pVCpu->CTX_SUFF(pVM);
    327     if (pVM->pdm.s.Apic.CTX_SUFF(pDevIns))
     326    PVM     pVM      = pVCpu->CTX_SUFF(pVM);
     327    PPDMDEVINS pApicIns = pVM->pdm.s.Apic.CTX_SUFF(pDevIns);
     328    if (pApicIns)
    328329    {
    329330        /*
     
    333334         */
    334335        Assert(pVM->pdm.s.Apic.CTX_SUFF(pfnGetTPR));
    335         *pu8TPR = pVM->pdm.s.Apic.CTX_SUFF(pfnGetTPR)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), pVCpu->idCpu);
     336        *pu8TPR = pVM->pdm.s.Apic.CTX_SUFF(pfnGetTPR)(pApicIns, pVCpu->idCpu);
    336337        if (pfPending)
    337         {
    338             *pfPending = pVM->pdm.s.Apic.CTX_SUFF(pfnHasPendingIrq)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), pVCpu->idCpu,
    339                                                                     pu8PendingIrq);
    340         }
     338            *pfPending = pVM->pdm.s.Apic.CTX_SUFF(pfnHasPendingIrq)(pApicIns, pVCpu->idCpu, pu8PendingIrq);
    341339        return VINF_SUCCESS;
    342340    }
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