Changeset 86181 in vbox
- Timestamp:
- Sep 20, 2020 10:23:14 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/DBGCRemoteKd.cpp
r86180 r86181 913 913 914 914 /** 915 * Query memory properties payload. 916 */ 917 typedef 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; 930 AssertCompileSize(KDPACKETMANIPULATE_QUERYMEMORY, 40); 931 /** Pointer to a query memory properties payload. */ 932 typedef KDPACKETMANIPULATE_QUERYMEMORY *PKDPACKETMANIPULATE_QUERYMEMORY; 933 /** Pointer to a const query memory properties payload. */ 934 typedef 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 /** 915 962 * Manipulate request packet header (Same for 32bit and 64bit). 916 963 */ … … 963 1010 /** Context extended. */ 964 1011 KDPACKETMANIPULATE_CONTEXTEX ContextEx; 1012 /** Query memory. */ 1013 KDPACKETMANIPULATE_QUERYMEMORY QueryMemory; 965 1014 } u; 966 1015 } KDPACKETMANIPULATE64; … … 1024 1073 /** Clear all internal breakpoints request. */ 1025 1074 #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) 1026 1079 /** @todo */ 1027 1080 /** Get context extended request. */ … … 1296 1349 break; 1297 1350 } 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 } 1298 1366 default: 1299 1367 break; … … 2437 2505 rc = DBGFR3Resume(pThis->Dbgc.pUVM, VMCPUID_ALL); 2438 2506 2439 pThis->Dbgc.CmdHlp.pfnPrintf(&pThis->Dbgc.CmdHlp, NULL, "TestTestTest\n");2440 2441 2507 return rc; 2442 2508 } … … 2792 2858 2793 2859 /** 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 */ 2866 static 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 /** 2794 2896 * Processes a manipulate packet. 2795 2897 * … … 2862 2964 { 2863 2965 rc = dbgcKdCtxPktManipulate64GetContextEx(pThis, pPktManip); 2966 break; 2967 } 2968 case KD_PACKET_MANIPULATE_REQ_QUERY_MEMORY: 2969 { 2970 rc = dbgcKdCtxPktManipulate64QueryMemory(pThis, pPktManip); 2864 2971 break; 2865 2972 }
Note:
See TracChangeset
for help on using the changeset viewer.