]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - examples/syscall.S
* Patch by Daniel Engström, 13 Nov 2002:
[karo-tx-uboot.git] / examples / syscall.S
1 #include <ppc_asm.tmpl>
2 #include <ppc_defs.h>
3 #include <syscall.h>
4
5 #ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
6 #warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */
7         .global mon_getc
8         .type   mon_getc,function
9 mon_getc:
10         .global mon_tstc
11         .type   mon_tstc,function
12 mon_tstc:
13         .global mon_putc
14         .type   mon_putc,function
15 mon_putc:
16         .global mon_puts
17         .type   mon_puts,function
18 mon_puts:
19         .global mon_printf
20         .type   mon_printf,function
21 mon_printf:
22         .global mon_install_hdlr
23         .type   mon_install_hdlr,function
24 mon_install_hdlr:
25         .global mon_free_hdlr
26         .type   mon_free_hdlr,function
27 mon_free_hdlr:
28         .global mon_malloc
29         .type   mon_malloc,function
30 mon_malloc:
31         .global mon_free
32         .type   mon_free,function
33 mon_free:
34         @ args = 0, pretend = 0, frame = 0
35         @ frame_needed = 1, current_function_anonymous_args = 0
36         mov     ip, sp
37         stmfd   sp!, {fp, ip, lr, pc}
38         sub     fp, ip, #4
39         ldmea   fp, {fp, sp, pc}
40 #else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
41
42 #ifdef CONFIG_I386 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
43 #define SYMBOL_NAME(X)  X
44 #define SYMBOL_NAME_LABEL(X)    X##:
45         
46 #define SYSCALL(name,n) \
47         .globl SYMBOL_NAME(name) ; \
48 SYMBOL_NAME_LABEL(name)                  ; \
49         ret
50
51 #endif  /* CONFIG_I386 */
52
53 #ifdef CONFIG_PPC
54 #define SYSCALL(name,n) \
55         .globl name             ; \
56 name:                           ; \
57         li r0,n                 ; \
58         sc                      ; \
59         blr
60 #endif  /* CONFIG_PPC */
61
62         .text
63
64         /*
65          * Make sure these functions are in the same order as they
66          * appear in the "include/syscall.h" header file !!!
67          */
68
69         SYSCALL(mon_getc,SYSCALL_GETC)
70         SYSCALL(mon_tstc,SYSCALL_TSTC)
71         SYSCALL(mon_putc,SYSCALL_PUTC)
72         SYSCALL(mon_puts,SYSCALL_PUTS)
73         SYSCALL(mon_printf,SYSCALL_PRINTF)
74         SYSCALL(mon_install_hdlr,SYSCALL_INSTALL_HDLR)
75         SYSCALL(mon_free_hdlr,SYSCALL_FREE_HDLR)
76         SYSCALL(mon_malloc,SYSCALL_MALLOC)
77         SYSCALL(mon_free,SYSCALL_FREE)
78 #endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */