From 338d9ca7981f25099d99d280b0dd3af590d65763 Mon Sep 17 00:00:00 2001
From: Richard Braun <rbraun@sceen.net>
Date: Tue, 22 Jan 2013 22:32:14 +0100
Subject: Add the mach_print debugging system call

The purpose of this system call is to help debugging in situations where
it's desirable to bypass the mach_msg call entirely.

* include/mach/syscall_sw.h (mach_print): Generate system call code.
* kern/syscall_subr.c: Include <kern/printf.h>.
[MACH_KDB] (mach_print): New function.
* kern/syscall_subr.h (mach_print): New prototype.
* kern/syscall_sw.c [MACH_KDB] (mach_trap_table): Declare mach_print
system call.
---
 kern/syscall_subr.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

(limited to 'kern/syscall_subr.c')

diff --git a/kern/syscall_subr.c b/kern/syscall_subr.c
index 395b9b8f..ae2d7d73 100644
--- a/kern/syscall_subr.c
+++ b/kern/syscall_subr.c
@@ -34,6 +34,7 @@
 #include <kern/counters.h>
 #include <kern/ipc_kobject.h>
 #include <kern/mach_clock.h>
+#include <kern/printf.h>
 #include <kern/processor.h>
 #include <kern/sched.h>
 #include <kern/sched_prim.h>
@@ -380,3 +381,18 @@ register thread_t	thread;
     (void) splx(s);
     return(KERN_SUCCESS);
 }
+
+/*
+ *	mach_print
+ *
+ *	Display a null-terminated character string on the Mach console.
+ *	This system call is meant as a debugging tool useful to circumvent
+ *	messaging altogether.
+ */
+#ifdef MACH_KDB
+void
+mach_print(const char *s)
+{
+	printf("%s", s);
+}
+#endif /* MACH_KDB */
-- 
cgit v1.2.3