VirtualBox

Changeset 46312 in vbox for trunk/src


Ignore:
Timestamp:
May 29, 2013 2:08:18 PM (12 years ago)
Author:
vboxsync
Message:

VMM/HM: Use assembler structures to make code the VMX host restoration assembly code more readable while doing the structure layout checks at compile time.

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

Legend:

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

    r46267 r46312  
    298298 %ifndef ASM_CALL64_GCC
    299299    ; On msc R10, R11 are scratch, RDI and RSI are not. So we must save and restore them!
    300     mov         r10, rdi
    301     mov         r11, rsi
     300    mov         r10, rdi
     301    mov         r11, rsi
    302302    ; Switch to common register usage (i.e. gcc's in this function)
    303303    mov         rdi, rcx
     
    307307    test        edi, VMX_RESTORE_HOST_GDTR
    308308    jz          near .test_idtr
    309     lgdt        [rsi + 18h]                ; pRestoreHost->HostGdtr
     309    lgdt        [rsi + VMXRESTOREHOST.HostGdtr]
    310310
    311311.test_idtr:
    312312    test        edi, VMX_RESTORE_HOST_IDTR
    313313    jz          near .test_ds
    314     lidt        [rsi + 22h]                ; pRestoreHost->HostIdtr
     314    lidt        [rsi + VMXRESTOREHOST.HostIdtr]
    315315
    316316.test_ds:
    317317    test        edi, VMX_RESTORE_HOST_SEL_DS
    318318    jz          near .test_es
    319     mov         ax, word [rsi]             ; pRestoreHost->uHostSelDS
    320     mov         ds, ax             
     319    mov         ax, word [rsi + VMXRESTOREHOST.uHostSelDS]
     320    mov         ds, ax
    321321
    322322.test_es:
    323323    test        edi, VMX_RESTORE_HOST_SEL_ES
    324324    jz          near .test_fs
    325     mov         ax, word [rsi + 2]         ; pRestoreHost->uHostSelES
    326     mov         es, ax 
     325    mov         ax, word [rsi + VMXRESTOREHOST.uHostSelES]
     326    mov         es, ax
    327327
    328328.test_fs:
     
    333333    test        edi, VMX_RESTORE_HOST_SEL_FS
    334334    jz          near .test_gs
    335     mov         ax, word [rsi + 4]        ; pRestoreHost->uHostSelFS
     335    mov         ax, word [rsi + VMXRESTOREHOST.uHostSelFS]
    336336    cli                                   ; Disable interrupts as mov fs, ax will zap the upper part of the base
    337337    mov         fs, ax
    338     mov         eax, dword [rsi + 8]      ; pRestoreHost->uHostFSBase - Lo
    339     mov         edx, dword [rsi + 0Ch]    ; pRestoreHost->uHostFSBase - Hi
     338    mov         eax, dword [rsi + VMXRESTOREHOST.uHostFSBase]         ; uHostFSBase - Lo
     339    mov         edx, dword [rsi + VMXRESTOREHOST.uHostFSBase + 4h]    ; uHostFSBase - Hi
    340340    mov         ecx, MSR_K8_FS_BASE
    341341    wrmsr
     
    345345    test        edi, VMX_RESTORE_HOST_SEL_GS
    346346    jz          near .restore_success
    347     mov         ax, word [rsi + 6]        ; pRestoreHost->uHostSelGS
     347    mov         ax, word [rsi + VMXRESTOREHOST.uHostSelGS]
    348348    cli                                   ; Disable interrupts as mov gs, ax will zap the upper part of the base
    349349    mov         gs, ax
    350     mov         eax, dword [rsi + 10h]    ; pRestoreHost->uHostGSBase - Lo
    351     mov         edx, dword [rsi + 14h]    ; pRestoreHost->uHostGSBase - Hi
     350    mov         eax, dword [rsi + VMXRESTOREHOST.uHostGSBase]         ; uHostGSBase - Lo
     351    mov         edx, dword [rsi + VMXRESTOREHOST.uHostGSBase + 4h]    ; uHostGSBase - Hi
    352352    mov         ecx, MSR_K8_GS_BASE
    353353    wrmsr
     
    358358 %ifndef ASM_CALL64_GCC
    359359    ; Restore RDI and RSI on MSC.
    360     mov         rdi, r10
    361     mov         rsi, r11
     360    mov         rdi, r10
     361    mov         rsi, r11
    362362 %endif
    363363%else  ; RT_ARCH_X86
  • trunk/src/VBox/VMM/testcase/tstAsmStructsAsm.asm

    r44528 r46312  
    2929%include "VBox/vmm/cpum.mac"
    3030%include "VBox/vmm/vm.mac"
     31%include "VBox/vmm/hm_vmx.mac"
    3132%include "VBox/sup.mac"
    3233%include "VMMSwitcher.mac"
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