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
25FUNC_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
330:	nop
34	jmp	0b			/* we never should return, but... */
35
36FUNC_END(_exit)
37
38FUNC_START(read)
39	SYSCALL(3)
40	bcs	FUNC_NAME(_cerror)
41	rts
42FUNC_END(read)
43
44FUNC_START(write)
45	SYSCALL(4)
46	bcs	FUNC_NAME(_cerror)
47	rts
48FUNC_END(write)
49
50FUNC_START(open)
51	SYSCALL(5)
52	bcs	FUNC_NAME(_cerror)
53	rts
54FUNC_END(open)
55
56FUNC_START(close)
57	SYSCALL(6)
58	bcs	FUNC_NAME(_cerror)
59	rts
60FUNC_END(close)
61
62FUNC_START(brk)
63	SYSCALL(17)
64	bcs	FUNC_NAME(_cerror)
65	rts
66FUNC_END(brk)
67
68FUNC_START(lseek)
69	SYSCALL(199)
70	bcs	FUNC_NAME(_cerror)
71	rts
72FUNC_END(lseek)
73
74FUNC_START(fstat)
75	SYSCALL(28)
76	bcs	FUNC_NAME(_cerror)
77	rts
78FUNC_END(lseek)
79
80FUNC_START(isatty)
81	SYSCALL(29)
82	bcs	FUNC_NAME(_cerror)
83	rts
84FUNC_END(isatty)
85