VirtualBox

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


Ignore:
Timestamp:
Jan 29, 2007 6:04:13 PM (18 years ago)
Author:
vboxsync
Message:

Fixing interrupt dispatching on amd64.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/TRPMInternal.h

    r397 r415  
    183183 * Calls the interrupt gate as if we received an interrupt while in Ring-0.
    184184 *
    185  * Returns with interrupts enabled.
    186  *
    187185 * @param   uIP     The interrupt gate IP.
    188186 * @param   SelCS   The interrupt gate CS.
  • trunk/src/VBox/VMM/VMMR0/TRPMR0.cpp

    r397 r415  
    3434
    3535
    36 
    37 
    3836/**
    3937 * Dispatches an interrupt that arrived while we were in the guest context.
    4038 *
    41  * It's assumes we're invoked with interrupts disabled.
    42  * When this function returns, interrupts will be enabled.
    43  *
    4439 * @param   pVM     The VM handle.
     40 * @remark  Must be called with interrupts disabled.
    4541 */
    4642TRPMR0DECL(void) TRPMR0DispatchHostInterrupt(PVM pVM)
     
    189185     */
    190186    uint64_t *pau = (uint64_t *)pvRet;
     187    Assert(pau[1] == (uint64_t)pVM);
    191188    pau[0] = (uint64_t)trpmR0InterruptDispatcher; /* new return address */
    192189    pau[3] = pfnHandler.off;            /* retf off */
    193190    pau[4] = pfnHandler.sel;            /* retf sel */
    194191#endif
    195 
    196 //    dprintf(("Interrupt: %04x:%08x vector %d\n", pfnHandler.sel, pfnHandler.off, uActiveVector));
    197192}
    198193
  • trunk/src/VBox/VMM/VMMR0/TRPMR0A.asm

    r400 r415  
    3333; Calls the interrupt gate as if we received an interrupt while in Ring-0.
    3434;
    35 ; Returns with interrupts enabled.
    36 ;
    3735; @param   uIP     x86:[ebp+8]   msc:rcx  gcc:rdi  The interrupt gate IP.
    3836; @param   SelCS   x86:[ebp+12]  msc:dx   gcc:si   The interrupt gate CS.
     
    4442
    4543%ifdef __AMD64__
    46     mov     rax, rsp
    47     and     rsp, 15h                    ; align the stack. (do it unconditionally saves some jump mess)
     44    mov     r11, rsp                    ; save the RSP for the iret frame.
     45    and     rsp, ~15h                   ; align the stack. (do it unconditionally saves some jump mess)
    4846
    4947    ; switch stack?
     
    6159    ; create the iret frame
    6260    push    0                           ; SS
    63     push    rax                         ; RSP
     61    push    r11                         ; RSP
    6462    pushfd                              ; RFLAGS
    6563    and     dword [rsp], ~X86_EFL_IF
    6664    mov     ax, cs
    6765    push    rax                         ; CS
    68     mov     rax, .return                ; RIP
    69     push    rax
     66    lea     r10, [.return wrt rip]      ; RIP
     67    push    r10
    7068
    7169    ; create the retf frame
    7270 %ifdef ASM_CALL64_MSC
    7371    movzx   rdx, dx
     72    cmp     rdx, r11
     73    je      .dir_jump
    7474    push    rdx
    7575    push    rcx
    7676 %else
    77     movzx   rdi, di
     77    movzx   rsi, si
     78    cmp     rsi, r11
     79    je      .dir_jump
     80    push    rsi
    7881    push    rdi
    79     push    rsi
    8082 %endif
    8183
    82     ; dispatch it!
     84    ; dispatch it
    8385    db 048h
    8486    retf
     87
     88    ; dispatch it by a jmp (don't mess up the IST stack)
     89.dir_jump:
     90 %ifdef ASM_CALL64_MSC
     91    jmp     rcx
     92 %else
     93    jmp     rdi
     94 %endif
    8595
    8696%else ; 32-bit:
     
    102112%endif
    103113.return:
     114    cli
    104115
    105116    leave
     
    132143;           10  retf offset   (interrupt handler)
    133144;            8  uOperation
    134 ;            0  pVM
     145;            0  pVM (rsp here)
    135146;
    136147BEGINPROC trpmR0InterruptDispatcher
    137148%ifdef __AMD64__
    138149    lea     rsp, [rsp + 10h]            ; skip pVM and uOperation
     150    swapgs
    139151    db 48h
    140152    retf
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