Update comments

This commit is contained in:
Satoshi Tanda
2020-03-07 10:47:18 -08:00
parent adf09d85af
commit cd56f77bc0
32 changed files with 276 additions and 229 deletions

View File

@@ -25,7 +25,10 @@ Index = 0
; Index is incremented whenever this macro is used.
;
INTERRUPT_HANDLER macro InterruptNumber
push 0 ; Push dummy error code for consistent stack layout.
;
; Push dummy error code for consistent stack layout.
;
push 0
push InterruptNumber
jmp AsmCommonExceptionHandler
Index = Index + 1
@@ -38,7 +41,10 @@ endm
; Index is incremented whenever this macro is used.
;
INTERRUPT_HANDLER_WITH_CODE macro InterruptNumber
nop ; Error code is expected to be pushed by the processor.
;
; Error code is expected to be pushed by the processor.
;
nop
nop
push InterruptNumber
jmp AsmCommonExceptionHandler
@@ -53,26 +59,44 @@ endm
; works as a hendler of the corresponding interrupt/exception in the host.
;
AsmDefaultExceptionHandlers proc
repeat 8
INTERRUPT_HANDLER Index ; INT0-7
endm
;
; INT0-7
;
repeat 8
INTERRUPT_HANDLER Index
endm
INTERRUPT_HANDLER_WITH_CODE Index ; INT8
INTERRUPT_HANDLER Index ; INT9
;
; INT8, INT9
;
INTERRUPT_HANDLER_WITH_CODE Index
INTERRUPT_HANDLER Index
repeat 5
INTERRUPT_HANDLER_WITH_CODE Index ; INT10-14
endm
;
; INT10-14
;
repeat 5
INTERRUPT_HANDLER_WITH_CODE Index
endm
repeat 2
INTERRUPT_HANDLER Index ; INT15-16
endm
;
; INT15-16
;
repeat 2
INTERRUPT_HANDLER Index
endm
INTERRUPT_HANDLER_WITH_CODE Index ; INT17
;
; INT17
;
INTERRUPT_HANDLER_WITH_CODE Index
repeat 238
INTERRUPT_HANDLER Index ; INT18-255
endm
;
; INT18-255
;
repeat 238
INTERRUPT_HANDLER Index
endm
AsmDefaultExceptionHandlers endp
;
@@ -88,7 +112,11 @@ AsmCommonExceptionHandler proc
call HandleHostException
add rsp, 20h
POPAQ
add rsp, 10h ; Remove the error code and interrupt number.
;
; Remove the error code and interrupt number.
;
add rsp, 10h
iretq
AsmCommonExceptionHandler endp

View File

@@ -15,7 +15,6 @@
*/
VOID
AsmDefaultExceptionHandlers (
VOID
);
/*!
@@ -23,5 +22,4 @@ AsmDefaultExceptionHandlers (
*/
VOID
AsmNmiExceptionHandler (
VOID
);

View File

@@ -8,9 +8,9 @@
reused once they are set, even after they are "cleared".
For complete implementation, one can copy ReactOS's implementation if
licensing the project under GPL is acceptable. hvpp by wbenny has its own
implementation of bitmap but is actually influenced by ReactOS
implementation and such should be treated as GPL.
licensing the project under GPL is acceptable. hvpp by Petr Beneš has its
own implementation of bitmap but is actually influenced by ReactOS
implementation, and such, should be treated as GPL.
@author Satoshi Tanda

View File

