VirtualBox

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


Ignore:
Timestamp:
Jan 11, 2024 2:23:53 PM (11 months ago)
Author:
vboxsync
Message:

VMM/IEM: Preserve variable and shadow register state across code TLB load calls. bugref:10371

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

Legend:

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

    r102841 r102846  
    11871187
    11881188    /*
    1189      * Move/spill/flush stuff out of call-volatile registers.
    1190      * This is the easy way out. We could contain this to the tlb-miss branch
    1191      * by saving and restoring active stuff here.
    1192      */
    1193     /** @todo save+restore active registers and maybe guest shadows in tlb-miss.  */
    1194     off = iemNativeRegMoveAndFreeAndFlushAtCall(pReNative, off, 0 /* vacate all non-volatile regs */);
    1195 
    1196     /*
    11971189     * Define labels and allocate the register for holding the GCPhys of the new page.
    11981190     */
     
    12121204    iemNativeLabelDefine(pReNative, idxLabelTlbMiss, off);
    12131205
     1206    /* Save variables in volatile registers. */
     1207    uint32_t const fHstRegsNotToSave = /*TlbState.getRegsNotToSave() | */ RT_BIT_32(idxRegGCPhys);
     1208    off = iemNativeVarSaveVolatileRegsPreHlpCall(pReNative, off, fHstRegsNotToSave);
     1209
    12141210    /* IEMNATIVE_CALL_ARG1_GREG = offInstr */
    12151211    off = iemNativeEmitLoadGpr8Imm(pReNative, off, IEMNATIVE_CALL_ARG1_GREG, offInstr);
     
    12241220    if (idxRegGCPhys != IEMNATIVE_CALL_RET_GREG)
    12251221        off = iemNativeEmitLoadGprFromGpr(pReNative, off, idxRegGCPhys, IEMNATIVE_CALL_RET_GREG);
     1222
     1223    /* Restore variables and guest shadow registers to volatile registers. */
     1224    off = iemNativeVarRestoreVolatileRegsPostHlpCall(pReNative, off, fHstRegsNotToSave);
     1225    off = iemNativeRegRestoreGuestShadowsInVolatileRegs(pReNative, off, 0 /*TlbState.getActiveRegsWithShadows()*/);
    12261226
    12271227    iemNativeLabelDefine(pReNative, idxLabelTlbDone, off);
     
    15051505    iemNativeLabelDefine(pReNative, idxLabelTlbMiss, off);
    15061506
     1507    /* Save variables in volatile registers. */
     1508    uint32_t const fHstRegsNotToSave = /*TlbState.getRegsNotToSave() | */ RT_BIT_32(idxRegTmp) | RT_BIT_32(idxRegTmp);
     1509    off = iemNativeVarSaveVolatileRegsPreHlpCall(pReNative, off, fHstRegsNotToSave);
     1510
    15071511    /* IEMNATIVE_CALL_ARG0_GREG = pVCpu */
    15081512    off = iemNativeEmitLoadGprFromGpr(pReNative, off, IEMNATIVE_CALL_ARG0_GREG, IEMNATIVE_REG_FIXED_PVMCPU);
     
    15101514    /* Done setting up parameters, make the call. */
    15111515    off = iemNativeEmitCallImm(pReNative, off, (uintptr_t)iemNativeHlpMemCodeNewPageTlbMiss);
     1516
     1517    /* Restore variables and guest shadow registers to volatile registers. */
     1518    off = iemNativeVarRestoreVolatileRegsPostHlpCall(pReNative, off, fHstRegsNotToSave);
     1519    off = iemNativeRegRestoreGuestShadowsInVolatileRegs(pReNative, off, 0 /*TlbState.getActiveRegsWithShadows()*/);
    15121520
    15131521    /* Jmp back to the start and redo the checks. */
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp

    r102801 r102846  
    74487448 * @param   fHstRegsNotToSave   Set of registers not to save & restore.
    74497449 */
    7450 DECL_INLINE_THROW(uint32_t)
     7450DECL_HIDDEN_THROW(uint32_t)
    74517451iemNativeVarSaveVolatileRegsPreHlpCall(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint32_t fHstRegsNotToSave)
    74527452{
     
    75217521 *          iemNativeRegRestoreGuestShadowsInVolatileRegs()
    75227522 */
    7523 DECL_INLINE_THROW(uint32_t)
     7523DECL_HIDDEN_THROW(uint32_t)
    75247524iemNativeVarRestoreVolatileRegsPostHlpCall(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint32_t fHstRegsNotToSave)
    75257525{
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