https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1c61d4ce903bdc7920d05…
commit 1c61d4ce903bdc7920d055280e78b31e0d436456
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Mon Mar 13 01:09:57 2023 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Tue Jan 28 22:00:33 2025 +0100
[NTOS:KD64] Add annotations to debugger control routines used in
Kd/Nt/ZwSystemDebugControl
---
ntoskrnl/include/internal/kd64.h | 95 ++++++++++++++++++----------------------
ntoskrnl/kd64/amd64/kdx64.c | 92 ++++++++++++++++++++------------------
ntoskrnl/kd64/arm/kdarm.c | 92 ++++++++++++++++++++------------------
ntoskrnl/kd64/i386/kdx86.c | 92 ++++++++++++++++++++------------------
ntoskrnl/kd64/kdapi.c | 3 +-
5 files changed, 195 insertions(+), 179 deletions(-)
diff --git a/ntoskrnl/include/internal/kd64.h b/ntoskrnl/include/internal/kd64.h
index d9a68589f44..060832423ba 100644
--- a/ntoskrnl/include/internal/kd64.h
+++ b/ntoskrnl/include/internal/kd64.h
@@ -375,8 +375,7 @@ KdpZeroMemory(
VOID
NTAPI
KdpSysGetVersion(
- IN PDBGKD_GET_VERSION64 Version
-);
+ _Out_ PDBGKD_GET_VERSION64 Version);
//
// Context
@@ -401,16 +400,14 @@ KdpSetContextState(
NTSTATUS
NTAPI
KdpSysReadMsr(
- IN ULONG Msr,
- OUT PLARGE_INTEGER MsrValue
-);
+ _In_ ULONG Msr,
+ _Out_ PLARGE_INTEGER MsrValue);
NTSTATUS
NTAPI
KdpSysWriteMsr(
- IN ULONG Msr,
- IN PLARGE_INTEGER MsrValue
-);
+ _In_ ULONG Msr,
+ _In_ PLARGE_INTEGER MsrValue);
//
// Bus
@@ -418,26 +415,24 @@ KdpSysWriteMsr(
NTSTATUS
NTAPI
KdpSysReadBusData(
- IN ULONG BusDataType,
- IN ULONG BusNumber,
- IN ULONG SlotNumber,
- IN ULONG Offset,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength
-);
+ _In_ BUS_DATA_TYPE BusDataType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG SlotNumber,
+ _In_ ULONG Offset,
+ _Out_writes_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength);
NTSTATUS
NTAPI
KdpSysWriteBusData(
- IN ULONG BusDataType,
- IN ULONG BusNumber,
- IN ULONG SlotNumber,
- IN ULONG Offset,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength
-);
+ _In_ BUS_DATA_TYPE BusDataType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG SlotNumber,
+ _In_ ULONG Offset,
+ _In_reads_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength);
//
// Control Space
@@ -445,22 +440,20 @@ KdpSysWriteBusData(
NTSTATUS
NTAPI
KdpSysReadControlSpace(
- IN ULONG Processor,
- IN ULONG64 BaseAddress,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength
-);
+ _In_ ULONG Processor,
+ _In_ ULONG64 BaseAddress,
+ _Out_writes_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength);
NTSTATUS
NTAPI
KdpSysWriteControlSpace(
- IN ULONG Processor,
- IN ULONG64 BaseAddress,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength
-);
+ _In_ ULONG Processor,
+ _In_ ULONG64 BaseAddress,
+ _In_reads_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength);
//
// I/O Space
@@ -468,26 +461,24 @@ KdpSysWriteControlSpace(
NTSTATUS
NTAPI
KdpSysReadIoSpace(
- IN ULONG InterfaceType,
- IN ULONG BusNumber,
- IN ULONG AddressSpace,
- IN ULONG64 IoAddress,
- IN PVOID DataValue,
- IN ULONG DataSize,
- OUT PULONG ActualDataSize
-);
+ _In_ INTERFACE_TYPE InterfaceType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG AddressSpace,
+ _In_ ULONG64 IoAddress,
+ _Out_writes_bytes_(DataSize) PVOID DataValue,
+ _In_ ULONG DataSize,
+ _Out_ PULONG ActualDataSize);
NTSTATUS
NTAPI
KdpSysWriteIoSpace(
- IN ULONG InterfaceType,
- IN ULONG BusNumber,
- IN ULONG AddressSpace,
- IN ULONG64 IoAddress,
- IN PVOID DataValue,
- IN ULONG DataSize,
- OUT PULONG ActualDataSize
-);
+ _In_ INTERFACE_TYPE InterfaceType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG AddressSpace,
+ _In_ ULONG64 IoAddress,
+ _In_reads_bytes_(DataSize) PVOID DataValue,
+ _In_ ULONG DataSize,
+ _Out_ PULONG ActualDataSize);
//
// Low Memory
diff --git a/ntoskrnl/kd64/amd64/kdx64.c b/ntoskrnl/kd64/amd64/kdx64.c
index 5c6871d3a9e..b403bfa5918 100644
--- a/ntoskrnl/kd64/amd64/kdx64.c
+++ b/ntoskrnl/kd64/amd64/kdx64.c
@@ -93,8 +93,9 @@ KdpSetContextState(IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange,
NTSTATUS
NTAPI
-KdpSysReadMsr(IN ULONG Msr,
- OUT PLARGE_INTEGER MsrValue)
+KdpSysReadMsr(
+ _In_ ULONG Msr,
+ _Out_ PLARGE_INTEGER MsrValue)
{
/* Use SEH to protect from invalid MSRs */
_SEH2_TRY
@@ -112,8 +113,9 @@ KdpSysReadMsr(IN ULONG Msr,
NTSTATUS
NTAPI
-KdpSysWriteMsr(IN ULONG Msr,
- IN PLARGE_INTEGER MsrValue)
+KdpSysWriteMsr(
+ _In_ ULONG Msr,
+ _In_ PLARGE_INTEGER MsrValue)
{
/* Use SEH to protect from invalid MSRs */
_SEH2_TRY
@@ -131,13 +133,14 @@ KdpSysWriteMsr(IN ULONG Msr,
NTSTATUS
NTAPI
-KdpSysReadBusData(IN ULONG BusDataType,
- IN ULONG BusNumber,
- IN ULONG SlotNumber,
- IN ULONG Offset,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength)
+KdpSysReadBusData(
+ _In_ BUS_DATA_TYPE BusDataType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG SlotNumber,
+ _In_ ULONG Offset,
+ _Out_writes_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
@@ -145,13 +148,14 @@ KdpSysReadBusData(IN ULONG BusDataType,
NTSTATUS
NTAPI
-KdpSysWriteBusData(IN ULONG BusDataType,
- IN ULONG BusNumber,
- IN ULONG SlotNumber,
- IN ULONG Offset,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength)
+KdpSysWriteBusData(
+ _In_ BUS_DATA_TYPE BusDataType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG SlotNumber,
+ _In_ ULONG Offset,
+ _In_reads_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
@@ -159,11 +163,12 @@ KdpSysWriteBusData(IN ULONG BusDataType,
NTSTATUS
NTAPI
-KdpSysReadControlSpace(IN ULONG Processor,
- IN ULONG64 BaseAddress,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength)
+KdpSysReadControlSpace(
+ _In_ ULONG Processor,
+ _In_ ULONG64 BaseAddress,
+ _Out_writes_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength)
{
PVOID ControlStart;
PKPRCB Prcb = KiProcessorBlock[Processor];
@@ -210,11 +215,12 @@ KdpSysReadControlSpace(IN ULONG Processor,
NTSTATUS
NTAPI
-KdpSysWriteControlSpace(IN ULONG Processor,
- IN ULONG64 BaseAddress,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength)
+KdpSysWriteControlSpace(
+ _In_ ULONG Processor,
+ _In_ ULONG64 BaseAddress,
+ _In_reads_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength)
{
PVOID ControlStart;
PKPRCB Prcb = KiProcessorBlock[Processor];
@@ -241,13 +247,14 @@ KdpSysWriteControlSpace(IN ULONG Processor,
NTSTATUS
NTAPI
-KdpSysReadIoSpace(IN ULONG InterfaceType,
- IN ULONG BusNumber,
- IN ULONG AddressSpace,
- IN ULONG64 IoAddress,
- OUT PVOID DataValue,
- IN ULONG DataSize,
- OUT PULONG ActualDataSize)
+KdpSysReadIoSpace(
+ _In_ INTERFACE_TYPE InterfaceType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG AddressSpace,
+ _In_ ULONG64 IoAddress,
+ _Out_writes_bytes_(DataSize) PVOID DataValue,
+ _In_ ULONG DataSize,
+ _Out_ PULONG ActualDataSize)
{
/* Verify parameters */
if (InterfaceType != Isa || BusNumber != 0 || AddressSpace != 1)
@@ -297,13 +304,14 @@ KdpSysReadIoSpace(IN ULONG InterfaceType,
NTSTATUS
NTAPI
-KdpSysWriteIoSpace(IN ULONG InterfaceType,
- IN ULONG BusNumber,
- IN ULONG AddressSpace,
- IN ULONG64 IoAddress,
- IN PVOID DataValue,
- IN ULONG DataSize,
- OUT PULONG ActualDataSize)
+KdpSysWriteIoSpace(
+ _In_ INTERFACE_TYPE InterfaceType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG AddressSpace,
+ _In_ ULONG64 IoAddress,
+ _In_reads_bytes_(DataSize) PVOID DataValue,
+ _In_ ULONG DataSize,
+ _Out_ PULONG ActualDataSize)
{
/* Verify parameters */
if (InterfaceType != Isa || BusNumber != 0 || AddressSpace != 1)
diff --git a/ntoskrnl/kd64/arm/kdarm.c b/ntoskrnl/kd64/arm/kdarm.c
index a62956d1065..e322726c548 100644
--- a/ntoskrnl/kd64/arm/kdarm.c
+++ b/ntoskrnl/kd64/arm/kdarm.c
@@ -35,8 +35,9 @@ KdpSetContextState(IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange,
NTSTATUS
NTAPI
-KdpSysReadMsr(IN ULONG Msr,
- OUT PLARGE_INTEGER MsrValue)
+KdpSysReadMsr(
+ _In_ ULONG Msr,
+ _Out_ PLARGE_INTEGER MsrValue)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
@@ -44,8 +45,9 @@ KdpSysReadMsr(IN ULONG Msr,
NTSTATUS
NTAPI
-KdpSysWriteMsr(IN ULONG Msr,
- IN PLARGE_INTEGER MsrValue)
+KdpSysWriteMsr(
+ _In_ ULONG Msr,
+ _In_ PLARGE_INTEGER MsrValue)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
@@ -53,13 +55,14 @@ KdpSysWriteMsr(IN ULONG Msr,
NTSTATUS
NTAPI
-KdpSysReadBusData(IN ULONG BusDataType,
- IN ULONG BusNumber,
- IN ULONG SlotNumber,
- IN ULONG Offset,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength)
+KdpSysReadBusData(
+ _In_ BUS_DATA_TYPE BusDataType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG SlotNumber,
+ _In_ ULONG Offset,
+ _Out_writes_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
@@ -67,13 +70,14 @@ KdpSysReadBusData(IN ULONG BusDataType,
NTSTATUS
NTAPI
-KdpSysWriteBusData(IN ULONG BusDataType,
- IN ULONG BusNumber,
- IN ULONG SlotNumber,
- IN ULONG Offset,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength)
+KdpSysWriteBusData(
+ _In_ BUS_DATA_TYPE BusDataType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG SlotNumber,
+ _In_ ULONG Offset,
+ _In_reads_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
@@ -81,11 +85,12 @@ KdpSysWriteBusData(IN ULONG BusDataType,
NTSTATUS
NTAPI
-KdpSysReadControlSpace(IN ULONG Processor,
- IN ULONG64 BaseAddress,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength)
+KdpSysReadControlSpace(
+ _In_ ULONG Processor,
+ _In_ ULONG64 BaseAddress,
+ _Out_writes_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
@@ -93,11 +98,12 @@ KdpSysReadControlSpace(IN ULONG Processor,
NTSTATUS
NTAPI
-KdpSysWriteControlSpace(IN ULONG Processor,
- IN ULONG64 BaseAddress,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength)
+KdpSysWriteControlSpace(
+ _In_ ULONG Processor,
+ _In_ ULONG64 BaseAddress,
+ _In_reads_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
@@ -105,13 +111,14 @@ KdpSysWriteControlSpace(IN ULONG Processor,
NTSTATUS
NTAPI
-KdpSysReadIoSpace(IN ULONG InterfaceType,
- IN ULONG BusNumber,
- IN ULONG AddressSpace,
- IN ULONG64 IoAddress,
- IN PVOID DataValue,
- IN ULONG DataSize,
- OUT PULONG ActualDataSize)
+KdpSysReadIoSpace(
+ _In_ INTERFACE_TYPE InterfaceType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG AddressSpace,
+ _In_ ULONG64 IoAddress,
+ _Out_writes_bytes_(DataSize) PVOID DataValue,
+ _In_ ULONG DataSize,
+ _Out_ PULONG ActualDataSize)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
@@ -119,13 +126,14 @@ KdpSysReadIoSpace(IN ULONG InterfaceType,
NTSTATUS
NTAPI
-KdpSysWriteIoSpace(IN ULONG InterfaceType,
- IN ULONG BusNumber,
- IN ULONG AddressSpace,
- IN ULONG64 IoAddress,
- IN PVOID DataValue,
- IN ULONG DataSize,
- OUT PULONG ActualDataSize)
+KdpSysWriteIoSpace(
+ _In_ INTERFACE_TYPE InterfaceType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG AddressSpace,
+ _In_ ULONG64 IoAddress,
+ _In_reads_bytes_(DataSize) PVOID DataValue,
+ _In_ ULONG DataSize,
+ _Out_ PULONG ActualDataSize)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
diff --git a/ntoskrnl/kd64/i386/kdx86.c b/ntoskrnl/kd64/i386/kdx86.c
index 843f6e88b0d..64736cc8ef6 100644
--- a/ntoskrnl/kd64/i386/kdx86.c
+++ b/ntoskrnl/kd64/i386/kdx86.c
@@ -91,8 +91,9 @@ KdpSetContextState(IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange,
NTSTATUS
NTAPI
-KdpSysReadMsr(IN ULONG Msr,
- OUT PLARGE_INTEGER MsrValue)
+KdpSysReadMsr(
+ _In_ ULONG Msr,
+ _Out_ PLARGE_INTEGER MsrValue)
{
/* Wrap this in SEH in case the MSR doesn't exist */
_SEH2_TRY
@@ -113,8 +114,9 @@ KdpSysReadMsr(IN ULONG Msr,
NTSTATUS
NTAPI
-KdpSysWriteMsr(IN ULONG Msr,
- IN PLARGE_INTEGER MsrValue)
+KdpSysWriteMsr(
+ _In_ ULONG Msr,
+ _In_ PLARGE_INTEGER MsrValue)
{
/* Wrap this in SEH in case the MSR doesn't exist */
_SEH2_TRY
@@ -135,13 +137,14 @@ KdpSysWriteMsr(IN ULONG Msr,
NTSTATUS
NTAPI
-KdpSysReadBusData(IN ULONG BusDataType,
- IN ULONG BusNumber,
- IN ULONG SlotNumber,
- IN ULONG Offset,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength)
+KdpSysReadBusData(
+ _In_ BUS_DATA_TYPE BusDataType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG SlotNumber,
+ _In_ ULONG Offset,
+ _Out_writes_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength)
{
/* Just forward to HAL */
*ActualLength = HalGetBusDataByOffset(BusDataType,
@@ -157,13 +160,14 @@ KdpSysReadBusData(IN ULONG BusDataType,
NTSTATUS
NTAPI
-KdpSysWriteBusData(IN ULONG BusDataType,
- IN ULONG BusNumber,
- IN ULONG SlotNumber,
- IN ULONG Offset,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength)
+KdpSysWriteBusData(
+ _In_ BUS_DATA_TYPE BusDataType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG SlotNumber,
+ _In_ ULONG Offset,
+ _In_reads_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength)
{
/* Just forward to HAL */
*ActualLength = HalSetBusDataByOffset(BusDataType,
@@ -179,11 +183,12 @@ KdpSysWriteBusData(IN ULONG BusDataType,
NTSTATUS
NTAPI
-KdpSysReadControlSpace(IN ULONG Processor,
- IN ULONG64 BaseAddress,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength)
+KdpSysReadControlSpace(
+ _In_ ULONG Processor,
+ _In_ ULONG64 BaseAddress,
+ _Out_writes_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength)
{
PVOID ControlStart;
ULONG RealLength;
@@ -219,11 +224,12 @@ KdpSysReadControlSpace(IN ULONG Processor,
NTSTATUS
NTAPI
-KdpSysWriteControlSpace(IN ULONG Processor,
- IN ULONG64 BaseAddress,
- IN PVOID Buffer,
- IN ULONG Length,
- OUT PULONG ActualLength)
+KdpSysWriteControlSpace(
+ _In_ ULONG Processor,
+ _In_ ULONG64 BaseAddress,
+ _In_reads_bytes_(Length) PVOID Buffer,
+ _In_ ULONG Length,
+ _Out_ PULONG ActualLength)
{
PVOID ControlStart;
@@ -254,13 +260,14 @@ KdpSysWriteControlSpace(IN ULONG Processor,
NTSTATUS
NTAPI
-KdpSysReadIoSpace(IN ULONG InterfaceType,
- IN ULONG BusNumber,
- IN ULONG AddressSpace,
- IN ULONG64 IoAddress,
- IN PVOID DataValue,
- IN ULONG DataSize,
- OUT PULONG ActualDataSize)
+KdpSysReadIoSpace(
+ _In_ INTERFACE_TYPE InterfaceType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG AddressSpace,
+ _In_ ULONG64 IoAddress,
+ _Out_writes_bytes_(DataSize) PVOID DataValue,
+ _In_ ULONG DataSize,
+ _Out_ PULONG ActualDataSize)
{
NTSTATUS Status;
@@ -335,13 +342,14 @@ KdpSysReadIoSpace(IN ULONG InterfaceType,
NTSTATUS
NTAPI
-KdpSysWriteIoSpace(IN ULONG InterfaceType,
- IN ULONG BusNumber,
- IN ULONG AddressSpace,
- IN ULONG64 IoAddress,
- IN PVOID DataValue,
- IN ULONG DataSize,
- OUT PULONG ActualDataSize)
+KdpSysWriteIoSpace(
+ _In_ INTERFACE_TYPE InterfaceType,
+ _In_ ULONG BusNumber,
+ _In_ ULONG AddressSpace,
+ _In_ ULONG64 IoAddress,
+ _In_reads_bytes_(DataSize) PVOID DataValue,
+ _In_ ULONG DataSize,
+ _Out_ PULONG ActualDataSize)
{
NTSTATUS Status;
diff --git a/ntoskrnl/kd64/kdapi.c b/ntoskrnl/kd64/kdapi.c
index 4baeb4d9c42..bd27655346b 100644
--- a/ntoskrnl/kd64/kdapi.c
+++ b/ntoskrnl/kd64/kdapi.c
@@ -430,7 +430,8 @@ KdpSetCommonState(IN ULONG NewState,
VOID
NTAPI
-KdpSysGetVersion(IN PDBGKD_GET_VERSION64 Version)
+KdpSysGetVersion(
+ _Out_ PDBGKD_GET_VERSION64 Version)
{
/* Copy the version block */
KdpMoveMemory(Version,