VirtualBox

Changeset 19181 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 24, 2009 6:36:01 PM (16 years ago)
Author:
vboxsync
Message:

DBGFDisas: switch to the EMT of the VCpu in DBGFR3DisasInstrEx if we're not on it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/DBGFDisas.cpp

    r18927 r19181  
    292292
    293293/**
    294  * Disassembles the one instruction according to the specified flags and address.
    295  *
    296  * @returns VBox status code.
    297  * @param       pVM             VM handle.
    298  * @param       pVCpu           VMCPU handle.
     294 * Disassembles the one instruction according to the specified flags and
     295 * address, internal worker executing on the EMT of the specified virtual CPU.
     296 *
     297 * @returns VBox status code.
     298 * @param       pVM             The VM handle.
     299 * @param       pVCpu           The virtual CPU handle.
    299300 * @param       Sel             The code selector. This used to determin the 32/16 bit ness and
    300301 *                              calculation of the actual instruction address.
    301  * @param       GCPtr           The code address relative to the base of Sel.
     302 * @param       pGCPtr          Pointer to the variable holding the code address
     303 *                              relative to the base of Sel.
    302304 * @param       fFlags          Flags controlling where to start and how to format.
    303305 *                              A combination of the DBGF_DISAS_FLAGS_* \#defines.
     
    306308 * @param       pcbInstr        Where to return the size of the instruction.
    307309 */
    308 VMMR3DECL(int) DBGFR3DisasInstrEx(PVM pVM, PVMCPU pVCpu, RTSEL Sel, RTGCPTR GCPtr, unsigned fFlags, char *pszOutput, uint32_t cchOutput, uint32_t *pcbInstr)
    309 {
    310     /* If not specified, assume CPU 0. */
    311     if (!pVCpu)
    312         pVCpu = &pVM->aCpus[0];
     310static DECLCALLBACK(int)
     311dbgfR3DisasInstrExOnVCpu(PVM pVM, PVMCPU pVCpu, RTSEL Sel, PRTGCPTR pGCPtr, unsigned fFlags,
     312                         char *pszOutput, uint32_t cchOutput, uint32_t *pcbInstr)
     313{
     314    RTGCPTR GCPtr = *pGCPtr;
    313315
    314316    /*
     
    514516
    515517/**
     518 * Disassembles the one instruction according to the specified flags and address.
     519 *
     520 * @returns VBox status code.
     521 * @param   pVM             VM handle.
     522 * @param   pVCpu           The virtual CPU handle, defaults to CPU 0 if NULL.
     523 * @param   Sel             The code selector. This used to determin the 32/16 bit ness and
     524 *                          calculation of the actual instruction address.
     525 * @param   GCPtr           The code address relative to the base of Sel.
     526 * @param   fFlags          Flags controlling where to start and how to format.
     527 *                          A combination of the DBGF_DISAS_FLAGS_* \#defines.
     528 * @param   pszOutput       Output buffer.
     529 * @param   cchOutput       Size of the output buffer.
     530 * @param   pcbInstr        Where to return the size of the instruction.
     531 *
     532 * @remarks May have to switch to the EMT of the virtual CPU in order to do
     533 *          address conversion.
     534 */
     535VMMR3DECL(int) DBGFR3DisasInstrEx(PVM pVM, PVMCPU pVCpu, RTSEL Sel, RTGCPTR GCPtr, unsigned fFlags,
     536                                  char *pszOutput, uint32_t cchOutput, uint32_t *pcbInstr)
     537{
     538    /* If not specified, assume CPU 0. */
     539    if (!pVCpu)
     540        pVCpu = &pVM->aCpus[0];
     541
     542    int rc;
     543    if (VMCPU_IS_EMT(pVCpu)) /* not necessary, but it's faster. */
     544        rc = dbgfR3DisasInstrExOnVCpu(pVM, pVCpu, Sel, &GCPtr, fFlags, pszOutput, cchOutput, pcbInstr);
     545    else
     546    {
     547        PVMREQ pReq = NULL;
     548        rc = VMR3ReqCall(pVCpu->pVMR3, VMREQDEST_FROM_VMCPU(pVCpu), &pReq, RT_INDEFINITE_WAIT,
     549                         (PFNRT)dbgfR3DisasInstrExOnVCpu, 8,
     550                         pVM, pVCpu, Sel, &GCPtr, fFlags, pszOutput, cchOutput, pcbInstr);
     551        if (RT_SUCCESS(rc))
     552        {
     553            rc = pReq->iStatus;
     554            VMR3ReqFree(pReq);
     555        }
     556    }
     557    return rc;
     558}
     559
     560
     561/**
    516562 * Disassembles an instruction.
    517563 * Addresses will be tried resolved to symbols
    518564 *
    519565 * @returns VBox status code.
    520  * @param       pVM             VM handle.
    521  * @param       pVCpu           VMCPU handle.
    522  * @param       Sel             The code selector. This used to determin the 32/16 bit ness and
    523  *                              calculation of the actual instruction address.
    524  * @param       GCPtr           The code address relative to the base of Sel.
    525  * @param       pszOutput       Output buffer.
    526  * @param       cchOutput        Size of the output buffer.
     566 * @param   pVM             VM handle.
     567 * @param   pVCpu           The virtual CPU handle, defaults to CPU 0 if NULL.
     568 * @param   Sel             The code selector. This used to determin the 32/16 bit ness and
     569 *                          calculation of the actual instruction address.
     570 * @param   GCPtr           The code address relative to the base of Sel.
     571 * @param   pszOutput       Output buffer.
     572 * @param   cchOutput        Size of the output buffer.
    527573 */
    528574VMMR3DECL(int) DBGFR3DisasInstr(PVM pVM, PVMCPU pVCpu, RTSEL Sel, RTGCPTR GCPtr, char *pszOutput, uint32_t cchOutput)
     
    537583 *
    538584 * @returns VBox status code.
    539  * @param       pVM             VM handle.
    540  * @param       pszOutput       Output buffer.
    541  * @param       cchOutput       Size of the output buffer.
     585 * @param   pVM             VM handle.
     586 * @param   pszOutput       Output buffer.
     587 * @param   cchOutput       Size of the output buffer.
    542588 */
    543589VMMR3DECL(int) DBGFR3DisasInstrCurrent(PVM pVM, char *pszOutput, uint32_t cchOutput)
     
    552598 *
    553599 * @returns VBox status code.
    554  * @param       pVM             VM handle.
    555  * @param       pszPrefix       Short prefix string to the dissassembly string. (optional)
     600 * @param   pVM             VM handle.
     601 * @param   pszPrefix       Short prefix string to the dissassembly string. (optional)
    556602 */
    557603VMMR3DECL(int) DBGFR3DisasInstrCurrentLogInternal(PVM pVM, const char *pszPrefix)
     
    576622 *
    577623 * @returns VBox status code.
    578  * @param       pVM             VM handle.
    579  * @param       pVCpu           VMCPU handle.
    580  * @param       Sel             The code selector. This used to determin the 32/16 bit-ness and
    581  *                              calculation of the actual instruction address.
    582  * @param       GCPtr           The code address relative to the base of Sel.
     624 * @param   pVM             VM handle.
     625 * @param   pVCpu           The virtual CPU handle, defaults to CPU 0 if NULL.
     626 * @param   Sel             The code selector. This used to determin the 32/16 bit-ness and
     627 *                          calculation of the actual instruction address.
     628 * @param   GCPtr           The code address relative to the base of Sel.
    583629 */
    584630VMMR3DECL(int) DBGFR3DisasInstrLogInternal(PVM pVM, PVMCPU pVCpu, RTSEL Sel, RTGCPTR GCPtr)
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