VirtualBox

Changeset 86181 in vbox


Ignore:
Timestamp:
Sep 20, 2020 10:23:14 AM (4 years ago)
Author:
vboxsync
Message:

Debugger/DBGCRemoteKd: Stub the query memory attributes request (need a new DBGF Api for the real implementation)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Debugger/DBGCRemoteKd.cpp

    r86180 r86181  
    913913
    914914/**
     915 * Query memory properties payload.
     916 */
     917typedef struct KDPACKETMANIPULATE_QUERYMEMORY
     918{
     919    /** The address to query the properties for. */
     920    uint64_t                    u64GCPtr;
     921    /** Reserved. */
     922    uint64_t                    u64Rsvd;
     923    /** Address space type on return. */
     924    uint32_t                    u32AddrSpace;
     925    /** Protection flags. */
     926    uint32_t                    u32Flags;
     927    /** Blows up the request to the required size. */
     928    uint8_t                     abPad[16];
     929} KDPACKETMANIPULATE_QUERYMEMORY;
     930AssertCompileSize(KDPACKETMANIPULATE_QUERYMEMORY, 40);
     931/** Pointer to a query memory properties payload. */
     932typedef KDPACKETMANIPULATE_QUERYMEMORY *PKDPACKETMANIPULATE_QUERYMEMORY;
     933/** Pointer to a const query memory properties payload. */
     934typedef const KDPACKETMANIPULATE_QUERYMEMORY *PCKDPACKETMANIPULATE_QUERYMEMORY;
     935
     936
     937/** @name Query memory address space identifiers.
     938 * @{ */
     939/** Process memory space. */
     940#define KD_PACKET_MANIPULATE64_QUERY_MEMORY_ADDR_SPACE_PROCESS  UINT32_C(0)
     941/** Session memory space. */
     942#define KD_PACKET_MANIPULATE64_QUERY_MEMORY_ADDR_SPACE_SESSION  UINT32_C(1)
     943/** Kernel memory space. */
     944#define KD_PACKET_MANIPULATE64_QUERY_MEMORY_ADDR_KERNEL_SESSION UINT32_C(2)
     945/** @} */
     946
     947
     948/** @name Query memory address protection flags.
     949 * @{ */
     950/** Readable. */
     951#define KD_PACKET_MANIPULATE64_QUERY_MEMORY_ADDR_F_READ         RT_BIT_32(0)
     952/** Writable. */
     953#define KD_PACKET_MANIPULATE64_QUERY_MEMORY_ADDR_F_WRITE        RT_BIT_32(1)
     954/** Executable. */
     955#define KD_PACKET_MANIPULATE64_QUERY_MEMORY_ADDR_F_EXEC         RT_BIT_32(2)
     956/** Fixed address. */
     957#define KD_PACKET_MANIPULATE64_QUERY_MEMORY_ADDR_F_FIXED        RT_BIT_32(3)
     958/** @} */
     959
     960
     961/**
    915962 * Manipulate request packet header (Same for 32bit and 64bit).
    916963 */
     
    9631010        /** Context extended. */
    9641011        KDPACKETMANIPULATE_CONTEXTEX       ContextEx;
     1012        /** Query memory. */
     1013        KDPACKETMANIPULATE_QUERYMEMORY     QueryMemory;
    9651014    } u;
    9661015} KDPACKETMANIPULATE64;
     
    10241073/** Clear all internal breakpoints request. */
    10251074#define KD_PACKET_MANIPULATE_REQ_CLEAR_ALL_INTERNAL_BKPT    UINT32_C(0x0000315a)
     1075/** Fill memory. */
     1076#define KD_PACKET_MANIPULATE_REQ_FILL_MEMORY                UINT32_C(0x0000315b)
     1077/** Query memory properties. */
     1078#define KD_PACKET_MANIPULATE_REQ_QUERY_MEMORY               UINT32_C(0x0000315c)
    10261079/** @todo */
    10271080/** Get context extended request. */
     
    12961349                break;
    12971350            }
     1351            case KD_PACKET_MANIPULATE_REQ_QUERY_MEMORY:
     1352            {
     1353                KDPACKETMANIPULATE_QUERYMEMORY QueryMemory;
     1354                cbCopied = RTSgBufCopyToBuf(pSgBuf, &QueryMemory, sizeof(QueryMemory));
     1355                if (cbCopied == sizeof(QueryMemory))
     1356                {
     1357                    Log3(("        u64GCPtr:     %RX64\n"
     1358                          "        u32AddrSpace: %RX32\n"
     1359                          "        u32Flags:     %RX32\n",
     1360                          QueryMemory.u64GCPtr, QueryMemory.u32AddrSpace, QueryMemory.u32Flags));
     1361                }
     1362                else
     1363                    Log3(("        Payload to small, expected %u, got %zu\n", sizeof(QueryMemory), cbCopied));
     1364                break;
     1365            }
    12981366            default:
    12991367                break;
     
    24372505        rc = DBGFR3Resume(pThis->Dbgc.pUVM, VMCPUID_ALL);
    24382506
    2439     pThis->Dbgc.CmdHlp.pfnPrintf(&pThis->Dbgc.CmdHlp, NULL, "TestTestTest\n");
    2440 
    24412507    return rc;
    24422508}
     
    27922858
    27932859/**
     2860 * Processes a query memory 64 request.
     2861 *
     2862 * @returns VBox status code.
     2863 * @param   pThis               The KD context.
     2864 * @param   pPktManip           The manipulate packet request.
     2865 */
     2866static int dbgcKdCtxPktManipulate64QueryMemory(PKDCTX pThis, PCKDPACKETMANIPULATE64 pPktManip)
     2867{
     2868    KDPACKETMANIPULATEHDR RespHdr;
     2869    KDPACKETMANIPULATE_QUERYMEMORY QueryMemory;
     2870    RT_ZERO(RespHdr); RT_ZERO(QueryMemory);
     2871
     2872    RTSGSEG aRespSegs[2];
     2873    RespHdr.idReq       = KD_PACKET_MANIPULATE_REQ_QUERY_MEMORY;
     2874    RespHdr.u16CpuLvl   = pPktManip->Hdr.u16CpuLvl;
     2875    RespHdr.idCpu       = pPktManip->Hdr.idCpu;
     2876    RespHdr.u32NtStatus = NTSTATUS_SUCCESS;
     2877
     2878    /** @todo Need DBGF API to query protection and privilege level from guest page tables. */
     2879    QueryMemory.u64GCPtr     = pPktManip->u.QueryMemory.u64GCPtr;
     2880    QueryMemory.u32AddrSpace = KD_PACKET_MANIPULATE64_QUERY_MEMORY_ADDR_KERNEL_SESSION;
     2881    QueryMemory.u32Flags     =   KD_PACKET_MANIPULATE64_QUERY_MEMORY_ADDR_F_READ
     2882                               | KD_PACKET_MANIPULATE64_QUERY_MEMORY_ADDR_F_WRITE
     2883                               | KD_PACKET_MANIPULATE64_QUERY_MEMORY_ADDR_F_EXEC;
     2884
     2885    aRespSegs[0].pvSeg = &RespHdr;
     2886    aRespSegs[0].cbSeg = sizeof(RespHdr);
     2887    aRespSegs[1].pvSeg = &QueryMemory;
     2888    aRespSegs[1].cbSeg = sizeof(QueryMemory);
     2889
     2890    return dbgcKdCtxPktSendSg(pThis, KD_PACKET_HDR_SIGNATURE_DATA, KD_PACKET_HDR_SUB_TYPE_STATE_MANIPULATE,
     2891                              &aRespSegs[0], RT_ELEMENTS(aRespSegs), true /*fAck*/);
     2892}
     2893
     2894
     2895/**
    27942896 * Processes a manipulate packet.
    27952897 *
     
    28622964        {
    28632965            rc = dbgcKdCtxPktManipulate64GetContextEx(pThis, pPktManip);
     2966            break;
     2967        }
     2968        case KD_PACKET_MANIPULATE_REQ_QUERY_MEMORY:
     2969        {
     2970            rc = dbgcKdCtxPktManipulate64QueryMemory(pThis, pPktManip);
    28642971            break;
    28652972        }
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