@@ -34,21 +34,21 @@
fault (null pointer access) when it fires in the host code. The author
has not been able to find out the root cause and a fix.
*/
#if !defined(MDEPKG_NDEBUG)
#if defined(MDEPKG_NDEBUG)
#define MV_ASSERT(x)
#else
#define MV_ASSERT(x) \
if (!(x)) \
{ \
LOG_ERROR("ASSERT %a(%d): %a", __FILE__, __LINE__, #x); \
MV_PANIC(); \
} (VOID*)NULL
#else
#define MV_ASSERT(x)
#endif
#if !defined(MDEPKG_NDEBUG)
#define MV_VERIFY(x) MV_ASSERT(x)
#else
#if defined(MDEPKG_NDEBUG)
#define MV_VERIFY(x) (x)
#else
#define MV_VERIFY(x) MV_ASSERT(x)
#endif
#define MV_MAX(x, y) MAX((x), (y))

View File

@@ -10,7 +10,7 @@
.code
;
; @brief Read the value from LDTR.
; @brief Reads the value of LDTR.
;
; @return The value of LDTR.
;
@@ -20,7 +20,7 @@ AsmReadLdtr proc
AsmReadLdtr endp
;
; @brief Read the value from TR.
; @brief Reads the value of TR.
;
; @return The value of TR.
;
@@ -30,7 +30,7 @@ AsmReadTr proc
AsmReadTr endp
;
; @brief Read the value from ES.
; @brief Reads the value of ES.
;
; @return The value of ES.
;
@@ -40,7 +40,7 @@ AsmReadEs proc
AsmReadEs endp
;
; @brief Read the value from CS.
; @brief Reads the value of CS.
;
; @return The value of CS.
;
@@ -50,7 +50,7 @@ AsmReadCs proc
AsmReadCs endp
;
; @brief Read the value from SS.
; @brief Reads the value of SS.
;
; @return The value of SS.
;
@@ -60,7 +60,7 @@ AsmReadSs proc
AsmReadSs endp
;
; @brief Read the value from DS.
; @brief Reads the value of DS.
;
; @return The value of DS.
;
@@ -70,7 +70,7 @@ AsmReadDs proc
AsmReadDs endp
;
; @brief Read the value from FS.
; @brief Reads the value of FS.
;
; @return The value of FS.
;
@@ -80,7 +80,7 @@ AsmReadFs proc
AsmReadFs endp
;
; @brief Read the value from GS.
; @brief Reads the value of GS.
;
; @return The value of GS.
;
@@ -90,7 +90,7 @@ AsmReadGs proc
AsmReadGs endp
;
; @brief Write the value to TR.
; @brief Writes the value to TR.
;
; @param[in] RCX - The new TR value to write.
;

View File

@@ -17,7 +17,6 @@
*/
UINT16
AsmReadLdtr (
VOID
);
/*!
@@ -27,7 +26,6 @@ AsmReadLdtr (
*/
UINT16
AsmReadTr (
VOID
);
/*!
@@ -37,7 +35,6 @@ AsmReadTr (
*/
UINT16
AsmReadEs (
VOID
);
/*!
@@ -47,7 +44,6 @@ AsmReadEs (
*/
UINT16
AsmReadCs (
VOID
);
/*!
@@ -57,7 +53,6 @@ AsmReadCs (
*/
UINT16
AsmReadSs (
VOID
);
/*!
@@ -67,7 +62,6 @@ AsmReadSs (
*/
UINT16
AsmReadDs (
VOID
);
/*!
@@ -77,7 +71,6 @@ AsmReadDs (
*/
UINT16
AsmReadFs (
VOID
);
/*!
@@ -87,7 +80,6 @@ AsmReadFs (
*/
UINT16
AsmReadGs (
VOID
);
/*!

View File

@@ -457,7 +457,7 @@ LogFlushThread (
LOGGER_CONTEXT* logger;
LARGE_INTEGER interval;
PAGED_CODE()
PAGED_CODE();
logger = (LOGGER_CONTEXT*)StartContext;
interval.QuadPart = -(10000ll * logger->FlushIntervalInMs);
@@ -562,13 +562,6 @@ CleanupPairedLogBuffer (
ExFreePoolWithTag(PairedLogBuffer->InactiveLogBuffer->LogEntries, LOGGER_POOL_TAG);
}
/*!
@brief Initializes the global logger.
@param[in] Configuration - The configuration for initialization.
@return STATUS_SUCCESS on success; otherwise, an appropriate error code.
*/
LOGGER_INIT
_Use_decl_annotations_
NTSTATUS
@@ -581,7 +574,7 @@ InitializeLogger (
HANDLE fileHandle;
HANDLE threadHandle;
PAGED_CODE()
PAGED_CODE();
MV_ASSERT(g_Logger == NULL);
@@ -615,7 +608,7 @@ InitializeLogger (
&filePath,
OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
NULL,
NULL)
NULL);
status = ZwCreateFile(&fileHandle,
FILE_APPEND_DATA | SYNCHRONIZE,
&objectAttributes,
@@ -709,7 +702,6 @@ InitializeLogger (
//
g_Logger = logger;
Exit:
if (NT_ERROR(status))
{
@@ -729,9 +721,6 @@ Exit:
return status;
}
/*!
@brief Clean up the logger.
*/
LOGGER_PAGED
_Use_decl_annotations_
VOID
@@ -742,7 +731,7 @@ CleanupLogger (
LOGGER_CONTEXT* logger;
SIZE_T maxOverflowedLogSize;
PAGED_CODE()
PAGED_CODE();
MV_ASSERT(g_Logger != NULL);

View File

@@ -69,6 +69,13 @@ typedef struct _LOGGER_CONFIGURATION
PCWSTR FilePath;
} LOGGER_CONFIGURATION;
/*!
@brief Initializes the global logger.
@param[in] Configuration - The configuration for initialization.
@return STATUS_SUCCESS on success; otherwise, an appropriate error code.
*/
_IRQL_requires_max_(PASSIVE_LEVEL)
_Must_inspect_result_
NTSTATUS
@@ -76,6 +83,9 @@ InitializeLogger (
_In_ CONST LOGGER_CONFIGURATION* Configuration
);
/*!
@brief Clean up the logger.
*/
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
CleanupLogger (

View File

@@ -97,7 +97,7 @@ ConvertNtToMvStatus (
@param[in] DriverObject - The driver's driver object.
@param[in] RegistryPath - A path to the driver's registry key.
@param[in] RegistryPath - The path to the driver's registry key.
@return STATUS_SUCCESS on success; otherwise, an appropriate error code.
*/
@@ -148,7 +148,7 @@ DriverUnload (
{
UNREFERENCED_PARAMETER(DriverObject);
PAGED_CODE()
PAGED_CODE();
//
// Start cross-platform clean up.
@@ -165,7 +165,7 @@ InitializePlatform (
NTSTATUS status;
LOGGER_CONFIGURATION loggerConfig;
PAGED_CODE()
PAGED_CODE();
//
// Initialize in-house logger. Enable all flags.
@@ -192,7 +192,7 @@ VOID
CleanupPlatform (
)
{
PAGED_CODE()
PAGED_CODE();
CleanupLogger();
}
@@ -206,7 +206,7 @@ Sleep (
{
LARGE_INTEGER interval;
PAGED_CODE()
PAGED_CODE();
interval.QuadPart = -(LONGLONG)(10000 * Milliseconds);
(VOID)KeDelayExecutionThread(KernelMode, FALSE, &interval);
@@ -296,7 +296,7 @@ ReserveVirtualAddress (
UINT64 PageCount
)
{
PAGED_CODE()
PAGED_CODE();
return MmAllocateMappingAddress(PageCount * PAGE_SIZE, MV_POOL_TAG);
}
@@ -309,7 +309,7 @@ FreeReservedVirtualAddress (
UINT64 PageCount
)
{
PAGED_CODE()
PAGED_CODE();
UNREFERENCED_PARAMETER(PageCount);
@@ -326,7 +326,7 @@ RunOnAllProcessors (
{
UINT32 numberOfProcessors;
PAGED_CODE()
PAGED_CODE();
numberOfProcessors = KeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS);
for (UINT32 index = 0; index < numberOfProcessors; ++index)