summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mach/syscall_sw.h1
-rw-r--r--kern/syscall_subr.c16
-rw-r--r--kern/syscall_subr.h1
-rw-r--r--kern/syscall_sw.c6
4 files changed, 23 insertions, 1 deletions
diff --git a/include/mach/syscall_sw.h b/include/mach/syscall_sw.h
index af14c8d..89597e9 100644
--- a/include/mach/syscall_sw.h
+++ b/include/mach/syscall_sw.h
@@ -52,6 +52,7 @@ kernel_trap(mach_reply_port,-26,0)
kernel_trap(mach_thread_self,-27,0)
kernel_trap(mach_task_self,-28,0)
kernel_trap(mach_host_self,-29,0)
+kernel_trap(mach_print,-30,1)
kernel_trap(swtch_pri,-59,1)
kernel_trap(swtch,-60,0)
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 */