summaryrefslogtreecommitdiff
path: root/microkernel/mach/gnumach/interface/syscall/mach_print
diff options
context:
space:
mode:
Diffstat (limited to 'microkernel/mach/gnumach/interface/syscall/mach_print')
-rw-r--r--microkernel/mach/gnumach/interface/syscall/mach_print/Makefile9
-rw-r--r--microkernel/mach/gnumach/interface/syscall/mach_print/mach_print.S3
-rw-r--r--microkernel/mach/gnumach/interface/syscall/mach_print/main.c21
3 files changed, 33 insertions, 0 deletions
diff --git a/microkernel/mach/gnumach/interface/syscall/mach_print/Makefile b/microkernel/mach/gnumach/interface/syscall/mach_print/Makefile
new file mode 100644
index 00000000..8590ef7f
--- /dev/null
+++ b/microkernel/mach/gnumach/interface/syscall/mach_print/Makefile
@@ -0,0 +1,9 @@
+CFLAGS = -O0 -g3
+
+mach_print: main.o mach_print.o
+ gcc -o mach_print main.o mach_print.o
+
+clean:
+ rm -f mach_print *.o
+
+.PHONY: clean
diff --git a/microkernel/mach/gnumach/interface/syscall/mach_print/mach_print.S b/microkernel/mach/gnumach/interface/syscall/mach_print/mach_print.S
new file mode 100644
index 00000000..606a66e6
--- /dev/null
+++ b/microkernel/mach/gnumach/interface/syscall/mach_print/mach_print.S
@@ -0,0 +1,3 @@
+#include <mach/machine/syscall_sw.h>
+
+kernel_trap(mach_print,-30,1)
diff --git a/microkernel/mach/gnumach/interface/syscall/mach_print/main.c b/microkernel/mach/gnumach/interface/syscall/mach_print/main.c
new file mode 100644
index 00000000..23b9fc88
--- /dev/null
+++ b/microkernel/mach/gnumach/interface/syscall/mach_print/main.c
@@ -0,0 +1,21 @@
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+void mach_print(char *);
+
+int
+main(int argc, char *argv[])
+{
+ int size;
+ char *s;
+
+ size = snprintf(NULL, 0, "%s\n", argv[1]);
+ assert(size > 0);
+ s = malloc(size);
+ assert(s != NULL);
+ sprintf(s, "%s\n", argv[1]);
+ mach_print(s);
+ free(s);
+ return EXIT_SUCCESS;
+}