VirtualBox

Changeset 2043 in vbox for trunk


Ignore:
Timestamp:
Apr 12, 2007 1:04:07 PM (18 years ago)
Author:
vboxsync
Message:

Preperations for mov gpr, ss patch.

Location:
trunk/src/VBox/VMM/PATM
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PATM/PATM.cpp

    r2030 r2043  
    16621662                Log(("Force recompilation of next instruction for OP_MOV at %VGv\n", pCurInstrGC));
    16631663                pPatch->flags |= PATMFL_RECOMPILE_NEXT;
    1664             }
     1664                /** @todo this could cause a fault (ring 0 selector being loaded in ring 1) */
     1665            }
     1666#if 0
     1667            else
     1668            if (    (pCpu->param2.flags & USE_REG_SEG)
     1669                &&  (pCpu->param2.base.reg_seg == USE_REG_SS)
     1670                &&  (pCpu->param1.flags & (USE_REG_GEN32|USE_REG_GEN16)))     /** @todo memory operand must in theory be handled too */
     1671            {
     1672                /* mov GPR, ss */
     1673                rc = patmPatchGenMovFromSS(pVM, pPatch, pCpu);
     1674                if (VBOX_SUCCESS(rc))
     1675                    rc = VWRN_CONTINUE_RECOMPILE;
     1676                break;
     1677            }
     1678#endif
    16651679        }
    16661680        goto duplicate_instr;
  • trunk/src/VBox/VMM/PATM/PATMA.asm

    r1914 r2043  
    25332533    DD      0ffffffffh
    25342534
     2535
     2536; push ss, check and correct RPL
     2537BEGINPROC PATMMovFromSS
     2538PATMMovFromSS_Start:
     2539    push    ss
     2540    push    eax
     2541    pushfd
     2542    mov     ax, ss
     2543    and     ax, 3
     2544    cmp     ax, 1
     2545    jne     near PATMMovFromSS_Continue
     2546
     2547    and     dword [esp+8], ~3     ; clear RPL 1
     2548PATMMovFromSS_Continue:
     2549    popfd
     2550    pop     eax
     2551    add     esp, 2          ; ss popped off as 16 bits value
     2552PATMMovFromSS_Start_End:
     2553ENDPROC PATMMovFromSS
     2554
     2555GLOBALNAME PATMMovFromSSRecord
     2556    RTCCPTR_DEF PATMMovFromSS_Start
     2557    DD      0
     2558    DD      0
     2559    DD      PATMMovFromSS_Start_End - PATMMovFromSS_Start
     2560    DD      0
     2561    DD      0
     2562    DD      0ffffffffh
     2563
     2564
     2565
     2566
    25352567; For assertion during init (to make absolutely sure the flags are in sync in vm.mac & vm.h)
    25362568GLOBALNAME PATMInterruptFlag
  • trunk/src/VBox/VMM/PATM/PATMA.h

    r1438 r2043  
    184184extern PATCHASMRECORD PATMClearInhibitIRQContIF0Record;
    185185
     186extern PATCHASMRECORD PATMMovFromSSRecord;
     187
    186188extern uint32_t       PATMInterruptFlag;
    187189#ifdef __cplusplus
  • trunk/src/VBox/VMM/PATM/PATMPatch.cpp

    r2030 r2043  
    12781278}
    12791279
     1280/*
     1281 * mov GPR, SS
     1282 */
     1283int patmPatchGenMovFromSS(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu)
     1284{
     1285    uint32_t size, offset;
     1286
     1287    PATCHGEN_PROLOG(pVM, pPatch);
     1288    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMSetPIFRecord, 0, false);
     1289    PATCHGEN_EPILOG(pPatch, size);
     1290
     1291    /* pushes ss, checks and corrects RPL */
     1292    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
     1293    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMMovFromSSRecord, 0, false);
     1294    PATCHGEN_EPILOG(pPatch, size);
     1295
     1296    /* pop general purpose register */
     1297    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
     1298    offset = 0;
     1299    if (pPatch->flags & PATMFL_CODE32)
     1300        pPB[offset++] = 0x66; /* size override -> 16 bits pop */
     1301    pPB[offset++] = 0x50 + pCpu->param1.base.reg_gen32;
     1302    PATCHGEN_EPILOG(pPatch, offset);
     1303
     1304
     1305    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
     1306    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMClearPIFRecord, 0, false);
     1307    PATCHGEN_EPILOG(pPatch, size);
     1308
     1309    return VINF_SUCCESS;
     1310}
     1311
    12801312
    12811313/**
  • trunk/src/VBox/VMM/PATM/PATMPatch.h

    r2030 r2043  
    3030int patmPatchGenMovControl(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu);
    3131int patmPatchGenMovDebug(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu);
     32int patmPatchGenMovFromSS(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu);
    3233int patmPatchGenRelJump(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t *)pTargetGC, uint32_t opcode, bool fSizeOverride);
    3334int patmPatchGenLoop(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t *)pTargetGC, uint32_t opcode, bool fSizeOverride);
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