VirtualBox

Ignore:
Timestamp:
Aug 12, 2013 12:37:34 AM (11 years ago)
Author:
vboxsync
Message:

VMM: Debug register handling redo. (only partly tested on AMD-V so far.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMSwitcher/LegacyandAMD64.mac

    r47652 r47660  
    445445    mov     esi, [rdx + CPUMCPU.fUseFlags] ; esi == use flags.
    446446    test    esi, CPUM_SYNC_FPU_STATE
    447     jz      near gth_fpu_no
     447    jz      near htg_fpu_no
    448448
    449449%ifdef VBOX_WITH_CRASHDUMP_MAGIC
     
    460460    and     dword [rdx + CPUMCPU.fUseFlags], ~CPUM_SYNC_FPU_STATE
    461461
    462 gth_fpu_no:
     462htg_fpu_no:
    463463    ; Check if we need to restore the guest debug state
    464     test    esi, CPUM_SYNC_DEBUG_STATE
    465     jz      near gth_debug_no
     464    test    esi, CPUM_SYNC_DEBUG_REGS_GUEST | CPUM_SYNC_DEBUG_REGS_HYPER
     465    jz      htg_debug_done
    466466
    467467%ifdef VBOX_WITH_CRASHDUMP_MAGIC
    468468    mov dword [rdx + CPUMCPU.Guest.dr + 4*8], 8
    469469%endif
    470 
     470    test    esi, CPUM_SYNC_DEBUG_REGS_HYPER
     471    jnz     htg_debug_hyper
     472
     473    ; Guest values in DRx, letting the guest access them directly.
    471474    mov     rax, qword [rdx + CPUMCPU.Guest.dr + 0*8]
    472475    mov     dr0, rax
     
    480483    mov     dr6, rax    ; not required for AMD-V
    481484
    482     and     dword [rdx + CPUMCPU.fUseFlags], ~CPUM_SYNC_DEBUG_STATE
    483 
    484 gth_debug_no:
     485    and     dword [rdx + CPUMCPU.fUseFlags], ~CPUM_SYNC_DEBUG_REGS_GUEST
     486    or      dword [rdx + CPUMCPU.fUseFlags], CPUM_USED_DEBUG_REGS_GUEST
     487    jmp     htg_debug_done
     488
     489htg_debug_hyper:
     490    ; Combined values in DRx, intercepting all accesses.
     491    mov     rax, qword [rdx + CPUMCPU.Hyper.dr + 0*8]
     492    mov     dr0, rax
     493    mov     rax, qword [rdx + CPUMCPU.Hyper.dr + 1*8]
     494    mov     dr1, rax
     495    mov     rax, qword [rdx + CPUMCPU.Hyper.dr + 2*8]
     496    mov     dr2, rax
     497    mov     rax, qword [rdx + CPUMCPU.Hyper.dr + 3*8]
     498    mov     dr3, rax
     499    mov     rax, qword [rdx + CPUMCPU.Hyper.dr + 6*8]
     500    mov     dr6, rax    ; not required for AMD-V
     501
     502    and     dword [rdx + CPUMCPU.fUseFlags], ~CPUM_SYNC_DEBUG_REGS_HYPER
     503    or      dword [rdx + CPUMCPU.fUseFlags], CPUM_USED_DEBUG_REGS_HYPER
     504
     505htg_debug_done:
    485506
    486507%ifdef VBOX_WITH_CRASHDUMP_MAGIC
    487508    mov dword [rdx + CPUMCPU.Guest.dr + 4*8], 9
    488509%endif
     510
     511    ;
     512    ; "Call" the specified helper function.
     513    ;
    489514
    490515    ; parameter for all helper functions (pCtx)
    491516    DEBUG64_CHAR('9')
    492517    lea     rsi, [rdx + CPUMCPU.Guest.fpu]
    493     lea     rax, [gth_return wrt rip]
     518    lea     rax, [htg_return wrt rip]
    494519    push    rax                         ; return address
    495520
     
    505530    jz      NAME(HMRCTestSwitcher64)
    506531    mov     eax, VERR_HM_INVALID_HM64ON32OP
    507 gth_return:
     532htg_return:
    508533    DEBUG64_CHAR('r')
    509534
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