OSDN Git Service

Enable to track git://github.com/monaka/binutils.git
[pf3gnuchains/pf3gnuchains3x.git] / libgloss / m68k / simulator.S
1 /*
2  * simulator.S -- m68k simulator system calls.
3  *
4  * Copyright (c) 1995, 2001 Cygnus Support
5  *
6  * The authors hereby grant permission to use, copy, modify, distribute,
7  * and license this software and its documentation for any purpose, provided
8  * that existing copyright notices are retained in all copies and that this
9  * notice is included verbatim in any distributions. No written agreement,
10  * license, or royalty fee is required for any of the authorized uses.
11  * Modifications to this software may be copyrighted by their authors
12  * and need not follow the licensing terms described here, provided that
13  * the new terms are clearly indicated on the first page of each file where
14  * they apply.
15  */
16
17 #include "asm.h"
18
19 #define SYSCALL(x) .word 0x4afc, x
20
21 #define FUNC_START(x) .globl x; x:
22 #define FUNC_END(x)
23 #define FUNC_NAME(x) SYM(x)
24
25 FUNC_START(_exit)
26         SYSCALL(1)
27
28 /*
29  * Insure that the debugger tells the client that the PC is in _exit,
30  * not whatever function happens to follow this function.
31  */
32
33 0:      nop
34         jmp     0b                      /* we never should return, but... */
35
36 FUNC_END(_exit)
37
38 FUNC_START(read)
39         SYSCALL(3)
40         bcs     FUNC_NAME(_cerror)
41         rts
42 FUNC_END(read)
43
44 FUNC_START(write)
45         SYSCALL(4)
46         bcs     FUNC_NAME(_cerror)
47         rts
48 FUNC_END(write)
49
50 FUNC_START(open)
51         SYSCALL(5)
52         bcs     FUNC_NAME(_cerror)
53         rts
54 FUNC_END(open)
55
56 FUNC_START(close)
57         SYSCALL(6)
58         bcs     FUNC_NAME(_cerror)
59         rts
60 FUNC_END(close)
61
62 FUNC_START(brk)
63         SYSCALL(17)
64         bcs     FUNC_NAME(_cerror)
65         rts
66 FUNC_END(brk)
67
68 FUNC_START(lseek)
69         SYSCALL(199)
70         bcs     FUNC_NAME(_cerror)
71         rts
72 FUNC_END(lseek)
73
74 FUNC_START(fstat)
75         SYSCALL(28)
76         bcs     FUNC_NAME(_cerror)
77         rts
78 FUNC_END(lseek)
79
80 FUNC_START(isatty)
81         SYSCALL(29)
82         bcs     FUNC_NAME(_cerror)
83         rts
84 FUNC_END(isatty)