Add fatal_signal_pending
[linux-2.6/mini2440.git] / include / asm-v850 / simsyscall.h
blob4a19d5ae9d172dd34b5205331d82c68b7bb70268
1 /*
2 * include/asm-v850/simsyscall.h -- `System calls' under the v850e emulator
4 * Copyright (C) 2001 NEC Corporation
5 * Copyright (C) 2001 Miles Bader <miles@gnu.org>
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this
9 * archive for more details.
11 * Written by Miles Bader <miles@gnu.org>
14 #ifndef __V850_SIMSYSCALL_H__
15 #define __V850_SIMSYSCALL_H__
17 #define V850_SIM_SYS_exit(a...) V850_SIM_SYSCALL_1 (1 , ##a)
18 #define V850_SIM_SYS_fork(a...) V850_SIM_SYSCALL_0 (2 , ##a)
19 #define V850_SIM_SYS_read(a...) V850_SIM_SYSCALL_3 (3 , ##a)
20 #define V850_SIM_SYS_write(a...) V850_SIM_SYSCALL_3 (4 , ##a)
21 #define V850_SIM_SYS_open(a...) V850_SIM_SYSCALL_2 (5 , ##a)
22 #define V850_SIM_SYS_close(a...) V850_SIM_SYSCALL_1 (6 , ##a)
23 #define V850_SIM_SYS_wait4(a...) V850_SIM_SYSCALL_4 (7 , ##a)
24 /* #define V850_SIM_SYS_creat(a...) V850_SIM_SYSCALL_1 (8 , ##a) */
25 /* #define V850_SIM_SYS_link(a...) V850_SIM_SYSCALL_1 (9 , ##a) */
26 /* #define V850_SIM_SYS_unlink(a...) V850_SIM_SYSCALL_1 (10 , ##a) */
27 #define V850_SIM_SYS_execv(a...) V850_SIM_SYSCALL_2 (11 , ##a)
28 /* #define V850_SIM_SYS_chdir(a...) V850_SIM_SYSCALL_1 (12 , ##a) */
29 /* #define V850_SIM_SYS_mknod(a...) V850_SIM_SYSCALL_1 (14 , ##a) */
30 #define V850_SIM_SYS_chmod(a...) V850_SIM_SYSCALL_2 (15 , ##a)
31 #define V850_SIM_SYS_chown(a...) V850_SIM_SYSCALL_2 (16 , ##a)
32 #define V850_SIM_SYS_lseek(a...) V850_SIM_SYSCALL_3 (19 , ##a)
33 /* #define V850_SIM_SYS_getpid(a...) V850_SIM_SYSCALL_1 (20 , ##a) */
34 /* #define V850_SIM_SYS_isatty(a...) V850_SIM_SYSCALL_1 (21 , ##a) */
35 /* #define V850_SIM_SYS_fstat(a...) V850_SIM_SYSCALL_1 (22 , ##a) */
36 #define V850_SIM_SYS_time(a...) V850_SIM_SYSCALL_1 (23 , ##a)
37 #define V850_SIM_SYS_poll(a...) V850_SIM_SYSCALL_3 (24 , ##a)
38 #define V850_SIM_SYS_stat(a...) V850_SIM_SYSCALL_2 (38 , ##a)
39 #define V850_SIM_SYS_pipe(a...) V850_SIM_SYSCALL_1 (42 , ##a)
40 #define V850_SIM_SYS_times(a...) V850_SIM_SYSCALL_1 (43 , ##a)
41 #define V850_SIM_SYS_execve(a...) V850_SIM_SYSCALL_3 (59 , ##a)
42 #define V850_SIM_SYS_gettimeofday(a...) V850_SIM_SYSCALL_2 (116 , ##a)
43 /* #define V850_SIM_SYS_utime(a...) V850_SIM_SYSCALL_2 (201 , ##a) */
44 /* #define V850_SIM_SYS_wait(a...) V850_SIM_SYSCALL_1 (202 , ##a) */
46 #define V850_SIM_SYS_make_raw(a...) V850_SIM_SYSCALL_1 (1024 , ##a)
49 #define V850_SIM_SYSCALL_0(_call) \
50 ({ \
51 register int call __asm__ ("r6") = _call; \
52 register int rval __asm__ ("r10"); \
53 __asm__ __volatile__ ("trap 31" \
54 : "=r" (rval) \
55 : "r" (call) \
56 : "r11", "memory"); \
57 rval; \
59 #define V850_SIM_SYSCALL_1(_call, _arg0) \
60 ({ \
61 register int call __asm__ ("r6") = _call; \
62 register long arg0 __asm__ ("r7") = (long)_arg0; \
63 register int rval __asm__ ("r10"); \
64 __asm__ __volatile__ ("trap 31" \
65 : "=r" (rval) \
66 : "r" (call), "r" (arg0) \
67 : "r11", "memory"); \
68 rval; \
70 #define V850_SIM_SYSCALL_2(_call, _arg0, _arg1) \
71 ({ \
72 register int call __asm__ ("r6") = _call; \
73 register long arg0 __asm__ ("r7") = (long)_arg0; \
74 register long arg1 __asm__ ("r8") = (long)_arg1; \
75 register int rval __asm__ ("r10"); \
76 __asm__ __volatile__ ("trap 31" \
77 : "=r" (rval) \
78 : "r" (call), "r" (arg0), "r" (arg1) \
79 : "r11", "memory"); \
80 rval; \
82 #define V850_SIM_SYSCALL_3(_call, _arg0, _arg1, _arg2) \
83 ({ \
84 register int call __asm__ ("r6") = _call; \
85 register long arg0 __asm__ ("r7") = (long)_arg0; \
86 register long arg1 __asm__ ("r8") = (long)_arg1; \
87 register long arg2 __asm__ ("r9") = (long)_arg2; \
88 register int rval __asm__ ("r10"); \
89 __asm__ __volatile__ ("trap 31" \
90 : "=r" (rval) \
91 : "r" (call), "r" (arg0), "r" (arg1), "r" (arg2)\
92 : "r11", "memory"); \
93 rval; \
96 #define V850_SIM_SYSCALL(call, args...) \
97 V850_SIM_SYS_##call (args)
99 #endif /* __V850_SIMSYSCALL_H__ */