2005-05-09 01:38:29 +00:00
|
|
|
/*
|
2005-04-25 14:44:48 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* FILE: ntoskrnl/kd/wrappers/bochs.c
|
|
|
|
* PURPOSE: BOCHS Wrapper for Kd
|
2005-05-09 01:38:29 +00:00
|
|
|
*
|
2005-04-25 14:44:48 +00:00
|
|
|
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <ntoskrnl.h>
|
|
|
|
#define NDEBUG
|
2008-08-30 16:31:06 +00:00
|
|
|
#include <debug.h>
|
2005-04-25 14:44:48 +00:00
|
|
|
|
|
|
|
/* bochs debug output */
|
2008-02-07 20:04:31 +00:00
|
|
|
#define BOCHS_LOGGER_PORT ((PVOID)0xe9)
|
2005-04-25 14:44:48 +00:00
|
|
|
|
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
- More sharing between ntdll/ntoskrnl: shared Dbg code.
- Added NtCreateDebugObject, NtDebugContinue, NtQueryDebugFilterState, NtSetDebugFilterState, NtWaitForDebugEvent to system call list.
- Added some debug constants to headers
- Updated RtlpCheckForActiveDebugger in ntoskrnl to return whatever we're expecting as the "normal" case.
- Added RtlpSetInDbgPrint to rtl support library for special DbgPrint implementation difference in user-mode
- Removed all the deprecated debug APIs in ntdll.
- Implemented NtQueryDebugFilterState and NtSetDebugFilterState based on royce's implementation.
- Started modifications on KeDebugService, and implemented DebugService in rtl
- Implemented all the Dbg* APIs in RTL.
- Implemented DbgUiConnectToDbg, DbgUiContinue, DbgUiWaitStateChange, DbgUiRemoteBreakin, DbgUiIssueRemoteBreakin
- Changed KD Print callbacks to also receive the length of the string.
Right now, one call that should be shared still isn't (the final DebugPrint call) because calling KeDebugService from kernel-mode seems to cause a hang. Also, DebugService does not currently cause an exception like it should (instead it still calls the Kdp handler), because those changes would've made the patch even bigger and are still untested.
svn path=/trunk/; revision=18078
2005-09-26 04:59:48 +00:00
|
|
|
KdpBochsDebugPrint(IN PCH Message,
|
|
|
|
IN ULONG Length)
|
2005-04-25 14:44:48 +00:00
|
|
|
{
|
2006-01-15 08:49:26 +00:00
|
|
|
if (!KdpDebugMode.Bochs) return;
|
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
while (*Message != 0)
|
|
|
|
{
|
|
|
|
if (*Message == '\n')
|
|
|
|
{
|
2008-02-07 20:04:31 +00:00
|
|
|
WRITE_PORT_UCHAR(BOCHS_LOGGER_PORT, '\r');
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
2008-02-07 20:04:31 +00:00
|
|
|
WRITE_PORT_UCHAR(BOCHS_LOGGER_PORT, *Message);
|
2005-04-25 14:44:48 +00:00
|
|
|
Message++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2006-01-15 08:49:26 +00:00
|
|
|
KdpBochsInit(PKD_DISPATCH_TABLE DispatchTable,
|
2005-04-25 14:44:48 +00:00
|
|
|
ULONG BootPhase)
|
|
|
|
{
|
2006-09-07 05:07:34 +00:00
|
|
|
UCHAR Value;
|
2005-04-25 20:35:37 +00:00
|
|
|
if (!KdpDebugMode.Bochs) return;
|
2005-04-25 14:44:48 +00:00
|
|
|
|
|
|
|
if (BootPhase == 0)
|
|
|
|
{
|
2008-02-07 20:04:31 +00:00
|
|
|
Value = READ_PORT_UCHAR(BOCHS_LOGGER_PORT);
|
2010-01-13 22:35:43 +00:00
|
|
|
if (Value != (ULONG_PTR)BOCHS_LOGGER_PORT)
|
2006-01-15 08:49:26 +00:00
|
|
|
{
|
|
|
|
KdpDebugMode.Bochs = FALSE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-04-25 14:44:48 +00:00
|
|
|
/* Write out the functions that we support for now */
|
2006-01-15 08:49:26 +00:00
|
|
|
DispatchTable->KdpInitRoutine = KdpBochsInit;
|
|
|
|
DispatchTable->KdpPrintRoutine = KdpBochsDebugPrint;
|
|
|
|
|
|
|
|
/* Register as a Provider */
|
|
|
|
InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
|
|
|
else if (BootPhase == 2)
|
|
|
|
{
|
2013-10-13 23:04:13 +00:00
|
|
|
HalDisplayString("\r\n Bochs debugging enabled\r\n\r\n");
|
2005-05-09 01:38:29 +00:00
|
|
|
}
|
2005-04-25 14:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|