]> git.ipfire.org Git - u-boot.git/blob - examples/syscall.S
* Code cleanup:
[u-boot.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 #elif defined(CONFIG_MIPS)/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
41 #warning MIPS version not implemented yet
42 .global mon_getc
43 .type mon_getc,function
44 mon_getc:
45 .global mon_tstc
46 .type mon_tstc,function
47 mon_tstc:
48 .global mon_putc
49 .type mon_putc,function
50 mon_putc:
51 .global mon_puts
52 .type mon_puts,function
53 mon_puts:
54 .global mon_printf
55 .type mon_printf,function
56 mon_printf:
57 .global mon_install_hdlr
58 .type mon_install_hdlr,function
59 mon_install_hdlr:
60 .global mon_free_hdlr
61 .type mon_free_hdlr,function
62 mon_free_hdlr:
63 .global mon_malloc
64 .type mon_malloc,function
65 mon_malloc:
66 .global mon_free
67 .type mon_free,function
68 mon_free:
69
70 #else
71
72 #ifdef CONFIG_I386 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
73 #define SYMBOL_NAME(X) X
74 #define SYMBOL_NAME_LABEL(X) X##:
75
76 #define SYSCALL(name,n) \
77 .globl SYMBOL_NAME(name) ; \
78 SYMBOL_NAME_LABEL(name) ; \
79 movl $n, %eax ;\
80 pushl %ebx; \
81 pushl %ecx; \
82 int $0x40 ;\
83
84
85 #endif /* CONFIG_I386 */
86
87 #ifdef CONFIG_PPC
88 #define SYSCALL(name,n) \
89 .globl name ; \
90 name: ; \
91 li r0,n ; \
92 sc ; \
93 blr
94 #endif /* CONFIG_PPC */
95
96 .text
97
98 /*
99 * Make sure these functions are in the same order as they
100 * appear in the "include/syscall.h" header file !!!
101 */
102
103 SYSCALL(mon_getc,SYSCALL_GETC)
104 SYSCALL(mon_tstc,SYSCALL_TSTC)
105 SYSCALL(mon_putc,SYSCALL_PUTC)
106 SYSCALL(mon_puts,SYSCALL_PUTS)
107 SYSCALL(mon_printf,SYSCALL_PRINTF)
108 SYSCALL(mon_install_hdlr,SYSCALL_INSTALL_HDLR)
109 SYSCALL(mon_free_hdlr,SYSCALL_FREE_HDLR)
110 SYSCALL(mon_malloc,SYSCALL_MALLOC)
111 SYSCALL(mon_free,SYSCALL_FREE)
112 SYSCALL(mon_udelay,SYSCALL_UDELAY)
113 SYSCALL(mon_get_timer,SYSCALL_GET_TIMER)
114 #endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */