Add proper support for DbgPrint(): only print messages if bootverbose
is set, since some drivers with debug info can be very chatty. Also implement DbgBreakPoint(), which is the Windows equivalent of Debugger(). Unfortunately, this forces subr_ntoskrnl.c to include opt_ddb.h.
This commit is contained in:
parent
de3fcf6777
commit
753cd4eacb
@ -64,6 +64,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <compat/ndis/ntoskrnl_var.h>
|
||||
#include <compat/ndis/ndis_var.h>
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
#define __regparm __attribute__((regparm(3)))
|
||||
|
||||
#define FUNC void(*)(void)
|
||||
@ -166,6 +168,8 @@ __stdcall static ndis_status ntoskrnl_objref(ndis_handle, uint32_t, void *,
|
||||
uint8_t, void **, void **);
|
||||
__stdcall static void ntoskrnl_objderef(/*void * */ void);
|
||||
__stdcall static uint32_t ntoskrnl_zwclose(ndis_handle);
|
||||
static uint32_t ntoskrnl_dbgprint(char *, ...);
|
||||
__stdcall static void ntoskrnl_debugger(void);
|
||||
__stdcall static void dummy(void);
|
||||
|
||||
static struct mtx *ntoskrnl_interlock;
|
||||
@ -1604,6 +1608,30 @@ ntoskrnl_thread_exit(status)
|
||||
return(0); /* notreached */
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
ntoskrnl_dbgprint(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
if (bootverbose) {
|
||||
va_start(ap, fmt);
|
||||
vprintf(fmt, ap);
|
||||
}
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
__stdcall static void
|
||||
ntoskrnl_debugger(void)
|
||||
{
|
||||
#ifdef DDB
|
||||
Debugger("debug from winkernel module");
|
||||
#else
|
||||
printf("ntoskrnl_debugger(): DDB not present\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
__stdcall static void
|
||||
dummy()
|
||||
{
|
||||
@ -1625,7 +1653,8 @@ image_patch_table ntoskrnl_functbl[] = {
|
||||
{ "RtlUnicodeStringToInteger", (FUNC)ntoskrnl_unicode_to_int },
|
||||
{ "sprintf", (FUNC)sprintf },
|
||||
{ "vsprintf", (FUNC)vsprintf },
|
||||
{ "DbgPrint", (FUNC)printf },
|
||||
{ "DbgPrint", (FUNC)ntoskrnl_dbgprint },
|
||||
{ "DbgBreakPoint", (FUNC)ntoskrnl_debugger },
|
||||
{ "strncmp", (FUNC)strncmp },
|
||||
{ "strcmp", (FUNC)strcmp },
|
||||
{ "strncpy", (FUNC)strncpy },
|
||||
|
@ -5,5 +5,6 @@
|
||||
KMOD= ndis
|
||||
SRCS= subr_pe.c subr_ndis.c subr_hal.c subr_ntoskrnl.c kern_ndis.c
|
||||
SRCS+= opt_bdg.h device_if.h bus_if.h pci_if.h card_if.h vnode_if.h
|
||||
SRCS+= opt_ddb.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
Loading…
Reference in New Issue
Block a user