VirtualBox

Changeset 75 in vbox


Ignore:
Timestamp:
Jan 16, 2007 5:27:03 PM (18 years ago)
Author:
vboxsync
Message:

Initial 64-bit port of the code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HWACCMR0A.asm

    r19 r75  
    3030
    3131%ifdef __OS2__ ;; @todo build cvs nasm like on OS X.
    32 %macro vmwrite 2,
     32 %macro vmwrite 2,
    3333    int3
    34 %endmacro
    35 %define vmlaunch int3
    36 %define vmresume int3
    37 %endif
     34 %endmacro
     35 %define vmlaunch int3
     36 %define vmresume int3
     37%endif
     38
     39
     40;; @def MYPUSHAD
     41; Macro generating an equivalent to pushad
     42
     43;; @def MYPOPAD
     44; Macro generating an equivalent to popad
     45
     46;; @def MYPUSHSEGS
     47; Macro saving all segment registers on the stack.
     48; @param 1  full width register name
     49; @param 2  16-bit regsiter name for \a 1.
     50
     51;; @def MYPOPSEGS
     52; Macro restoring all segment registers on the stack
     53; @param 1  full width register name
     54; @param 2  16-bit regsiter name for \a 1.
     55
     56%ifdef __AMD64__
     57 %ifdef ASM_CALL64_GCC
     58  %macro MYPUSHAD 0
     59    push    r15
     60    push    r14
     61    push    r13
     62    push    r12
     63    push    rbx
     64  %endmacro
     65  %macro MYPOPAD 0
     66    pop     rbx
     67    pop     r12
     68    pop     r13
     69    pop     r14
     70    pop     r15
     71  %endmacro
     72
     73 %else ; ASM_CALL64_MSC
     74  %macro MYPUSHAD 0
     75    push    r15
     76    push    r14
     77    push    r13
     78    push    r12
     79    push    rbx
     80    push    rsi
     81    push    rdi
     82  %endmacro
     83  %macro MYPOPAD 0
     84    pop     rsi
     85    pop     rdi
     86    pop     rbx
     87    pop     r12
     88    pop     r13
     89    pop     r14
     90    pop     r15
     91  %endmacro
     92 %endif
     93    ;; @todo check ds,es saving/restoring on AMD64
     94 %macro MYPUSHSEGS 2
     95    push    gs
     96    push    fs
     97    mov     %2, es
     98    push    %1
     99    mov     %2, ds
     100    push    %1
     101 %endmacro
     102 %macro MYPOPSEGS 2
     103    pop     %1
     104    mov     ds, %2
     105    pop     %1
     106    mov     es, %2
     107    pop     fs
     108    pop     gs
     109 %endmacro
     110
     111%else ; __X86__
     112  %macro MYPUSHAD 0
     113    pushad
     114  %endmacro
     115  %macro MYPOPAD 0
     116    popad
     117  %endmacro
     118
     119  %macro MYPUSHSEGS 2
     120    push    ds
     121    push    es
     122    push    fs
     123    push    gs
     124  %endmacro
     125  %macro MYPOPSEGS 2
     126    pop     gs
     127    pop     fs
     128    pop     es
     129    pop     ds
     130  %endmacro
     131%endif
     132
    38133
    39134BEGINCODE
     
    48143; */
    49144BEGINPROC VMXStartVM
    50     push    ebp
    51     mov     ebp, esp
     145    push    xBP
     146    mov     xBP, xSP
    52147
    53148    ;/* First we have to save some final CPU context registers. */
    54     push    vmlaunch_done
     149    push    .vmlaunch_done
    55150    mov     eax, VMX_VMCS_HOST_RIP  ;/* return address (too difficult to continue after VMLAUNCH?) */
    56     vmwrite eax, [esp]
     151    vmwrite xAX, [xSP]
    57152    ;/* @todo assumes success... */
    58     add     esp, 4
     153    add     xSP, xS
    59154
    60155    ;/* Manual save and restore:
     
    71166
    72167    ;/* Save all general purpose host registers. */
    73     pushad
     168    MYPUSHAD
    74169
    75170    ;/* Save segment registers */
    76     push    ds
    77     push    es
    78     push    fs
    79     push    gs
     171    MYPUSHSEGS xAX, ax
    80172
    81173    ;/* Save the Guest CPU context pointer. */
     174%ifdef __AMD64__
     175 %ifdef ASM_CALL64_GCC
     176    mov     rsi, rdi ; pCtx
     177 %else
     178    mov     rsi, rcx ; pCtx
     179 %endif
     180%else
    82181    mov     esi, [ebp + 8] ; pCtx
    83     push    esi
     182%endif
     183    push    xSI
    84184
    85185    ; Save LDTR
    86186    xor     eax, eax
    87187    sldt    ax
    88     push    eax
     188    push    xAX
    89189
    90190    ; Restore CR2
    91     mov     ebx, [esi + CPUMCTX.cr2]
    92     mov     cr2, ebx
     191    mov     ebx, [xSI + CPUMCTX.cr2]
     192    mov     cr2, xBX
    93193
    94194    mov     eax, VMX_VMCS_HOST_RSP
    95     vmwrite eax, esp
     195    vmwrite xAX, xSP
    96196    ;/* @todo assumes success... */
    97197    ;/* Don't mess with ESP anymore!! */
    98198
    99199    ;/* Restore Guest's general purpose registers. */
    100     mov     eax, [esi + CPUMCTX.eax]
    101     mov     ebx, [esi + CPUMCTX.ebx]
    102     mov     ecx, [esi + CPUMCTX.ecx]
    103     mov     edx, [esi + CPUMCTX.edx]
    104     mov     edi, [esi + CPUMCTX.edi]
    105     mov     ebp, [esi + CPUMCTX.ebp]
    106     mov     esi, [esi + CPUMCTX.esi]
     200    mov     eax, [xSI + CPUMCTX.eax]
     201    mov     ebx, [xSI + CPUMCTX.ebx]
     202    mov     ecx, [xSI + CPUMCTX.ecx]
     203    mov     edx, [xSI + CPUMCTX.edx]
     204    mov     edi, [xSI + CPUMCTX.edi]
     205    mov     ebp, [xSI + CPUMCTX.ebp]
     206    mov     esi, [xSI + CPUMCTX.esi]
    107207
    108208    vmlaunch
    109     jmp     vmlaunch_done;      ;/* here if vmlaunch detected a failure. */
     209    jmp     .vmlaunch_done;      ;/* here if vmlaunch detected a failure. */
    110210
    111211ALIGNCODE(16)
    112 vmlaunch_done:
    113     jnc     vmxstart_good
    114 
    115     pop     eax         ; saved LDTR
     212.vmlaunch_done:
     213    jnc     .vmxstart_good
     214
     215    pop     xAX         ; saved LDTR
    116216    lldt    ax
    117217
    118     add     esp, 4      ; pCtx
     218    add     xSP, xS     ; pCtx
    119219
    120220    ; Restore segment registers
    121     pop     gs
    122     pop     fs
    123     pop     es
    124     pop     ds
     221    MYPOPSEGS xAX, ax
    125222
    126223    ;/* Restore all general purpose host registers. */
    127     popad
     224    MYPOPAD
    128225    mov     eax, VERR_VMX_INVALID_VMXON_PTR
    129     jmp     vmstart_end
    130 
    131 vmxstart_good:
    132     jnz     vmxstart_success
    133 
    134     pop     eax         ; saved LDTR
     226    jmp     .vmstart_end
     227
     228.vmxstart_good:
     229    jnz     .vmxstart_success
     230
     231    pop     xAX         ; saved LDTR
    135232    lldt    ax
    136233
    137     add     esp, 4      ; pCtx
     234    add     xSP, xS     ; pCtx
    138235
    139236    ; Restore segment registers
    140     pop     gs
    141     pop     fs
    142     pop     es
    143     pop     ds
    144     ;/* Restore all general purpose host registers. */
    145     popad
     237    MYPOPSEGS xAX, ax
     238
     239    ; Restore all general purpose host registers.
     240    MYPOPAD
    146241    mov     eax, VERR_VMX_UNABLE_TO_START_VM
    147     jmp     vmstart_end
    148 
    149 vmxstart_success:
    150     push    edi
    151     mov     edi, dword [esp+8]      ;/* pCtx */
    152 
    153     mov     [ss:edi + CPUMCTX.eax], eax
    154     mov     [ss:edi + CPUMCTX.ebx], ebx
    155     mov     [ss:edi + CPUMCTX.ecx], ecx
    156     mov     [ss:edi + CPUMCTX.edx], edx
    157     mov     [ss:edi + CPUMCTX.esi], esi
    158     mov     [ss:edi + CPUMCTX.ebp], ebp
    159     pop     dword [ss:edi + CPUMCTX.edi]     ; guest edi we pushed above
    160 
    161     pop     eax         ; saved LDTR
     242    jmp     .vmstart_end
     243
     244.vmxstart_success:
     245    push    xDI
     246    mov     xDI, [xSP + xS * 2]          ;/* pCtx */
     247
     248    mov     [ss:xDI + CPUMCTX.eax], eax
     249    mov     [ss:xDI + CPUMCTX.ebx], ebx
     250    mov     [ss:xDI + CPUMCTX.ecx], ecx
     251    mov     [ss:xDI + CPUMCTX.edx], edx
     252    mov     [ss:xDI + CPUMCTX.esi], esi
     253    mov     [ss:xDI + CPUMCTX.ebp], ebp
     254%ifdef __AMD64__
     255    pop     xAX                                 ; the guest edi we pushed above
     256    mov     dword [ss:xDI + CPUMCTX.edi], eax
     257%else
     258    pop     dword [ss:xDI + CPUMCTX.edi]        ; the guest edi we pushed above
     259%endif
     260
     261    pop     xAX         ; saved LDTR
    162262    lldt    ax
    163263
    164     add     esp, 4      ; pCtx
     264    add     xSP, 4      ; pCtx
    165265
    166266    ; Restore segment registers
    167     pop     gs
    168     pop     fs
    169     pop     es
    170     pop     ds
     267    MYPOPSEGS xAX, ax
    171268
    172269    ; Restore general purpose registers
    173     popad
     270    MYPOPAD
    174271
    175272    mov     eax, VINF_SUCCESS
    176273
    177 vmstart_end:
    178     pop     ebp
    179     ret
    180 ENDPROC VMStartVM
     274.vmstart_end:
     275    pop     xBP
     276    ret
     277ENDPROC VMXStartVM
    181278
    182279
     
    190287; */
    191288BEGINPROC VMXResumeVM
    192     push    ebp
    193     mov     ebp, esp
     289    push    xBP
     290    mov     xBP, xSP
    194291
    195292    ;/* First we have to save some final CPU context registers. */
    196293    push    vmresume_done
    197294    mov     eax, VMX_VMCS_HOST_RIP  ;/* return address (too difficult to continue after VMLAUNCH?) */
    198     vmwrite eax, [esp]
     295    vmwrite xAX, [xSP]
    199296    ;/* @todo assumes success... */
    200     add     esp, 4
     297    add     xSP, xS
    201298
    202299    ;/* Manual save and restore:
     
    213310
    214311    ;/* Save all general purpose host registers. */
    215     pushad
     312    MYPUSHAD
    216313
    217314    ;/* Save segment registers */
    218     push    ds
    219     push    es
    220     push    fs
    221     push    gs
     315    MYPUSHSEGS xAX, ax
    222316
    223317    ;/* Save the Guest CPU context pointer. */
    224     mov     esi, [ebp + 8] ; pCtx
    225     push    esi
     318%ifdef __AMD64__
     319 %ifdef ASM_CALL64_GCC
     320    mov     rsi, rdi        ; pCtx
     321 %else
     322    mov     rsi, ecx        ; pCtx
     323 %endif
     324%else
     325    mov     esi, [ebp + 8]  ; pCtx
     326%endif
     327    push    xSI
    226328
    227329    ; Save LDTR
    228330    xor     eax, eax
    229331    sldt    ax
    230     push    eax
     332    push    xAX
    231333
    232334    ; Restore CR2
    233     mov     ebx, [esi + CPUMCTX.cr2]
    234     mov     cr2, ebx
     335    mov     xBX, [xSI + CPUMCTX.cr2]
     336    mov     cr2, xBX
    235337
    236338    mov     eax, VMX_VMCS_HOST_RSP
    237     vmwrite eax, esp
     339    vmwrite xAX, xSP
    238340    ;/* @todo assumes success... */
    239341    ;/* Don't mess with ESP anymore!! */
    240342
    241343    ;/* Restore Guest's general purpose registers. */
    242     mov     eax, [esi + CPUMCTX.eax]
    243     mov     ebx, [esi + CPUMCTX.ebx]
    244     mov     ecx, [esi + CPUMCTX.ecx]
    245     mov     edx, [esi + CPUMCTX.edx]
    246     mov     edi, [esi + CPUMCTX.edi]
    247     mov     ebp, [esi + CPUMCTX.ebp]
    248     mov     esi, [esi + CPUMCTX.esi]
     344    mov     eax, [xSI + CPUMCTX.eax]
     345    mov     ebx, [xSI + CPUMCTX.ebx]
     346    mov     ecx, [xSI + CPUMCTX.ecx]
     347    mov     edx, [xSI + CPUMCTX.edx]
     348    mov     edi, [xSI + CPUMCTX.edi]
     349    mov     ebp, [xSI + CPUMCTX.ebp]
     350    mov     esi, [xSI + CPUMCTX.esi]
    249351
    250352    vmresume
     
    255357    jnc     vmresume_good
    256358
    257     pop     eax         ; saved LDTR
     359    pop     xAX                         ; saved LDTR
    258360    lldt    ax
    259361
    260     add     esp, 4      ; pCtx
     362    add     xSP, xS                     ; pCtx
    261363
    262364    ; Restore segment registers
    263     pop     gs
    264     pop     fs
    265     pop     es
    266     pop     ds
    267 
    268     ;/* Restore all general purpose host registers. */
    269     popad
     365    MYPOPSEGS xAX, ax
     366
     367    ; Restore all general purpose host registers.
     368    MYPOPAD
    270369    mov     eax, VERR_VMX_INVALID_VMXON_PTR
    271370    jmp     vmresume_end
     
    274373    jnz     vmresume_success
    275374
    276     pop     eax         ; saved LDTR
     375    pop     xAX                         ; saved LDTR
    277376    lldt    ax
    278377
    279     add     esp, 4      ; pCtx
     378    add     xSP, xS                     ; pCtx
    280379
    281380    ; Restore segment registers
    282     pop     gs
    283     pop     fs
    284     pop     es
    285     pop     ds
    286     ;/* Restore all general purpose host registers. */
    287     popad
     381    MYPOPSEGS xAX, ax
     382
     383    ; Restore all general purpose host registers.
     384    MYPOPAD
    288385    mov     eax, VERR_VMX_UNABLE_TO_RESUME_VM
    289386    jmp     vmresume_end
    290387
    291388vmresume_success:
    292     push    edi
    293     mov     edi, dword [esp+8]      ;/* pCtx */
    294 
    295     mov     [ss:edi + CPUMCTX.eax], eax
    296     mov     [ss:edi + CPUMCTX.ebx], ebx
    297     mov     [ss:edi + CPUMCTX.ecx], ecx
    298     mov     [ss:edi + CPUMCTX.edx], edx
    299     mov     [ss:edi + CPUMCTX.esi], esi
    300     mov     [ss:edi + CPUMCTX.ebp], ebp
    301     pop     dword [ss:edi + CPUMCTX.edi]     ; guest edi we pushed above
    302 
    303     pop     eax         ; saved LDTR
     389    push    xDI
     390    mov     xDI, [xSP + xS * 2]         ; pCtx
     391
     392    mov     [ss:xDI + CPUMCTX.eax], eax
     393    mov     [ss:xDI + CPUMCTX.ebx], ebx
     394    mov     [ss:xDI + CPUMCTX.ecx], ecx
     395    mov     [ss:xDI + CPUMCTX.edx], edx
     396    mov     [ss:xDI + CPUMCTX.esi], esi
     397    mov     [ss:xDI + CPUMCTX.ebp], ebp
     398%ifdef __AMD64__
     399    pop     xAX                                 ; the guest edi we pushed above
     400    mov     dword [ss:xDI + CPUMCTX.edi], eax
     401%else
     402    pop     dword [ss:xDI + CPUMCTX.edi]        ; the guest edi we pushed above
     403%endif
     404
     405    pop     xAX          ; saved LDTR
    304406    lldt    ax
    305407
    306     add     esp, 4      ; pCtx
     408    add     xSP, xS      ; pCtx
    307409
    308410    ; Restore segment registers
    309     pop     gs
    310     pop     fs
    311     pop     es
    312     pop     ds
     411    MYPOPSEGS xAX, ax
    313412
    314413    ; Restore general purpose registers
    315     popad
     414    MYPOPAD
    316415
    317416    mov     eax, VINF_SUCCESS
    318417
    319418vmresume_end:
    320     pop     ebp
     419    pop     xBP
    321420    ret
    322421ENDPROC VMXResumeVM
    323422
    324423
     424%ifdef __AMD64__
     425;/**
     426; * Executes VMWRITE
     427; *
     428; * @returns VBox status code
     429; * @param   idxField   x86: [ebp + 08h]  msc: rcx  gcc: edi   VMCS index
     430; * @param   pData      x86: [ebp + 0ch]  msc: rdx  gcc: rsi   Ptr to store VM field value
     431; */
     432BEGINPROC VMXWriteVMCS64
     433%ifdef ASM_CALL64_GCC
     434    and         edi, 0ffffffffh; serious paranoia
     435    vmwrite     rdi, [rsi]
     436%else
     437    and         ecx, 0ffffffffh; serious paranoia
     438    vmwrite     rcx, [rdx]
     439%endif
     440    jnc         .valid_vmcs
     441    mov         eax, VERR_VMX_INVALID_VMCS_PTR
     442    ret
     443.valid_vmcs:
     444    jnz         .the_end
     445    mov         eax, VERR_VMX_INVALID_VMCS_FIELD
     446.the_end:
     447    ret
     448ENDPROC VMXWriteVMCS64
     449
     450;/**
     451; * Executes VMREAD
     452; *
     453; * @returns VBox status code
     454; * @param   idxField        VMCS index
     455; * @param   pData           Ptr to store VM field value
     456; */
     457;DECLASM(int) VMXReadVMCS64(uint32_t idxField, uint64_t *pData);
     458BEGINPROC VMXReadVMCS64
     459%ifdef ASM_CALL64_GCC
     460    and         edi, 0ffffffffh; serious paranoia
     461    vmread      [rsi], rdi
     462%else
     463    and         ecx, 0ffffffffh; serious paranoia
     464    vmread      [rdx], rcx
     465%endif
     466    jnc         .valid_vmcs
     467    mov         eax, VERR_VMX_INVALID_VMCS_PTR
     468    ret
     469.valid_vmcs:
     470    jnz         .the_end
     471    mov         eax, VERR_VMX_INVALID_VMCS_FIELD
     472.the_end:
     473    ret
     474ENDPROC VMXReadVMCS64
     475
     476
     477;/**
     478; * Executes VMXON
     479; *
     480; * @returns VBox status code
     481; * @param   HCPhysVMXOn      Physical address of VMXON structure
     482; */
     483;DECLASM(int) VMXEnable(RTHCPHYS HCPhysVMXOn);
     484BEGINPROC VMXEnable
     485%ifdef __AMD64__
     486 %ifdef ASM_CALL64_GCC
     487    push    rdi
     488 %else
     489    push    ecx
     490 %endif
     491    vmxon   [rsp]
     492%else
     493    vmxon   [esp + 4]
     494%endif
     495    jnc     .good
     496    mov     eax, VERR_VMX_INVALID_VMXON_PTR
     497    jmp     .the_end
     498
     499.good:
     500    jnz     .the_end
     501    mov     eax, VERR_VMX_GENERIC
     502
     503.the_end:
     504%ifdef __AMD64__
     505    add     rsp, 8
     506%endif
     507    ret
     508ENDPROC VMXEnable
     509
     510
     511;/**
     512; * Executes VMXOFF
     513; */
     514;DECLASM(void) VMXDisable(void);
     515BEGINPROC VMXDisable
     516    vmxoff
     517    ret
     518ENDPROC VMXDisable
     519
     520
     521;/**
     522; * Executes VMCLEAR
     523; *
     524; * @returns VBox status code
     525; * @param   HCPhysVMCS     Physical address of VM control structure
     526; */
     527;DECLASM(int) VMXClearVMCS(RTHCPHYS HCPhysVMCS);
     528BEGINPROC VMXClearVMCS
     529%ifdef __AMD64__
     530 %ifdef ASM_CALL64_GCC
     531    push    rdi
     532 %else
     533    push    ecx
     534 %endif
     535    vmclear [rsp]
     536%else
     537    vmclear [esp + 4]
     538%endif
     539    jnc     .the_end
     540    mov     eax, VERR_VMX_INVALID_VMCS_PTR
     541.the_end:
     542%ifdef __AMD64__
     543    add     rsp, 8
     544%endif
     545    ret
     546ENDPROC VMXClearVMCS
     547
     548
     549;/**
     550; * Executes VMPTRLD
     551; *
     552; * @returns VBox status code
     553; * @param   HCPhysVMCS     Physical address of VMCS structure
     554; */
     555;DECLASM(int) VMXActivateVMCS(RTHCPHYS HCPhysVMCS);
     556BEGINPROC VMXActivateVMCS
     557%ifdef __AMD64__
     558 %ifdef ASM_CALL64_GCC
     559    push    rdi
     560 %else
     561    push    ecx
     562 %endif
     563    vmclear [rsp]
     564%else
     565    vmclear [esp + 4]
     566%endif
     567    jnc     .the_end
     568    mov     eax, VERR_VMX_INVALID_VMCS_PTR
     569.the_end:
     570%ifdef __AMD64__
     571    add     rsp, 8
     572%endif
     573    ret
     574ENDPROC VMXActivateVMCS
     575
     576%endif ; __AMD64__
    325577
    326578
     
    329581; *
    330582; * @returns VBox status code
    331 ; * @param   pVMCBHostPhys  Physical address of host VMCB
    332 ; * @param   pVMCBPhys      Physical address of guest VMCB
     583; * @param   HCPhysVMCB     Physical address of host VMCB
     584; * @param   HCPhysVMCB     Physical address of guest VMCB
    333585; * @param   pCtx           Guest context
    334586; */
    335587BEGINPROC SVMVMRun
    336     push    ebp
    337     mov     ebp, esp
     588%ifdef __AMD64__ ; fake a cdecl stack frame - I'm lazy, sosume.
     589 %ifdef ASM_CALL64_GCC
     590    push    rdx
     591    push    rsi
     592    push    rdi
     593 %else
     594    push    r8
     595    push    rdx
     596    push    rcx
     597 %endif
     598    push    0
     599%endif
     600    push    xBP
     601    mov     xBP, xSP
    338602
    339603    ;/* Manual save and restore:
     
    348612
    349613    ;/* Save all general purpose host registers. */
    350     pushad
     614    MYPUSHAD
    351615
    352616    ; /* Clear fs and gs as a safety precaution. Maybe not necessary. */
     
    358622
    359623    ;/* Save the Guest CPU context pointer. */
    360     mov     esi, [ebp + 24] ; pCtx
    361     push    esi
     624    mov     xSI, [xBP + xS*2 + RTHCPHYS_CB*2]  ; pCtx
     625    push    xSI                     ; push for saving the state at the end
    362626
    363627    ; Restore CR2
    364     mov     ebx, [esi + CPUMCTX.cr2]
    365     mov     cr2, ebx
     628    mov     ebx, [xSI + CPUMCTX.cr2]
     629    mov     cr2, xBX
    366630
    367631    ; save host fs, gs, sysenter msr etc
    368     mov     eax, [ebp + 8]          ; pVMCBHostPhys (64 bits physical address; take low dword only)
    369     push    eax                     ; save for the vmload after vmrun
     632    mov     xAX, [xBP + xS*2]       ; pVMCBHostPhys (64 bits physical address; x86: take low dword only)
     633    push    xAX                     ; save for the vmload after vmrun
    370634    DB      0x0F, 0x01, 0xDB        ; VMSAVE
    371635
    372636    ; setup eax for VMLOAD
    373     mov     eax, [ebp + 16]         ; pVMCBPhys (64 bits physical address; take low dword only)
     637    mov     xAX, [xBP + xS*2 + RTHCPHYS_CB]     ; pVMCBPhys (64 bits physical address; take low dword only)
    374638
    375639    ;/* Restore Guest's general purpose registers. */
    376640    ;/* EAX is loaded from the VMCB by VMRUN */
    377     mov     ebx, [esi + CPUMCTX.ebx]
    378     mov     ecx, [esi + CPUMCTX.ecx]
    379     mov     edx, [esi + CPUMCTX.edx]
    380     mov     edi, [esi + CPUMCTX.edi]
    381     mov     ebp, [esi + CPUMCTX.ebp]
    382     mov     esi, [esi + CPUMCTX.esi]
     641    mov     ebx, [xSI + CPUMCTX.ebx]
     642    mov     ecx, [xSI + CPUMCTX.ecx]
     643    mov     edx, [xSI + CPUMCTX.edx]
     644    mov     edi, [xSI + CPUMCTX.edi]
     645    mov     ebp, [xSI + CPUMCTX.ebp]
     646    mov     esi, [xSI + CPUMCTX.esi]
    383647
    384648    ; Clear the global interrupt flag & execute sti to make sure external interrupts cause a world switch
     
    397661
    398662    ; load host fs, gs, sysenter msr etc
    399     pop     eax                     ; pushed above
     663    pop     xAX                     ; pushed above
    400664    DB      0x0F, 0x01, 0xDA        ; VMLOAD
    401665
     
    404668    DB      0x0f, 0x01, 0xDC        ; STGI
    405669
    406     pop     eax         ; pCtx
    407 
    408     mov     [ss:eax + CPUMCTX.ebx], ebx
    409     mov     [ss:eax + CPUMCTX.ecx], ecx
    410     mov     [ss:eax + CPUMCTX.edx], edx
    411     mov     [ss:eax + CPUMCTX.esi], esi
    412     mov     [ss:eax + CPUMCTX.edi], edi
    413     mov     [ss:eax + CPUMCTX.ebp], ebp
     670    pop     xAX                     ; pCtx
     671
     672    mov     [ss:xAX + CPUMCTX.ebx], ebx
     673    mov     [ss:xAX + CPUMCTX.ecx], ecx
     674    mov     [ss:xAX + CPUMCTX.edx], edx
     675    mov     [ss:xAX + CPUMCTX.esi], esi
     676    mov     [ss:xAX + CPUMCTX.edi], edi
     677    mov     [ss:xAX + CPUMCTX.ebp], ebp
    414678
    415679    ; Restore fs & gs
     
    418682
    419683    ; Restore general purpose registers
    420     popad
     684    MYPOPAD
    421685
    422686    mov     eax, VINF_SUCCESS
    423687
    424     pop     ebp
     688    pop     xBP
     689%ifdef __AMD64__
     690    add     xSP, 4*xS
     691%endif
    425692    ret
    426693ENDPROC SVMVMRun
     694
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