mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
- Implement KdpQueryMemory (KdQueryMemoryApi).
- Setting and clearing breakpoints now works! (At least the simple ones with F9/bp/bc). And they actually get hit properly. svn path=/trunk/; revision=26007
This commit is contained in:
parent
4b3c677fe7
commit
2742ba22e8
2 changed files with 74 additions and 5 deletions
|
@ -125,6 +125,22 @@
|
|||
#define DBGKD_64BIT_PROTOCOL_VERSION1 5
|
||||
#define DBGKD_64BIT_PROTOCOL_VERSION2 6
|
||||
|
||||
//
|
||||
// Query Memory Address Spaces
|
||||
//
|
||||
#define DBGKD_QUERY_MEMORY_VIRTUAL 0
|
||||
#define DBGKD_QUERY_MEMORY_PROCESS 0
|
||||
#define DBGKD_QUERY_MEMORY_SESSION 1
|
||||
#define DBGKD_QUERY_MEMORY_KERNEL 2
|
||||
|
||||
//
|
||||
// Query Memory Flags
|
||||
//
|
||||
#define DBGKD_QUERY_MEMORY_READ 0x01
|
||||
#define DBGKD_QUERY_MEMORY_WRITE 0x02
|
||||
#define DBGKD_QUERY_MEMORY_EXECUTE 0x04
|
||||
#define DBGKD_QUERY_MEMORY_FIXED 0x08
|
||||
|
||||
//
|
||||
// KD Packet Structure
|
||||
//
|
||||
|
|
|
@ -14,6 +14,56 @@
|
|||
|
||||
/* PRIVATE FUNCTIONS *********************************************************/
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KdpQueryMemory(IN PDBGKD_MANIPULATE_STATE64 State,
|
||||
IN PCONTEXT Context)
|
||||
{
|
||||
PDBGKD_QUERY_MEMORY Memory = &State->u.QueryMemory;
|
||||
STRING Header;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
/* Validate the address space */
|
||||
if (Memory->AddressSpace == DBGKD_QUERY_MEMORY_VIRTUAL)
|
||||
{
|
||||
/* Check if this is process memory */
|
||||
if ((PVOID)(LONG_PTR)Memory->Address < MmHighestUserAddress)
|
||||
{
|
||||
/* It is */
|
||||
Memory->AddressSpace = DBGKD_QUERY_MEMORY_PROCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: Check if it's session space */
|
||||
Memory->AddressSpace = DBGKD_QUERY_MEMORY_KERNEL;
|
||||
}
|
||||
|
||||
/* Set flags */
|
||||
Memory->Flags = DBGKD_QUERY_MEMORY_READ |
|
||||
DBGKD_QUERY_MEMORY_WRITE |
|
||||
DBGKD_QUERY_MEMORY_EXECUTE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Invalid */
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Return structure */
|
||||
State->ReturnStatus = Status;
|
||||
Memory->Reserved = 0;
|
||||
|
||||
/* Build header */
|
||||
Header.Length = sizeof(DBGKD_MANIPULATE_STATE64);
|
||||
Header.Buffer = (PCHAR)State;
|
||||
|
||||
/* Send the packet */
|
||||
KdSendPacket(PACKET_TYPE_KD_STATE_MANIPULATE,
|
||||
&Header,
|
||||
NULL,
|
||||
&KdpContext);
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KdpWriteBreakpoint(IN PDBGKD_MANIPULATE_STATE64 State,
|
||||
|
@ -22,7 +72,6 @@ KdpWriteBreakpoint(IN PDBGKD_MANIPULATE_STATE64 State,
|
|||
{
|
||||
PDBGKD_WRITE_BREAKPOINT64 Breakpoint = &State->u.WriteBreakPoint;
|
||||
STRING Header;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Build header */
|
||||
Header.Length = sizeof(DBGKD_MANIPULATE_STATE64);
|
||||
|
@ -35,7 +84,12 @@ KdpWriteBreakpoint(IN PDBGKD_MANIPULATE_STATE64 State,
|
|||
if (!Breakpoint->BreakPointHandle)
|
||||
{
|
||||
/* We failed */
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
State->ReturnStatus = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Success! */
|
||||
State->ReturnStatus = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Send the packet */
|
||||
|
@ -816,9 +870,8 @@ SendPacket:
|
|||
|
||||
case DbgKdQueryMemoryApi:
|
||||
|
||||
/* FIXME: TODO */
|
||||
Ke386SetCr2(DbgKdQueryMemoryApi);
|
||||
while (TRUE);
|
||||
/* Query memory */
|
||||
KdpQueryMemory(&ManipulateState, Context);
|
||||
break;
|
||||
|
||||
case DbgKdSwitchPartition:
|
||||
|
|
Loading…
Reference in a new issue