VirtualBox

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


Ignore:
Timestamp:
Nov 24, 2008 12:33:00 PM (16 years ago)
Author:
vboxsync
Message:

SUPDrv,SUPLib,VMM: Kicked out the dead VBOX_WITH_IDT_PATCHING code.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/Makefile.kmk

    r14167 r14515  
    3535VMMR3_DEFS      = IN_VMM_R3 IN_DIS IN_GMM_R3 IN_DBG
    3636## @todo eliminate IN_GMM_R3
    37 ifdef VBOX_WITH_IDT_PATCHING
    38 VMMR3_DEFS     += VBOX_WITH_IDT_PATCHING
    39 endif
    4037ifdef VBOX_WITH_PREALLOC_RAM_BY_DEFAULT
    4138VMMR3_DEFS     += VBOX_WITH_PREALLOC_RAM_BY_DEFAULT
     
    302299        PATM
    303300VMMGC_DEFS      = IN_VMM_RC IN_RT_GC IN_RT_RC IN_DIS DIS_CORE_ONLY
    304 ifdef VBOX_WITH_IDT_PATCHING
    305 VMMGC_DEFS     += VBOX_WITH_IDT_PATCHING
    306 endif
    307301ifdef VBOX_WITH_R0_LOGGING
    308302VMMGC_DEFS     += VBOX_WITH_R0_LOGGING
     
    400394VMMR0_DEFS      = IN_VMM_R0 IN_RT_R0 IN_DIS DIS_CORE_ONLY IN_GVMM_R0 IN_GMM_R0 IN_INTNET_R0 RTASSERT_HAVE_SHOULD_PANIC
    401395## @todo eliminate IN_GVMM_R0 IN_GMM_R0
    402 ifdef VBOX_WITH_IDT_PATCHING
    403 VMMR0_DEFS     += VBOX_WITH_IDT_PATCHING
    404 endif
    405396ifdef VBOX_WITH_R0_LOGGING
    406397VMMR0_DEFS     += VBOX_WITH_R0_LOGGING
  • trunk/src/VBox/VMM/TRPMInternal.h

    r14351 r14515  
    240240DECLASM(void) trpmR0DispatchHostInterruptSimple(RTUINT uActiveVector);
    241241
    242 # ifdef VBOX_WITH_IDT_PATCHING
    243 /**
    244  * Code used for the dispatching of interrupts in R0 upon return from RC.
    245  * @internal
    246  */
    247 DECLASM(int) trpmR0InterruptDispatcher(void);
    248 # endif /* VBOX_WITH_IDT_PATCHING */
    249 
    250242#endif /* IN_RING0 */
    251243
  • trunk/src/VBox/VMM/VMMR0/TRPMR0.cpp

    r12989 r14515  
    101101}
    102102
    103 
    104 #ifdef VBOX_WITH_IDT_PATCHING
    105 # ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL
    106 #  error "VBOX_WITH_HYBIRD_32BIT_KERNEL with VBOX_WITH_IDT_PATCHING isn't supported"
    107 # endif
    108 
    109 /**
    110  * Changes the VMMR0Entry() call frame and stack used by the IDT patch code
    111  * so that we'll dispatch an interrupt rather than returning directly to Ring-3
    112  * when VMMR0Entry() returns.
    113  *
    114  * @param   pVM         Pointer to the VM.
    115  * @param   pvRet       Pointer to the return address of VMMR0Entry() on the stack.
    116  */
    117 VMMR0DECL(void) TRPMR0SetupInterruptDispatcherFrame(PVM pVM, void *pvRet)
    118 {
    119     RTUINT uActiveVector = pVM->trpm.s.uActiveVector;
    120     pVM->trpm.s.uActiveVector = ~0;
    121     AssertMsgReturnVoid(uActiveVector < 256, ("uActiveVector=%#x is invalid! (More assertions to come, please enjoy!)\n", uActiveVector));
    122 
    123 #if HC_ARCH_BITS == 32
    124     /*
    125      * Get the handler pointer (16:32 ptr).
    126      */
    127     RTIDTR      Idtr;
    128     ASMGetIDTR(&Idtr);
    129     PVBOXIDTE   pIdte = &((PVBOXIDTE)Idtr.pIdt)[uActiveVector];
    130     AssertMsgReturnVoid(pIdte->Gen.u1Present, ("The IDT entry (%d) is not present!\n", uActiveVector));
    131     AssertMsgReturnVoid(    pIdte->Gen.u3Type1 == VBOX_IDTE_TYPE1
    132                         &&  pIdte->Gen.u5Type2 == VBOX_IDTE_TYPE2_INT_32,
    133                         ("The IDT entry (%d) is not 32-bit int gate! type1=%#x type2=%#x\n",
    134                          uActiveVector, pIdte->Gen.u3Type1, pIdte->Gen.u5Type2));
    135 
    136     RTFAR32   pfnHandler;
    137     pfnHandler.off = VBOXIDTE_OFFSET(*pIdte);
    138     pfnHandler.sel = pIdte->Gen.u16SegSel;
    139 
    140     /*
    141      * The stack frame is as follows:
    142      *
    143      *      1c  iret frame
    144      *      18  fs
    145      *      14  ds
    146      *      10  es
    147      *       c  uArg
    148      *       8  uOperation
    149      *       4  pVM
    150      *       0  return address (pvRet points here)
    151      *
    152      * We'll change the stackframe so that we will not return
    153      * to the caller but to a interrupt dispatcher. We'll also
    154      * setup the frame so that ds and es are moved to give room
    155      * to a far return (to the handler).
    156      */
    157     unsigned *pau = (unsigned *)pvRet;
    158     pau[0] = (unsigned)trpmR0InterruptDispatcher; /* new return address */
    159     pau[3] = pau[6];                    /* uArg = fs */
    160     pau[2] = pau[5];                    /* uOperation = ds */
    161     pau[5] = pfnHandler.off;            /* ds = retf off */
    162     pau[6] = pfnHandler.sel;            /* fs = retf sel */
    163 
    164 #else /* 64-bit: */
    165 
    166     /*
    167      * Get the handler pointer (16:48 ptr).
    168      */
    169     RTIDTR      Idtr;
    170     ASMGetIDTR(&Idtr);
    171     PVBOXIDTE   pIdte = &((PVBOXIDTE)Idtr.pIdt)[uActiveVector * 2];
    172 
    173     AssertMsgReturnVoid(pIdte->Gen.u1Present, ("The IDT entry (%d) is not present!\n", uActiveVector));
    174     AssertMsgReturnVoid(    pIdte->Gen.u3Type1 == VBOX_IDTE_TYPE1
    175                         &&  pIdte->Gen.u5Type2 == VBOX_IDTE_TYPE2_INT_32, /* == 64 */
    176                         ("The IDT entry (%d) is not 64-bit int gate! type1=%#x type2=%#x\n",
    177                          uActiveVector, pIdte->Gen.u3Type1, pIdte->Gen.u5Type2));
    178 
    179     RTFAR64   pfnHandler;
    180     pfnHandler.off = VBOXIDTE_OFFSET(*pIdte);
    181     pfnHandler.off |= (uint64_t)(*(uint32_t *)(pIdte + 1)) << 32; //cleanup!
    182     pfnHandler.sel = pIdte->Gen.u16SegSel;
    183 
    184     if (pIdte->au32[1] & 0x7 /*IST*/)
    185     {
    186         /** @todo implement IST */
    187     }
    188 
    189     /*
    190      * The stack frame is as follows:
    191      *
    192      *      28  iret frame
    193      *      20  dummy
    194      *      14  uArg
    195      *      10  uOperation
    196      *       8  pVM
    197      *       0  return address (pvRet points here)
    198      *
    199      * We'll change the stackframe so that we will not return
    200      * to the caller but to a interrupt dispatcher. And we'll create
    201      * a 64-bit far return frame where dummy and uArg is.
    202      */
    203     uint64_t *pau = (uint64_t *)pvRet;
    204     Assert(pau[1] == (uint64_t)pVM);
    205     pau[0] = (uint64_t)trpmR0InterruptDispatcher; /* new return address */
    206     pau[3] = pfnHandler.off;            /* retf off */
    207     pau[4] = pfnHandler.sel;            /* retf sel */
    208 #endif
    209 }
    210 
    211 #endif /* VBOX_WITH_IDT_PATCHING */
  • trunk/src/VBox/VMM/VMMR0/TRPMR0A.asm

    r8155 r14515  
    119119
    120120
    121 %ifdef VBOX_WITH_IDT_PATCHING
    122 
    123     align 16
    124 ;;
    125 ; This is the alternative return from VMMR0Entry() used when
    126 ; we need to dispatch an interrupt to the Host (we received it in GC).
    127 ;
    128 ; As seen in TRPMR0SetupInterruptDispatcherFrame() the stack is different
    129 ; than for the normal VMMR0Entry() return.
    130 ;
    131 ; 32-bit:
    132 ;           18  iret frame
    133 ;           14  retf selector (interrupt handler)
    134 ;           10  retf offset   (interrupt handler)
    135 ;            c  es
    136 ;            8  fs
    137 ;            4  ds
    138 ;            0  pVM (esp here)
    139 ;
    140 ; 64-bit:
    141 ;           24  iret frame
    142 ;           18  retf selector (interrupt handler)
    143 ;           10  retf offset   (interrupt handler)
    144 ;            8  uOperation
    145 ;            0  pVM (rsp here)
    146 ;
    147 BEGINPROC trpmR0InterruptDispatcher
    148 %ifdef RT_ARCH_AMD64
    149     lea     rsp, [rsp + 10h]            ; skip pVM and uOperation
    150     swapgs
    151     db 48h
    152     retf
    153 %else  ; !RT_ARCH_AMD64
    154     add     esp, byte 4                 ; skip pVM
    155     pop     ds
    156     pop     fs
    157     pop     es
    158     retf
    159 %endif ; !RT_ARCH_AMD64
    160 ENDPROC   trpmR0InterruptDispatcher
    161 
    162 %endif ; VBOX_WITH_IDT_PATCHING
    163 
    164 
    165121;;
    166122; Issues a software interrupt to the specified interrupt vector.
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r14500 r14515  
    475475
    476476/**
    477  * The Ring 0 entry point, called by the interrupt gate.
     477 * Unused ring-0 entry point that used to be called from the interrupt gate.
     478 *
     479 * Will be removed one of the next times we do a major SUPDrv version bump.
    478480 *
    479481 * @returns VBox status code.
     
    487489    switch (enmOperation)
    488490    {
    489 #ifdef VBOX_WITH_IDT_PATCHING
    490         /*
    491          * Switch to GC.
    492          * These calls return whatever the GC returns.
    493          */
    494         case VMMR0_DO_RAW_RUN:
    495         {
    496             /* Safety precaution as VMX disables the switcher. */
    497             Assert(!pVM->vmm.s.fSwitcherDisabled);
    498             if (pVM->vmm.s.fSwitcherDisabled)
    499                 return VERR_NOT_SUPPORTED;
    500 
    501             STAM_COUNTER_INC(&pVM->vmm.s.StatRunRC);
    502             register int rc;
    503             pVM->vmm.s.iLastGZRc = rc = pVM->vmm.s.pfnHostToGuestR0(pVM);
    504 
    505 #ifdef VBOX_WITH_STATISTICS
    506             vmmR0RecordRC(pVM, rc);
    507 #endif
    508 
    509             /*
    510              * We'll let TRPM change the stack frame so our return is different.
    511              * Just keep in mind that after the call, things have changed!
    512              */
    513             if (    rc == VINF_EM_RAW_INTERRUPT
    514                 ||  rc == VINF_EM_RAW_INTERRUPT_HYPER)
    515             {
    516                 /*
    517                  * Don't trust the compiler to get this right.
    518                  * gcc -fomit-frame-pointer screws up big time here. This works fine in 64-bit
    519                  * mode too because we push the arguments on the stack in the IDT patch code.
    520                  */
    521 # if defined(__GNUC__)
    522                 void *pvRet = (uint8_t *)__builtin_frame_address(0) + sizeof(void *);
    523 # elif defined(_MSC_VER) && defined(RT_ARCH_AMD64) /** @todo check this with with VC7! */
    524                 void *pvRet = (uint8_t *)_AddressOfReturnAddress();
    525 # elif defined(RT_ARCH_X86)
    526                 void *pvRet = (uint8_t *)&pVM - sizeof(pVM);
    527 # else
    528 #  error "huh?"
    529 # endif
    530                 if (    ((uintptr_t *)pvRet)[1] == (uintptr_t)pVM
    531                     &&  ((uintptr_t *)pvRet)[2] == (uintptr_t)enmOperation
    532                     &&  ((uintptr_t *)pvRet)[3] == (uintptr_t)pvArg)
    533                     TRPMR0SetupInterruptDispatcherFrame(pVM, pvRet);
    534                 else
    535                 {
    536 # if defined(DEBUG) || defined(LOG_ENABLED)
    537                     static bool  s_fHaveWarned = false;
    538                     if (!s_fHaveWarned)
    539                     {
    540                          s_fHaveWarned = true;
    541                          RTLogPrintf("VMMR0.r0: The compiler can't find the stack frame!\n");
    542                          RTLogComPrintf("VMMR0.r0: The compiler can't find the stack frame!\n");
    543                     }
    544 # endif
    545                     TRPMR0DispatchHostInterrupt(pVM);
    546                 }
    547             }
    548             return rc;
    549         }
    550 
    551         /*
    552          * Switch to GC to execute Hypervisor function.
    553          */
    554         case VMMR0_DO_CALL_HYPERVISOR:
    555         {
    556             /* Safety precaution as VMX disables the switcher. */
    557             Assert(!pVM->vmm.s.fSwitcherDisabled);
    558             if (pVM->vmm.s.fSwitcherDisabled)
    559                 return VERR_NOT_SUPPORTED;
    560 
    561             RTCCUINTREG fFlags = ASMIntDisableFlags();
    562             int rc = pVM->vmm.s.pfnHostToGuestR0(pVM);
    563             /** @todo dispatch interrupts? */
    564             ASMSetFlags(fFlags);
    565             return rc;
    566         }
    567 
    568         /*
    569          * For profiling.
    570          */
    571         case VMMR0_DO_NOP:
    572             return VINF_SUCCESS;
    573 #endif /* VBOX_WITH_IDT_PATCHING */
    574 
    575491        default:
    576492            /*
  • trunk/src/VBox/VMM/testcase/Makefile.kmk

    r14118 r14515  
    8989tstVMStructGC_TEMPLATE  = VBOXGCEXE
    9090tstVMStructGC_DEFS      = IN_VMM_RC IN_DIS IN_RT_RC IN_RT_GC
    91 ifdef VBOX_WITH_IDT_PATCHING
    92 tstVMStructGC_DEFS     += VBOX_WITH_IDT_PATCHING
    93 endif
    9491ifdef VBOX_WITH_R0_LOGGING
    9592tstVMStructGC_DEFS     += VBOX_WITH_R0_LOGGING
     
    103100tstVMStructSize_SOURCES = tstVMStructSize.cpp
    104101tstVMStructSize.cpp_DEPS= $(VBOX_VMM_TESTCASE_OUT_DIR)/tstVMStructGC.h
    105 ifdef VBOX_WITH_IDT_PATCHING
    106 tstVMStructSize_DEFS   += VBOX_WITH_IDT_PATCHING
    107 endif
    108102ifdef VBOX_WITH_R0_LOGGING
    109103tstVMStructSize_DEFS   += VBOX_WITH_R0_LOGGING
     
    116110tstAsmStructs_TEMPLATE  = VBOXR3AUTOTST
    117111tstAsmStructs_DEFS      = IN_VMM_R3 IN_DIS
    118 ifdef VBOX_WITH_IDT_PATCHING
    119 tstAsmStructs_DEFS     += VBOX_WITH_IDT_PATCHING
    120 endif
    121112ifdef VBOX_WITH_R0_LOGGING
    122113tstAsmStructs_DEFS     += VBOX_WITH_R0_LOGGING
     
    127118tstAsmStructsGC_TEMPLATE= VBOXGCEXE
    128119tstAsmStructsGC_DEFS    = IN_VMM_RC IN_DIS IN_RT_RC IN_RT_GC
    129 ifdef VBOX_WITH_IDT_PATCHING
    130 tstAsmStructsGC_DEFS    += VBOX_WITH_IDT_PATCHING
    131 endif
    132120ifdef VBOX_WITH_R0_LOGGING
    133121tstAsmStructsGC_DEFS   += VBOX_WITH_R0_LOGGING
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