VirtualBox

Changeset 18060 in vbox


Ignore:
Timestamp:
Mar 18, 2009 12:42:06 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
44694
Message:

VT-x: restore TR properly as VT-x sets the limit back to 0x67 after a world switch. (kills XP hibernation)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HWACCMR0Mixed.mac

    r15440 r18060  
    117117    push    xAX
    118118
     119    ; The TR limit is reset to 0x67; restore it manually
     120    str     eax
     121    push    xAX
     122
    119123    ; VMX only saves the base of the GDTR & IDTR and resets the limit to 0xffff; we must restore the limit correctly!
    120124    sub     xSP, xS*2
     
    123127    sub     xSP, xS*2
    124128    sidt    [xSP]
    125 
     129   
    126130%ifdef VBOX_WITH_DR6_EXPERIMENT
    127131    ; Restore DR6 - experiment, not safe!
     
    177181
    178182    push    xDI
    179     mov     xDI, [xSP + xS * 2]         ; pCtx (*2 to skip the saved LDTR)
     183    mov     xDI, [xSP + xS * 3]         ; pCtx (*3 to skip the saved LDTR + TR)
    180184
    181185    mov     [ss:xDI + CPUMCTX.eax], eax
     
    198202%endif
    199203
     204    ; Restore TSS selector; must mark it as not busy before using ltr (!)
     205    ; ASSUME that this is supposed to be 'BUSY'. (saves 20-30 ticks on the T42p)
     206    ; @todo get rid of sgdt
     207    pop     xBX         ; saved TR
     208    sub     xSP, xS*2
     209    sgdt    [xSP]
     210    mov     eax, ebx
     211    and     al, 0F8h                                ; mask away TI and RPL bits, get descriptor offset.
     212    add     eax, [xSP + 2]                          ; eax <- GDTR.address + descriptor offset.
     213    and     dword [ss:eax + 4], ~0200h                 ; clear busy flag (2nd type2 bit)
     214    ltr     bx
     215    add     xSP, xS*2
     216   
    200217    pop     xAX         ; saved LDTR
    201218    lldt    ax
    202 
     219   
    203220    add     xSP, xS      ; pCtx
    204221
     
    246263    add     xSP, xS*2
    247264
     265    ; Restore TSS selector; must mark it as not busy before using ltr (!)
     266    ; ASSUME that this is supposed to be 'BUSY'. (saves 20-30 ticks on the T42p)
     267    ; @todo get rid of sgdt
     268    pop     xBX         ; saved TR
     269    sub     xSP, xS*2
     270    sgdt    [xSP]
     271    mov     eax, ebx
     272    and     al, 0F8h                                ; mask away TI and RPL bits, get descriptor offset.
     273    add     eax, [xSP + 2]                          ; eax <- GDTR.address + descriptor offset.
     274    and     dword [ss:eax + 4], ~0200h                 ; clear busy flag (2nd type2 bit)
     275    ltr     bx
     276    add     xSP, xS*2
     277
    248278    pop     xAX         ; saved LDTR
    249279    lldt    ax
     
    268298    add     xSP, xS*2
    269299    lgdt    [xSP]
     300    add     xSP, xS*2
     301
     302    ; Restore TSS selector; must mark it as not busy before using ltr (!)
     303    ; ASSUME that this is supposed to be 'BUSY'. (saves 20-30 ticks on the T42p)
     304    ; @todo get rid of sgdt
     305    pop     xBX         ; saved TR
     306    sub     xSP, xS*2
     307    sgdt    [xSP]
     308    mov     eax, ebx
     309    and     al, 0F8h                                ; mask away TI and RPL bits, get descriptor offset.
     310    add     eax, [xSP + 2]                          ; eax <- GDTR.address + descriptor offset.
     311    and     dword [ss:eax + 4], ~0200h                 ; clear busy flag (2nd type2 bit)
     312    ltr     bx
    270313    add     xSP, xS*2
    271314
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