VirtualBox

Changeset 13960 in vbox for trunk/src/VBox/VMM/VMMGC


Ignore:
Timestamp:
Nov 7, 2008 1:04:45 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
38992
Message:

Moved guest and host CPU contexts into per-VCPU array.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMGC/CPUMGC.cpp

    r8155 r13960  
    6464    if (uUser & CPUM_HANDLER_CTXCORE_IN_EBP)
    6565    {
    66         PCPUMCTXCORE  pGstCtxCore = CPUMCTX2CORE(&pVM->cpum.s.Guest);
     66        PCPUMCTXCORE  pGstCtxCore = (PCPUMCTXCORE)CPUMGetGuestCtxCore(pVM);
    6767        PCCPUMCTXCORE pGstCtxCoreSrc = (PCPUMCTXCORE)pRegFrame->ebp;
    6868        *pGstCtxCore = *pGstCtxCoreSrc;
     
    9090        case CPUM_HANDLER_IRET:
    9191        {
    92             PCPUMCTXCORE  pGstCtxCore = CPUMCTX2CORE(&pVM->cpum.s.Guest);
     92            PCPUMCTXCORE  pGstCtxCore = (PCPUMCTXCORE)CPUMGetGuestCtxCore(pVM);
    9393            uint32_t     *pEsp = (uint32_t *)pRegFrame->esp;
    9494
  • trunk/src/VBox/VMM/VMMGC/CPUMGCA.asm

    r12989 r13960  
    7373    mov     eax, [esp + 4]              ; get argument
    7474    mov     edx, IMP(g_CPUM)
    75 
    76     mov     ecx, [edx + CPUM.Guest.eip]
     75    ; Convert to CPUMCPU pointer
     76    add     edx, [edx + CPUM.ulOffCPUMCPU]
     77
     78    mov     ecx, [edx + CPUMCPU.Guest.eip]
    7779    mov     [eax +  0h], ecx
    78     mov     ecx, [edx + CPUM.Guest.cs]
     80    mov     ecx, [edx + CPUMCPU.Guest.cs]
    7981    mov     [eax +  4h], ecx
    80     mov     ecx, [edx + CPUM.Guest.eflags]
     82    mov     ecx, [edx + CPUMCPU.Guest.eflags]
    8183    mov     [eax +  8h], ecx
    82     mov     ecx, [edx + CPUM.Guest.esp]
     84    mov     ecx, [edx + CPUMCPU.Guest.esp]
    8385    mov     [eax + 0ch], ecx
    84     mov     ecx, [edx + CPUM.Guest.ss]
     86    mov     ecx, [edx + CPUMCPU.Guest.ss]
    8587    mov     [eax + 10h], ecx
    8688
    87     test    dword [edx + CPUM.Guest.eflags], X86_EFL_VM
     89    test    dword [edx + CPUMCPU.Guest.eflags], X86_EFL_VM
    8890    jnz short CPUMGCRestoreInt_V86
    8991
     
    9395    ; todo: potential trouble loading invalid es,fs,gs,ds because
    9496    ;       of a VMM imposed exception?
    95     mov     es,  [edx + CPUM.Guest.es]
    96     mov     fs,  [edx + CPUM.Guest.fs]
    97     mov     gs,  [edx + CPUM.Guest.gs]
    98     mov     esi, [edx + CPUM.Guest.esi]
    99     mov     edi, [edx + CPUM.Guest.edi]
    100     mov     ebp, [edx + CPUM.Guest.ebp]
    101     mov     ebx, [edx + CPUM.Guest.ebx]
    102     mov     ecx, [edx + CPUM.Guest.ecx]
    103     mov     eax, [edx + CPUM.Guest.eax]
    104     push    dword [edx + CPUM.Guest.ds]
    105     mov     edx, [edx + CPUM.Guest.edx]
     97    mov     es,  [edx + CPUMCPU.Guest.es]
     98    mov     fs,  [edx + CPUMCPU.Guest.fs]
     99    mov     gs,  [edx + CPUMCPU.Guest.gs]
     100    mov     esi, [edx + CPUMCPU.Guest.esi]
     101    mov     edi, [edx + CPUMCPU.Guest.edi]
     102    mov     ebp, [edx + CPUMCPU.Guest.ebp]
     103    mov     ebx, [edx + CPUMCPU.Guest.ebx]
     104    mov     ecx, [edx + CPUMCPU.Guest.ecx]
     105    mov     eax, [edx + CPUMCPU.Guest.eax]
     106    push    dword [edx + CPUMCPU.Guest.ds]
     107    mov     edx, [edx + CPUMCPU.Guest.edx]
    106108    pop     ds
    107109
     
    110112CPUMGCRestoreInt_V86:
    111113    ; iret restores ds, es, fs & gs
    112     mov     ecx, [edx + CPUM.Guest.es]
     114    mov     ecx, [edx + CPUMCPU.Guest.es]
    113115    mov     [eax + 14h], ecx
    114     mov     ecx, [edx + CPUM.Guest.ds]
     116    mov     ecx, [edx + CPUMCPU.Guest.ds]
    115117    mov     [eax + 18h], ecx
    116     mov     ecx, [edx + CPUM.Guest.fs]
     118    mov     ecx, [edx + CPUMCPU.Guest.fs]
    117119    mov     [eax + 1Ch], ecx
    118     mov     ecx, [edx + CPUM.Guest.gs]
     120    mov     ecx, [edx + CPUMCPU.Guest.gs]
    119121    mov     [eax + 20h], ecx
    120     mov     esi, [edx + CPUM.Guest.esi]
    121     mov     edi, [edx + CPUM.Guest.edi]
    122     mov     ebp, [edx + CPUM.Guest.ebp]
    123     mov     ebx, [edx + CPUM.Guest.ebx]
    124     mov     ecx, [edx + CPUM.Guest.ecx]
    125     mov     eax, [edx + CPUM.Guest.eax]
    126     mov     edx, [edx + CPUM.Guest.edx]
     122    mov     esi, [edx + CPUMCPU.Guest.esi]
     123    mov     edi, [edx + CPUMCPU.Guest.edi]
     124    mov     ebp, [edx + CPUMCPU.Guest.ebp]
     125    mov     ebx, [edx + CPUMCPU.Guest.ebx]
     126    mov     ecx, [edx + CPUMCPU.Guest.ecx]
     127    mov     eax, [edx + CPUMCPU.Guest.eax]
     128    mov     edx, [edx + CPUMCPU.Guest.edx]
    127129    ret
    128130
     
    250252align 16
    251253BEGINPROC_EXPORTED CPUMGCResumeGuest
     254    ; Convert to CPUMCPU pointer
     255    add     edx, [edx + CPUM.ulOffCPUMCPU]
    252256    ;
    253257    ; Setup iretd
    254258    ;
    255     push    dword [edx + CPUM.Guest.ss]
    256     push    dword [edx + CPUM.Guest.esp]
    257     push    dword [edx + CPUM.Guest.eflags]
    258     push    dword [edx + CPUM.Guest.cs]
    259     push    dword [edx + CPUM.Guest.eip]
     259    push    dword [edx + CPUMCPU.Guest.ss]
     260    push    dword [edx + CPUMCPU.Guest.esp]
     261    push    dword [edx + CPUMCPU.Guest.eflags]
     262    push    dword [edx + CPUMCPU.Guest.cs]
     263    push    dword [edx + CPUMCPU.Guest.eip]
    260264
    261265    ;
     
    263267    ;
    264268    TRPM_NP_GP_HANDLER NAME(cpumGCHandleNPAndGP), CPUM_HANDLER_ES
    265     mov     es,  [edx + CPUM.Guest.es]
     269    mov     es,  [edx + CPUMCPU.Guest.es]
    266270    TRPM_NP_GP_HANDLER NAME(cpumGCHandleNPAndGP), CPUM_HANDLER_FS
    267     mov     fs,  [edx + CPUM.Guest.fs]
     271    mov     fs,  [edx + CPUMCPU.Guest.fs]
    268272    TRPM_NP_GP_HANDLER NAME(cpumGCHandleNPAndGP), CPUM_HANDLER_GS
    269     mov     gs,  [edx + CPUM.Guest.gs]
     273    mov     gs,  [edx + CPUMCPU.Guest.gs]
    270274
    271275%ifdef VBOX_WITH_STATISTICS
     
    296300    ; Continue restore.
    297301    ;
    298     mov     esi, [edx + CPUM.Guest.esi]
    299     mov     edi, [edx + CPUM.Guest.edi]
    300     mov     ebp, [edx + CPUM.Guest.ebp]
    301     mov     ebx, [edx + CPUM.Guest.ebx]
    302     mov     ecx, [edx + CPUM.Guest.ecx]
    303     mov     eax, [edx + CPUM.Guest.eax]
    304     push    dword [edx + CPUM.Guest.ds]
    305     mov     edx, [edx + CPUM.Guest.edx]
     302    mov     esi, [edx + CPUMCPU.Guest.esi]
     303    mov     edi, [edx + CPUMCPU.Guest.edi]
     304    mov     ebp, [edx + CPUMCPU.Guest.ebp]
     305    mov     ebx, [edx + CPUMCPU.Guest.ebx]
     306    mov     ecx, [edx + CPUMCPU.Guest.ecx]
     307    mov     eax, [edx + CPUMCPU.Guest.eax]
     308    push    dword [edx + CPUMCPU.Guest.ds]
     309    mov     edx, [edx + CPUMCPU.Guest.edx]
    306310    TRPM_NP_GP_HANDLER NAME(cpumGCHandleNPAndGP), CPUM_HANDLER_DS
    307311    pop     ds
     
    326330align 16
    327331BEGINPROC_EXPORTED CPUMGCResumeGuestV86
     332    ; Convert to CPUMCPU pointer
     333    add     edx, [edx + CPUM.ulOffCPUMCPU]
    328334    ;
    329335    ; Setup iretd
    330336    ;
    331     push    dword [edx + CPUM.Guest.gs]
    332     push    dword [edx + CPUM.Guest.fs]
    333     push    dword [edx + CPUM.Guest.ds]
    334     push    dword [edx + CPUM.Guest.es]
    335 
    336     push    dword [edx + CPUM.Guest.ss]
    337     push    dword [edx + CPUM.Guest.esp]
    338 
    339     push    dword [edx + CPUM.Guest.eflags]
    340     push    dword [edx + CPUM.Guest.cs]
    341     push    dword [edx + CPUM.Guest.eip]
     337    push    dword [edx + CPUMCPU.Guest.gs]
     338    push    dword [edx + CPUMCPU.Guest.fs]
     339    push    dword [edx + CPUMCPU.Guest.ds]
     340    push    dword [edx + CPUMCPU.Guest.es]
     341
     342    push    dword [edx + CPUMCPU.Guest.ss]
     343    push    dword [edx + CPUMCPU.Guest.esp]
     344
     345    push    dword [edx + CPUMCPU.Guest.eflags]
     346    push    dword [edx + CPUMCPU.Guest.cs]
     347    push    dword [edx + CPUMCPU.Guest.eip]
    342348
    343349    ;
     
    372378    ; Continue restore.
    373379    ;
    374     mov     esi, [edx + CPUM.Guest.esi]
    375     mov     edi, [edx + CPUM.Guest.edi]
    376     mov     ebp, [edx + CPUM.Guest.ebp]
    377     mov     ecx, [edx + CPUM.Guest.ecx]
    378     mov     ebx, [edx + CPUM.Guest.ebx]
    379     mov     eax, [edx + CPUM.Guest.eax]
    380     mov     edx, [edx + CPUM.Guest.edx]
     380    mov     esi, [edx + CPUMCPU.Guest.esi]
     381    mov     edi, [edx + CPUMCPU.Guest.edi]
     382    mov     ebp, [edx + CPUMCPU.Guest.ebp]
     383    mov     ecx, [edx + CPUMCPU.Guest.ecx]
     384    mov     ebx, [edx + CPUMCPU.Guest.ebx]
     385    mov     eax, [edx + CPUMCPU.Guest.eax]
     386    mov     edx, [edx + CPUMCPU.Guest.edx]
    381387
    382388    ; restart execution.
  • trunk/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp

    r13823 r13960  
    441441
    442442    LogFlow(("TRPMTrap07HandlerGC: eip=%08RX32\n", pRegFrame->eip));
    443     return CPUMHandleLazyFPU(pVM);
     443    return CPUMHandleLazyFPU(pVM, VMMGetCpu(pVM));
    444444}
    445445
Note: See TracChangeset for help on using the changeset viewer.

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