]> git.ipfire.org Git - people/ms/u-boot.git/blame - examples/syscall.S
* Patch by Richard Woodruff, 19 June 03:
[people/ms/u-boot.git] / examples / syscall.S
CommitLineData
d3163d3f
WD
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
9mon_getc:
10 .global mon_tstc
11 .type mon_tstc,function
12mon_tstc:
13 .global mon_putc
14 .type mon_putc,function
15mon_putc:
16 .global mon_puts
17 .type mon_puts,function
18mon_puts:
19 .global mon_printf
20 .type mon_printf,function
21mon_printf:
22 .global mon_install_hdlr
23 .type mon_install_hdlr,function
24mon_install_hdlr:
25 .global mon_free_hdlr
26 .type mon_free_hdlr,function
27mon_free_hdlr:
28 .global mon_malloc
29 .type mon_malloc,function
30mon_malloc:
31 .global mon_free
32 .type mon_free,function
33mon_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}
6069ff26
WD
40#elif defined(CONFIG_MIPS)/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
41#warning MIPS version not implemented yet
42 .global mon_getc
43 .type mon_getc,function
44mon_getc:
45 .global mon_tstc
46 .type mon_tstc,function
47mon_tstc:
48 .global mon_putc
49 .type mon_putc,function
50mon_putc:
51 .global mon_puts
52 .type mon_puts,function
53mon_puts:
54 .global mon_printf
55 .type mon_printf,function
56mon_printf:
57 .global mon_install_hdlr
58 .type mon_install_hdlr,function
59mon_install_hdlr:
60 .global mon_free_hdlr
61 .type mon_free_hdlr,function
62mon_free_hdlr:
63 .global mon_malloc
64 .type mon_malloc,function
65mon_malloc:
66 .global mon_free
67 .type mon_free,function
68mon_free:
69
70#else
2262cfee
WD
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) ; \
78SYMBOL_NAME_LABEL(name) ; \
7a8e9bed
WD
79 movl $n, %eax ;\
80 pushl %ebx; \
81 pushl %ecx; \
82 int $0x40 ;\
83
2262cfee
WD
84
85#endif /* CONFIG_I386 */
86
87#ifdef CONFIG_PPC
d3163d3f
WD
88#define SYSCALL(name,n) \
89 .globl name ; \
90name: ; \
91 li r0,n ; \
92 sc ; \
93 blr
2262cfee 94#endif /* CONFIG_PPC */
d3163d3f
WD
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)
c7de829c
WD
112 SYSCALL(mon_udelay,SYSCALL_UDELAY)
113 SYSCALL(mon_get_timer,SYSCALL_GET_TIMER)
d3163d3f 114#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */