summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
Diffstat (limited to 'kern')
-rw-r--r--kern/syscall_subr.c16
-rw-r--r--kern/syscall_subr.h1
-rw-r--r--kern/syscall_sw.c6
3 files changed, 22 insertions, 1 deletions
diff --git a/kern/syscall_subr.c b/kern/syscall_subr.c
index 395b9b8..ae2d7d7 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 */
diff --git a/kern/syscall_subr.h b/kern/syscall_subr.h
index 2b8bcd3..a2e3920 100644
--- a/kern/syscall_subr.h
+++ b/kern/syscall_subr.h
@@ -36,5 +36,6 @@ extern int swtch_pri(int);
extern int thread_switch(mach_port_t, int, mach_msg_timeout_t);
extern void thread_depress_timeout(thread_t);
extern kern_return_t thread_depress_abort(thread_t);
+extern void mach_print(const char *);
#endif /* _KERN_SYSCALL_SUBR_H_ */
diff --git a/kern/syscall_sw.c b/kern/syscall_sw.c
index b2e20e6..607d843 100644
--- a/kern/syscall_sw.c
+++ b/kern/syscall_sw.c
@@ -122,8 +122,12 @@ mach_trap_t mach_trap_table[] = {
MACH_TRAP(mach_thread_self, 0), /* 27 */
MACH_TRAP(mach_task_self, 0), /* 28 */
MACH_TRAP(mach_host_self, 0), /* 29 */
+#ifdef MACH_KDB
+ MACH_TRAP_STACK(mach_print, 1), /* 30 */
+#else /* MACH_KDB */
+ MACH_TRAP_STACK(kern_invalid, 0), /* 30 */
+#endif /* MACH_KDB */
- MACH_TRAP(kern_invalid, 0), /* 30 */
MACH_TRAP(kern_invalid, 0), /* 31 */
MACH_TRAP(kern_invalid, 0), /* 32 */
MACH_TRAP(kern_invalid, 0), /* 33 emul: task_by_pid */