aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorwdenk <wdenk>2002-09-07 20:53:01 +0000
committerwdenk <wdenk>2002-09-07 20:53:01 +0000
commitd3163d3faa2f46ab89e3a52cdd9fed55e1f646af (patch)
treea40c53a58557a870bffc0e45597c2f52fb1d17ab /examples
parent2f001a3c4ce20aa15b3d95920560815f2b637e15 (diff)
Initial revision
Diffstat (limited to 'examples')
-rw-r--r--examples/syscall.S64
1 files changed, 64 insertions, 0 deletions
diff --git a/examples/syscall.S b/examples/syscall.S
new file mode 100644
index 000000000..9e8725edc
--- /dev/null
+++ b/examples/syscall.S
@@ -0,0 +1,64 @@
+#include <ppc_asm.tmpl>
+#include <ppc_defs.h>
+#include <syscall.h>
+
+#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
+#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */
+ .global mon_getc
+ .type mon_getc,function
+mon_getc:
+ .global mon_tstc
+ .type mon_tstc,function
+mon_tstc:
+ .global mon_putc
+ .type mon_putc,function
+mon_putc:
+ .global mon_puts
+ .type mon_puts,function
+mon_puts:
+ .global mon_printf
+ .type mon_printf,function
+mon_printf:
+ .global mon_install_hdlr
+ .type mon_install_hdlr,function
+mon_install_hdlr:
+ .global mon_free_hdlr
+ .type mon_free_hdlr,function
+mon_free_hdlr:
+ .global mon_malloc
+ .type mon_malloc,function
+mon_malloc:
+ .global mon_free
+ .type mon_free,function
+mon_free:
+ @ args = 0, pretend = 0, frame = 0
+ @ frame_needed = 1, current_function_anonymous_args = 0
+ mov ip, sp
+ stmfd sp!, {fp, ip, lr, pc}
+ sub fp, ip, #4
+ ldmea fp, {fp, sp, pc}
+#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
+#define SYSCALL(name,n) \
+ .globl name ; \
+name: ; \
+ li r0,n ; \
+ sc ; \
+ blr
+
+ .text
+
+ /*
+ * Make sure these functions are in the same order as they
+ * appear in the "include/syscall.h" header file !!!
+ */
+
+ SYSCALL(mon_getc,SYSCALL_GETC)
+ SYSCALL(mon_tstc,SYSCALL_TSTC)
+ SYSCALL(mon_putc,SYSCALL_PUTC)
+ SYSCALL(mon_puts,SYSCALL_PUTS)
+ SYSCALL(mon_printf,SYSCALL_PRINTF)
+ SYSCALL(mon_install_hdlr,SYSCALL_INSTALL_HDLR)
+ SYSCALL(mon_free_hdlr,SYSCALL_FREE_HDLR)
+ SYSCALL(mon_malloc,SYSCALL_MALLOC)
+ SYSCALL(mon_free,SYSCALL_FREE)
+#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */