VirtualBox

Changeset 414 in vbox


Ignore:
Timestamp:
Jan 29, 2007 5:57:59 PM (18 years ago)
Author:
vboxsync
Message:

Fixed a number of edx/rdx and ebx/rbx mixes. Fixed saving of host DRx (high 32bits).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMSwitcher/AMD64ToPAE.asm

    r193 r414  
    128128    ;;
    129129    ; general registers.
    130     ; mov     [edx + CPUM.Host.rax], rax - scratch
     130    ; mov     [rdx + CPUM.Host.rax], rax - scratch
    131131    mov     [rdx + CPUM.Host.rbx], rbx
    132     ; mov     [edx + CPUM.Host.rcx], rcx - scratch
    133     ; mov     [edx + CPUM.Host.rdx], rdx - scratch
     132    ; mov     [rdx + CPUM.Host.rcx], rcx - scratch
     133    ; mov     [rdx + CPUM.Host.rdx], rdx - scratch
    134134    mov     [rdx + CPUM.Host.rdi], rdi
    135135    mov     [rdx + CPUM.Host.rsi], rsi
    136136    mov     [rdx + CPUM.Host.rsp], rsp
    137137    mov     [rdx + CPUM.Host.rbp], rbp
    138     ; mov     [edx + CPUM.Host.r8 ], r8 - scratch
    139     ; mov     [edx + CPUM.Host.r9 ], r9 - scratch
     138    ; mov     [rdx + CPUM.Host.r8 ], r8 - scratch
     139    ; mov     [rdx + CPUM.Host.r9 ], r9 - scratch
    140140    mov     [rdx + CPUM.Host.r10], r10
    141141    mov     [rdx + CPUM.Host.r11], r11
     
    199199    test    esi, CPUM_USE_DEBUG_REGS | CPUM_USE_DEBUG_REGS_HOST
    200200    jz      htg_debug_regs_no
    201     jmp     htg_debug_regs_save_dr7and6
     201    jmp     htg_debug_regs_save
    202202htg_debug_regs_no:
    203203    DEBUG_CHAR('a')                     ; trashes esi
     
    270270dd  0
    271271
     272
     273;;
     274; Detour for saving the host DR7 and DR6.
     275; esi and rdx must be preserved.
     276htg_debug_regs_save:
     277DEBUG_S_CHAR('s');
     278    mov     rax, dr7                    ; not sure, but if I read the docs right this will trap if GD is set. FIXME!!!
     279    mov     [rdx + CPUM.Host.dr7], rax
     280    xor     eax, eax                    ; clear everything. (bit 12? is read as 1...)
     281    mov     dr7, rax
     282    mov     rax, dr6                    ; just in case we save the state register too.
     283    mov     [rdx + CPUM.Host.dr6], rax
     284    ; save host DR0-3?
     285    test    esi, CPUM_USE_DEBUG_REGS
     286    jz near htg_debug_regs_no
     287DEBUG_S_CHAR('S');
     288    mov     rax, dr0
     289    mov     [rdx + CPUM.Host.dr0], rax
     290    mov     rbx, dr1
     291    mov     [rdx + CPUM.Host.dr1], rbx
     292    mov     rcx, dr2
     293    mov     [rdx + CPUM.Host.dr2], rcx
     294    mov     rax, dr3
     295    mov     [rdx + CPUM.Host.dr3], rax
     296    jmp     htg_debug_regs_no
     297
     298
    272299    ; We're now on an identity mapped pages! in 32-bit compatability mode.
    273300BITS 32
     
    396423
    397424;;
    398 ; Detour for saving the host DR7 and DR6.
    399 ; esi and edx must be preserved.
    400 htg_debug_regs_save_dr7and6:
    401 DEBUG_S_CHAR('s');
    402     mov     eax, dr7                    ; not sure, but if I read the docs right this will trap if GD is set. FIXME!!!
    403     mov     [edx + CPUM.Host.dr7], eax
    404     xor     eax, eax                    ; clear everything. (bit 12? is read as 1...)
    405     mov     dr7, eax
    406     mov     eax, dr6                    ; just in case we save the state register too.
    407     mov     [edx + CPUM.Host.dr6], eax
    408     jmp     htg_debug_regs_no
    409 
    410 ;;
    411425; Detour for saving host DR0-3 and loading hypervisor debug registers.
    412426; esi and edx must be preserved.
     
    415429    DEBUG_S_CHAR('R')
    416430    DEBUG_S_CHAR('x')
    417     ; save host DR0-3.
    418     mov     eax, dr0
    419     mov     [edx + CPUM.Host.dr0], eax
    420     mov     ebx, dr1
    421     mov     [edx + CPUM.Host.dr1], ebx
    422     mov     ecx, dr2
    423     mov     [edx + CPUM.Host.dr2], ecx
    424     mov     eax, dr3
    425     mov     [edx + CPUM.Host.dr3], eax
    426431    ; load hyper DR0-7
    427432    mov     ebx, [edx + CPUM.Hyper.dr0]
     
    892897    mov     rbx, rdx
    893898    mov     ecx, MSR_K8_FS_BASE
    894     mov     eax, [ebx + CPUM.Host.FSbase]
    895     mov     edx, [ebx + CPUM.Host.FSbase + 4]
     899    mov     eax, [rbx + CPUM.Host.FSbase]
     900    mov     edx, [rbx + CPUM.Host.FSbase + 4]
    896901    wrmsr
    897902    mov     ecx, MSR_K8_GS_BASE
    898     mov     eax, [ebx + CPUM.Host.GSbase]
    899     mov     edx, [ebx + CPUM.Host.GSbase + 4]
     903    mov     eax, [rbx + CPUM.Host.GSbase]
     904    mov     edx, [rbx + CPUM.Host.GSbase + 4]
    900905    wrmsr
    901906    mov     ecx, MSR_K6_EFER
    902     mov     eax, [ebx + CPUM.Host.efer]
    903     mov     edx, [ebx + CPUM.Host.efer + 4]
     907    mov     eax, [rbx + CPUM.Host.efer]
     908    mov     edx, [rbx + CPUM.Host.efer + 4]
    904909    wrmsr
    905910    mov     rdx, rbx
     
    908913    ; restore general registers.
    909914    mov     eax, edi                    ; restore return code. eax = return code !!
    910     ; mov     rax, [edx + CPUM.Host.rax] - scratch + return code
     915    ; mov     rax, [rdx + CPUM.Host.rax] - scratch + return code
    911916    mov     rbx, [rdx + CPUM.Host.rbx]
    912     ; mov     rcx, [edx + CPUM.Host.rcx] - scratch
    913     ; mov     rdx, [edx + CPUM.Host.rdx] - scratch
     917    ; mov     rcx, [rdx + CPUM.Host.rcx] - scratch
     918    ; mov     rdx, [rdx + CPUM.Host.rdx] - scratch
    914919    mov     rdi, [rdx + CPUM.Host.rdi]
    915920    mov     rsi, [rdx + CPUM.Host.rsi]
    916921    mov     rsp, [rdx + CPUM.Host.rsp]
    917922    mov     rbp, [rdx + CPUM.Host.rbp]
    918     ; mov     r8,  [edx + CPUM.Host.r8 ] - scratch
    919     ; mov     r9,  [edx + CPUM.Host.r9 ] - scratch
     923    ; mov     r8,  [rdx + CPUM.Host.r8 ] - scratch
     924    ; mov     r9,  [rdx + CPUM.Host.r9 ] - scratch
    920925    mov     r10, [rdx + CPUM.Host.r10]
    921926    mov     r11, [rdx + CPUM.Host.r11]
     
    926931
    927932    ; finally restore flags. (probably not required)
    928     push    qword [edx + CPUM.Host.rflags]
     933    push    qword [rdx + CPUM.Host.rflags]
    929934    popf
    930935
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