VirtualBox

Changeset 42585 in vbox


Ignore:
Timestamp:
Aug 3, 2012 4:50:05 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
79767
Message:

Hidden registry exploration.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VMMDevTesting.h

    r41416 r42585  
    7979/** Report a failure, sending reason (zero terminated string). (RTTestSkipped) */
    8080#define VMMDEV_TESTING_CMD_SKIPPED      UINT32_C(0xcab1e006)
     81/** Report a value found in a VMM register, sending a string on the form
     82 * "value-name:register-name". */
     83#define VMMDEV_TESTING_CMD_VALUE_REG    UINT32_C(0xcab1e007)
    8184/** @} */
    8285
  • trunk/include/VBox/VMMDevTesting.mac

    r41416 r42585  
    2121%define VMMDEV_TESTING_CMD_VALUE        0xcab1e005
    2222%define VMMDEV_TESTING_CMD_SKIPPED      0xcab1e006
     23%define VMMDEV_TESTING_CMD_VALUE_REG    0xcab1e007
    2324%define VMMDEV_TESTING_UNIT_PCT                 0x01
    2425%define VMMDEV_TESTING_UNIT_BYTES               0x02
  • trunk/include/VBox/err.mac

    r42396 r42585  
    208208%define VERR_CPUM_RAISE_GP_0    (-1750)
    209209%define VERR_CPUM_INCOMPATIBLE_CONFIG    (-1751)
     210%define VERR_CPUM_HIDDEN_CS_LOAD_ERROR    (-1752)
    210211%define VERR_SSM_UNIT_EXISTS    (-1800)
    211212%define VERR_SSM_UNIT_NOT_FOUND    (-1801)
  • trunk/include/iprt/x86.mac

    r42396 r42585  
    626626%ifndef VBOX_FOR_DTRACE_LIB
    627627%endif
    628 %define X86_SEL_SHIFT       3
    629 %define X86_SEL_MASK        0xfff8
    630 %define X86_SEL_LDT         0x0004
    631 %define X86_SEL_RPL         0x0003
     628%define X86_SEL_SHIFT           3
     629%define X86_SEL_MASK            0xfff8
     630%define X86_SEL_MASK_OFF_RPL    0xfffc
     631%define X86_SEL_LDT             0x0004
     632%define X86_SEL_RPL             0x0003
     633%define X86_SEL_RPL_LDT         0x0007
    632634%define X86_TRAP_ERR_EXTERNAL       1
    633635%define X86_TRAP_ERR_IDT            2
  • trunk/src/VBox/Devices/VMMDev/VMMDevTesting.cpp

    r41416 r42585  
    22/** @file
    33 * VMMDev - Testing Extensions.
     4 *
     5 * To enable: VBoxManage setextradata vmname VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled  1
    46 */
    57
     
    2224#define LOG_GROUP LOG_GROUP_DEV_VMM
    2325#include <VBox/VMMDev.h>
     26#include <VBox/vmm/vmapi.h>
    2427#include <VBox/log.h>
    2528#include <VBox/err.h>
     
    111114}
    112115
     116#ifdef IN_RING3
     117
     118/**
     119 * Executes the VMMDEV_TESTING_CMD_VALUE_REG command when the data is ready.
     120 *
     121 * @param   pDevIns             The PDM device instance.
     122 * @param   pThis               The instance VMMDev data.
     123 */
     124static void vmmdevTestingCmdExec_ValueReg(PPDMDEVINS pDevIns, VMMDevState *pThis)
     125{
     126    char *pszRegNm = strchr(pThis->TestingData.String.sz, ':');
     127    if (pszRegNm)
     128    {
     129        *pszRegNm++ = '\0';
     130        pszRegNm = RTStrStrip(pszRegNm);
     131    }
     132    char        *pszValueNm = RTStrStrip(pThis->TestingData.String.sz);
     133    size_t const cchValueNm = strlen(pszValueNm);
     134    if (cchValueNm && pszRegNm && *pszRegNm)
     135    {
     136        PVM         pVM = PDMDevHlpGetVM(pDevIns);
     137        VMCPUID     idCpu = VMMGetCpuId(pVM);
     138        uint64_t    u64Value;
     139        int rc2 = DBGFR3RegNmQueryU64(pVM, idCpu, pszRegNm, &u64Value);
     140        if (RT_SUCCESS(rc2))
     141        {
     142            const char *pszWarn = rc2 == VINF_DBGF_TRUNCATED_REGISTER ? "truncated" : "";
     143            VMMDEV_TESTING_OUTPUT(("testing: VALUE '%s'%*s: %'9llu (%#llx) [0] {reg=%s}\n",
     144                                   pszValueNm,
     145                                   (ssize_t)cchValueNm - 12 > 48 ? 0 : 48 - ((ssize_t)cchValueNm - 12), "",
     146                                   u64Value, u64Value, pszRegNm, pszWarn));
     147        }
     148        else
     149            VMMDEV_TESTING_OUTPUT(("testing: error querying register '%s' for value '%s': %Rrc\n",
     150                                   pszRegNm, pszValueNm, rc2));
     151    }
     152    else
     153        VMMDEV_TESTING_OUTPUT(("testing: malformed register value '%s'/'%s'\n", pszValueNm, pszRegNm));
     154}
     155
     156#endif /* IN_RING3 */
    113157
    114158/**
     
    121165    switch (Port)
    122166    {
     167        /*
     168         * The NOP I/O ports are used for performance measurements.
     169         */
    123170        case VMMDEV_TESTING_IOPORT_NOP:
    124171            switch (cb)
     
    134181            return VINF_SUCCESS;
    135182
     183        /* The timestamp I/O ports are read-only. */
    136184        case VMMDEV_TESTING_IOPORT_TS_LOW:
    137             break;
    138 
    139185        case VMMDEV_TESTING_IOPORT_TS_HIGH:
    140186            break;
    141187
     188        /*
     189         * The command port (DWORD write only).
     190         */
    142191        case VMMDEV_TESTING_IOPORT_CMD:
    143192            if (cb == 4)
     
    150199            break;
    151200
     201        /*
     202         * The data port.  Used of providing data for a command.
     203         */
    152204        case VMMDEV_TESTING_IOPORT_DATA:
    153205        {
     
    266318                    break;
    267319
     320
     321                /*
     322                 * RTTestValue with the return from DBGFR3RegNmQuery.
     323                 */
     324                case VMMDEV_TESTING_CMD_VALUE_REG:
     325                {
     326                    if (   off < sizeof(pThis->TestingData.String.sz) - 1
     327                        && cb == 1)
     328                    {
     329                        pThis->TestingData.String.sz[off] = u32;
     330                        if (u32)
     331                            pThis->offTestingData = off + 1;
     332                        else
     333#ifdef IN_RING3
     334                            vmmdevTestingCmdExec_ValueReg(pDevIns, pThis);
     335#else
     336                            return VINF_IOM_R3_IOPORT_WRITE;
     337#endif
     338                        return VINF_SUCCESS;
     339                    }
     340                    break;
     341
     342                }
     343
    268344                default:
    269345                    break;
     
    290366    switch (Port)
    291367    {
     368        /*
     369         * The NOP I/O ports are used for performance measurements.
     370         */
    292371        case VMMDEV_TESTING_IOPORT_NOP:
    293372            switch (cb)
     
    304383            return VINF_SUCCESS;
    305384
     385        /*
     386         * The timestamp I/O ports are obviously used for getting a good fix
     387         * on the current time (as seen by the host?).
     388         *
     389         * The high word is latched when reading the low, so reading low + high
     390         * gives you a 64-bit timestamp value.
     391         */
    306392        case VMMDEV_TESTING_IOPORT_TS_LOW:
    307393            if (cb == 4)
     
    322408            break;
    323409
     410        /*
     411         * The command and data registers are write-only.
     412         */
    324413        case VMMDEV_TESTING_IOPORT_CMD:
    325414        case VMMDEV_TESTING_IOPORT_DATA:
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette