VirtualBox

Changeset 18851 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Apr 8, 2009 5:31:06 PM (16 years ago)
Author:
vboxsync
Message:

HWACCMR0A.asm: Load the NULL selector into DS, ES, FS and GS on 64-bit darwin so we don't risk loading a stale and/or paged out LDT value or otherwise problematic.

File:
1 edited

Legend:

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

    r15415 r18851  
    5454%ifdef VBOX_WITH_HYBRID_32BIT_KERNEL
    5555 %define MAYBE_64_BIT
     56%else
     57 %ifdef RT_OS_DARWIN
     58  %ifdef RT_ARCH_AMD64
     59   ;;
     60   ; Load the NULL selector into DS, ES, FS and GS on 64-bit darwin so we don't
     61   ; risk loading a stale LDT value or something invalid.
     62   %define HWACCM_64_BIT_USE_NULL_SEL
     63  %endif
     64 %endif
    5665%endif
    5766
     
    148157; trashes, rax, rdx & rcx
    149158%macro MYPUSHSEGS64 2
     159 %ifndef HWACCM_64_BIT_USE_NULL_SEL
    150160   mov     %2, es
    151161   push    %1
    152162   mov     %2, ds
    153163   push    %1
     164 %endif
    154165
    155166   ; Special case for FS; Windows and Linux either don't use it or restore it when leaving kernel mode, Solaris OTOH doesn't and we must save it.
     
    158169   push    rdx
    159170   push    rax
     171 %ifndef HWACCM_64_BIT_USE_NULL_SEL
    160172   push    fs
     173 %endif
    161174
    162175   ; Special case for GS; OSes typically use swapgs to reset the hidden base register for GS on entry into the kernel. The same happens on exit
     
    165178   push    rdx
    166179   push    rax
     180 %ifndef HWACCM_64_BIT_USE_NULL_SEL
    167181   push    gs
     182 %endif
    168183%endmacro
    169184
     
    171186%macro MYPOPSEGS64 2
    172187   ; Note: do not step through this code with a debugger!
     188 %ifndef HWACCM_64_BIT_USE_NULL_SEL
     189   xor     eax, eax
     190   mov     ds, ax
     191   mov     es, ax
     192   mov     fs, ax
     193   mov     gs, ax
     194 %endif
     195
     196 %ifndef HWACCM_64_BIT_USE_NULL_SEL
    173197   pop     gs
     198 %endif
    174199   pop     rax
    175200   pop     rdx
     
    177202   wrmsr
    178203
     204 %ifndef HWACCM_64_BIT_USE_NULL_SEL
    179205   pop     fs
     206 %endif
    180207   pop     rax
    181208   pop     rdx
     
    184211   ; Now it's safe to step again
    185212
     213 %ifndef HWACCM_64_BIT_USE_NULL_SEL
    186214   pop     %1
    187215   mov     ds, %2
    188216   pop     %1
    189217   mov     es, %2
     218 %endif
    190219%endmacro
    191220
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