Merge zizzer.eecs.umich.edu:/bk/m5
[gem5.git] / kern / tru64 / tru64_syscalls.hh
1 /*
2 * Copyright (c) 2003 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #ifndef __TRU64_SYSCALLS_HH__
30 #define __TRU64_SYSCALLS_HH__
31
32 #include "targetarch/syscalls.hh"
33 #include "kern/tru64/tru64.hh"
34
35 struct SystemCalls<Tru64>
36 {
37 enum {
38 syscall = 0,
39 exit = 1,
40 fork = 2,
41 read = 3,
42 write = 4,
43 old_open = 5,
44 close = 6,
45 wait4 = 7,
46 old_creat = 8,
47 link = 9,
48 unlink = 10,
49 execv = 11,
50 chdir = 12,
51 fchdir = 13,
52 mknod = 14,
53 chmod = 15,
54 chown = 16,
55 obreak = 17,
56 pre_F64_getfsstat = 18,
57 lseek = 19,
58 getpid = 20,
59 mount = 21,
60 unmount = 22,
61 setuid = 23,
62 getuid = 24,
63 exec_with_loader = 25,
64 ptrace = 26,
65 recvmsg = 27,
66 sendmsg = 28,
67 recvfrom = 29,
68 accept = 30,
69 getpeername = 31,
70 getsockname = 32,
71 access = 33,
72 chflags = 34,
73 fchflags = 35,
74 sync = 36,
75 kill = 37,
76 old_stat = 38,
77 setpgid = 39,
78 old_lstat = 40,
79 dup = 41,
80 pipe = 42,
81 set_program_attributes = 43,
82 profil = 44,
83 open = 45,
84 obsolete_osigaction = 46,
85 getgid = 47,
86 sigprocmask = 48,
87 getlogin = 49,
88 setlogin = 50,
89 acct = 51,
90 sigpending = 52,
91 classcntl = 53,
92 ioctl = 54,
93 reboot = 55,
94 revoke = 56,
95 symlink = 57,
96 readlink = 58,
97 execve = 59,
98 umask = 60,
99 chroot = 61,
100 old_fstat = 62,
101 getpgrp = 63,
102 getpagesize = 64,
103 mremap = 65,
104 vfork = 66,
105 pre_F64_stat = 67,
106 pre_F64_lstat = 68,
107 sbrk = 69,
108 sstk = 70,
109 mmap = 71,
110 ovadvise = 72,
111 munmap = 73,
112 mprotect = 74,
113 madvise = 75,
114 old_vhangup = 76,
115 kmodcall = 77,
116 mincore = 78,
117 getgroups = 79,
118 setgroups = 80,
119 old_getpgrp = 81,
120 setpgrp = 82,
121 setitimer = 83,
122 old_wait = 84,
123 table = 85,
124 getitimer = 86,
125 gethostname = 87,
126 sethostname = 88,
127 getdtablesize = 89,
128 dup2 = 90,
129 pre_F64_fstat = 91,
130 fcntl = 92,
131 select = 93,
132 poll = 94,
133 fsync = 95,
134 setpriority = 96,
135 socket = 97,
136 connect = 98,
137 old_accept = 99,
138 getpriority = 100,
139 old_send = 101,
140 old_recv = 102,
141 sigreturn = 103,
142 bind = 104,
143 setsockopt = 105,
144 listen = 106,
145 plock = 107,
146 old_sigvec = 108,
147 old_sigblock = 109,
148 old_sigsetmask = 110,
149 sigsuspend = 111,
150 sigstack = 112,
151 old_recvmsg = 113,
152 old_sendmsg = 114,
153 obsolete_vtrcae = 115,
154 gettimeofday = 116,
155 getrusage = 117,
156 getsockopt = 118,
157 numa_syscalls = 119,
158 readv = 120,
159 writev = 121,
160 settimeofday = 122,
161 fchown = 123,
162 fchmod = 124,
163 old_recvfrom = 125,
164 setreuid = 126,
165 setregid = 127,
166 rename = 128,
167 truncate = 129,
168 ftruncate = 130,
169 flock = 131,
170 setgid = 132,
171 sendto = 133,
172 shutdown = 134,
173 socketpair = 135,
174 mkdir = 136,
175 rmdir = 137,
176 utimes = 138,
177 obsolete_42_sigreturn = 139,
178 adjtime = 140,
179 old_getpeername = 141,
180 gethostid = 142,
181 sethostid = 143,
182 getrlimit = 144,
183 setrlimit = 145,
184 old_killpg = 146,
185 setsid = 147,
186 quotactl = 148,
187 oldquota = 149,
188 old_getsockname = 150,
189 pread = 151,
190 pwrite = 152,
191 pid_block = 153,
192 pid_unblock = 154,
193 signal_urti = 155,
194 sigaction = 156,
195 sigwaitprim = 157,
196 nfssvc = 158,
197 getdirentries = 159,
198 pre_F64_statfs = 160,
199 pre_F64_fstatfs = 161,
200 async_daemon = 163,
201 getfh = 164,
202 getdomainname = 165,
203 setdomainname = 166,
204 exportfs = 169,
205 alt_plock = 181,
206 getmnt = 184,
207 alt_sigpending = 187,
208 alt_setsid = 188,
209 swapon = 199,
210 msgctl = 200,
211 msgget = 201,
212 msgrcv = 202,
213 msgsnd = 203,
214 semctl = 204,
215 semget = 205,
216 semop = 206,
217 uname = 207,
218 lchown = 208,
219 shmat = 209,
220 shmctl = 210,
221 shmdt = 211,
222 shmget = 212,
223 mvalid = 213,
224 getaddressconf = 214,
225 msleep = 215,
226 mwakeup = 216,
227 msync = 217,
228 signal = 218,
229 utc_gettime = 219,
230 utc_adjtime = 220,
231 security = 222,
232 kloadcall = 223,
233 stat = 224,
234 lstat = 225,
235 fstat = 226,
236 statfs = 227,
237 fstatfs = 228,
238 getfsstat = 229,
239 gettimeofday64 = 230,
240 settimeofday64 = 231,
241 getpgid = 233,
242 getsid = 234,
243 sigaltstack = 235,
244 waitid = 236,
245 priocntlset = 237,
246 sigsendset = 238,
247 set_speculative = 239,
248 msfs_syscall = 240,
249 sysinfo = 241,
250 uadmin = 242,
251 fuser = 243,
252 proplist_syscall = 244,
253 ntp_adjtime = 245,
254 ntp_gettime = 246,
255 pathconf = 247,
256 fpathconf = 248,
257 sync2 = 249,
258 uswitch = 250,
259 usleep_thread = 251,
260 audcntl = 252,
261 audgen = 253,
262 sysfs = 254,
263 subsys_info = 255,
264 getsysinfo = 256,
265 setsysinfo = 257,
266 afs_syscall = 258,
267 swapctl = 259,
268 memcntl = 260,
269 fdatasync = 261,
270 oflock = 262,
271 _F64_readv = 263,
272 _F64_writev = 264,
273 cdslxlate = 265,
274 sendfile = 266,
275 StandardNumber
276 };
277
278 enum {
279 task_self = 10,
280 thread_reply = 11,
281 task_notify = 12,
282 thread_self = 13,
283 msg_send_trap = 20,
284 msg_receive_trap = 21,
285 msg_rpc_trap = 22,
286 nxm_block = 24,
287 nxm_unblock = 25,
288 nxm_thread_destroy = 29,
289 lw_wire = 30,
290 lw_unwire = 31,
291 nxm_thread_create = 32,
292 nxm_task_init = 33,
293 nxm_idle = 35,
294 nxm_wakeup_idle = 36,
295 nxm_set_pthid = 37,
296 nxm_thread_kill = 38,
297 nxm_thread_block = 39,
298 nxm_thread_wakeup = 40,
299 init_process = 41,
300 nxm_get_binding = 42,
301 map_fd = 43,
302 nxm_resched = 44,
303 nxm_set_cancel = 45,
304 nxm_set_binding = 46,
305 stack_create = 47,
306 nxm_get_state = 48,
307 nxm_thread_suspend = 49,
308 nxm_thread_resume = 50,
309 nxm_signal_check = 51,
310 htg_unix_syscall = 52,
311 host_self = 55,
312 host_priv_self = 56,
313 swtch_pri = 59,
314 swtch = 60,
315 thread_switch = 61,
316 semop_fast = 62,
317 nxm_pshared_init = 63,
318 nxm_pshared_block = 64,
319 nxm_pshared_unblock = 65,
320 nxm_pshared_destroy = 66,
321 nxm_swtch_pri = 67,
322 lw_syscall = 68,
323 mach_sctimes_0 = 70,
324 mach_sctimes_1 = 71,
325 mach_sctimes_2 = 72,
326 mach_sctimes_3 = 73,
327 mach_sctimes_4 = 74,
328 mach_sctimes_5 = 75,
329 mach_sctimes_6 = 76,
330 mach_sctimes_7 = 77,
331 mach_sctimes_8 = 78,
332 mach_sctimes_9 = 79,
333 mach_sctimes_10 = 80,
334 mach_sctimes_11 = 81,
335 mach_sctimes_port_alloc_dealloc = 82,
336 MachNumber
337 };
338
339 static const int Number = StandardNumber + MachNumber;
340
341 static const char *name(int num);
342
343 static bool validSyscallNumber(int num) {
344 return -MachNumber < num && num < StandardNumber;
345 }
346
347 static int convert(int syscall_num) {
348 if (!validSyscallNumber(syscall_num))
349 return -1;
350
351 return syscall_num < 0 ? StandardNumber - syscall_num : syscall_num;
352 }
353 };
354
355 #endif // __TRU64_SYSCALLS_HH__