1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #include <errno.h>
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <strings.h>
30 #include <unistd.h>
31 #include <sys/auxv.h>
32 #include <sys/bitmap.h>
33 #include <sys/brand.h>
34 #include <sys/inttypes.h>
35 #include <sys/lwp.h>
36 #include <sys/syscall.h>
37 #include <sys/systm.h>
38 #include <sys/utsname.h>
39 
40 #include <sn1_brand.h>
41 #include <sn1_misc.h>
42 
43 /*
44  * Principles of emulation 101.
45  *
46  *
47  * *** Setting errno
48  *
49  * Just don't do it.  This emulation library is loaded onto a
50  * seperate link map from the application who's address space we're
51  * running in.  We have our own private copy of libc, so there for,
52  * the errno value accessible from here is is also private and changing
53  * it will not affect any errno value that the processes who's address
54  * space we are running in will see.  To return an error condition we
55  * should return the negated errno value we'd like the system to return.
56  * For more information about this see the comment in sn1_handler().
57  * Basically, when we return to the caller that initiated the system
58  * call it's their responsibility to set errno.
59  *
60  *
61  * *** Recursion Considerations
62  *
63  * When emulating system calls we need to be very careful about what
64  * library calls we invoke.  Library calls should be kept to a minimum.
65  * One issue is that library calls can invoke system calls, so if we're
66  * emulating a system call and we invoke a library call that depends on
67  * that system call we will probably enter a recursive loop, which would
68  * be bad.
69  *
70  *
71  * *** Return Values.
72  *
73  * When declaring new syscall emulation functions, it is very important
74  * to to set the proper RV_* flags in the sn1_sysent_table.  Upon failure,
75  * syscall emulation fuctions should return an errno value.  Upon success
76  * syscall emulation functions should return 0 and set the sysret_t return
77  * value parameters accordingly.
78  *
79  *
80  * *** Agent lwp considerations
81  *
82  * It is currently impossible to do any emulation for these system call
83  * when they are being invoked on behalf of an agent lwp.  To understand why
84  * it's impossible you have to understand how agent lwp syscalls work.
85  *
86  * The agent lwp syscall process works as follows:
87  *   1  The controlling process stops the target.
88  *   2  The controlling process injects an agent lwp which is also stopped.
89  *      This agent lwp assumes the userland stack and register values
90  *      of another stopped lwp in the current process.
91  *   3  The controlling process configures the agent lwp to start
92  *      executing the requested system call.
93  *   4  The controlling process configure /proc to stop the agent lwp when
94  *      it enters the requested system call.
95  *   5  The controlling processes allows the agent lwp to start executing.
96  *   6  The agent lwp traps into the kernel to perform the requested system
97  *      call and immediately stop.
98  *   7  The controlling process copies all the arguments for the requested
99  *      system call onto the agent lwp's stack.
100  *   8  The controlling process configures /proc to stop the agent lwp
101  *      when it completes the requested system call.
102  *   9  The controlling processes allows the agent lwp to start executing.
103  *  10  The agent lwp executes the system call and then stop before returning
104  *      to userland.
105  *  11  The controlling process copies the return value and return arguments
106  *      back from the agent lwps stack.
107  *  12  The controlling process destroys the agent lwp and restarts
108  *      the target process.
109  *
110  * The fundamental problem is that when the agent executes the request
111  * system call in step 5, if we're emulating that system call then the
112  * lwp is redirected back to our emulation layer without blocking
113  * in the kernel.  But our emulation layer can't access the arguments
114  * for the system call because they haven't been copied to the stack
115  * yet and they still only exist in the controlling processes address
116  * space.  This prevents us from being able to do any emulation of
117  * agent lwp system calls.  Hence, currently our brand trap interposition
118  * callback (sn1_brand_syscall_callback_common) will detect if a system
119  * call is being made by an agent lwp, and if this is the case it will
120  * never redirect the system call to this emulation library.
121  *
122  * In the future, if this proves to be a problem the the easiest solution
123  * would probably be to replace the branded versions of these application
124  * with their native counterparts.  Ie,  truss, plimit, and pfiles could be
125  * replace with wrapper scripts that execute the native versions of these
126  * applications.  In the case of plimit and pfiles this should be pretty
127  * strait forward.  Truss would probably be more tricky since it can
128  * execute applications which would be branded applications, so in that
129  * case it might be necessary to create a loadable library which could
130  * be LD_PRELOADed into truss and this library would interpose on the
131  * exec() system call to allow truss to correctly execute branded
132  * processes.  It should be pointed out that this solution could work
133  * because "native agent lwps" (ie, agent lwps created by native
134  * processes) can be treated differently from "branded aged lwps" (ie,
135  * agent lwps created by branded processes), since native agent lwps
136  * would presumably be making native system calls and hence not need
137  * any interposition.
138  *
139  *
140  * *** sn1 brand emulation scope considerations
141  *
142  * One of the differences between the lx brand and the s8 and s9
143  * brands, is that the s8 and s9 brands only interpose on syscalls
144  * that need some kind of emulation, where as the lx brand interposes
145  * on _all_ system calls.  Lx branded system calls that don't need
146  * any emulation are then redirected back to the kernel from the
147  * userland library via the IN_KERNEL_SYSCALL macro.  The lx-syscall
148  * dtrace provider depends on this behavior.
149  *
150  * Given that the sn1 brand exists for testing purposes, it should
151  * eventually be enhanced to redirect all system calls through the
152  * brand emulation library.  This will ensure the maximum testing
153  * exposure for the brandz infrastructure.  Some other options to
154  * consider for improving brandz test exposure are:
155  * - Folding the sn1 brand into the native brand and only enabling
156  *   it on DEBUG builds.
157  * - Modifying the zones test suite to use sn1 branded zones by default,
158  *   any adapting functional test harnesses to use sn1 branded zones
159  *   by default instead of native zones.
160  */
161 
162 #define	EMULATE(cb, args)	{ (sysent_cb_t)(cb), (args) }
163 #define	NOSYS			EMULATE(sn1_unimpl, (0 | RV_DEFAULT))
164 
165 typedef long (*sysent_cb_t)();
166 typedef struct sn1_sysent_table {
167 	sysent_cb_t	st_callc;
168 	uintptr_t	st_args;
169 } sn1_sysent_table_t;
170 sn1_sysent_table_t sn1_sysent_table[];
171 
172 /*LINTED: static unused*/
173 static volatile int		sn1_abort_err;
174 /*LINTED: static unused*/
175 static volatile const char	*sn1_abort_msg;
176 /*LINTED: static unused*/
177 static volatile const char	*sn1_abort_file;
178 /*LINTED: static unused*/
179 static volatile int		sn1_abort_line;
180 
181 extern int errno;
182 
183 /*ARGSUSED*/
184 void
185 _sn1_abort(int err, const char *msg, const char *file, int line)
186 {
187 	sysret_t rval;
188 
189 	/* Save the error message into convenient globals */
190 	sn1_abort_err = err;
191 	sn1_abort_msg = msg;
192 	sn1_abort_file = file;
193 	sn1_abort_line = line;
194 
195 	/* kill ourselves */
196 	abort();
197 
198 	/* If abort() didn't work, try something stronger. */
199 	(void) __systemcall(&rval, SYS_lwp_kill + 1024, _lwp_self(), SIGKILL);
200 }
201 
202 /*
203  * This function is defined to be NOSYS but it won't be called from the
204  * the kernel since the NOSYS system calls are not enabled in the kernel.
205  * Thus, the only time this function is called is directly from within the
206  * indirect system call path.
207  */
208 /*ARGSUSED*/
209 static long
210 sn1_unimpl(sysret_t *rv, uintptr_t p1)
211 {
212 	sysret_t rval;
213 
214 	/*
215 	 * We'd like to print out some kind of error message here like
216 	 * "unsupported syscall", but we can't because it's not safe to
217 	 * assume that stderr or STDERR_FILENO actually points to something
218 	 * that is a terminal, and if we wrote to those files we could
219 	 * inadvertantly write to some applications open files, which would
220 	 * be bad.
221 	 *
222 	 * Normally, if an application calls an invalid system call
223 	 * it get a SIGSYS sent to it.  So we'll just go ahead and send
224 	 * ourselves a signal here.  Note that this is far from ideal since
225 	 * if the application has registered a signal handler, that signal
226 	 * handler may recieve a ucontext_t as the third parameter to
227 	 * indicate the context of the process when the signal was
228 	 * generated, and in this case that context will not be what the
229 	 * application is expecting.  Hence, we should probably create a
230 	 * brandsys() kernel function that can deliver the signal to us
231 	 * with the correct ucontext_t.
232 	 */
233 	(void) __systemcall(&rval, SYS_lwp_kill + 1024, _lwp_self(), SIGSYS);
234 	return (ENOSYS);
235 }
236 
237 #if defined(__sparc) && !defined(__sparcv9)
238 /*
239  * Yuck.  For 32-bit sparc applications, handle indirect system calls.
240  * Note that we declare this interface to use the maximum number of
241  * system call arguments.  If we recieve a system call that uses less
242  * arguments, then the additional arguments will be garbage, but they
243  * will also be ignored so that should be ok.
244  */
245 static long
246 sn1_indir(sysret_t *rv, int code,
247     uintptr_t a0, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4,
248     uintptr_t a5, uintptr_t a6, uintptr_t a7)
249 {
250 	sn1_sysent_table_t *sst = &(sn1_sysent_table[code]);
251 
252 	sn1_assert(code < NSYSCALL);
253 	switch (sst->st_args & NARGS_MASK) {
254 	case 0:
255 		return ((sst->st_callc)(rv));
256 	case 1:
257 		return ((sst->st_callc)(rv, a0));
258 	case 2:
259 		return ((sst->st_callc)(rv, a0, a1));
260 	case 3:
261 		return ((sst->st_callc)(rv, a0, a1, a2));
262 	case 4:
263 		return ((sst->st_callc)(rv, a0, a1, a2, a3));
264 	case 5:
265 		return ((sst->st_callc)(rv, a0, a1, a2, a3, a4));
266 	case 6:
267 		return ((sst->st_callc)(rv, rv, a0, a1, a2, a3, a4, a5));
268 	case 7:
269 		return ((sst->st_callc)(rv, a0, a1, a2, a3, a4, a5, a6));
270 	case 8:
271 		return ((sst->st_callc)(rv, a0, a1, a2, a3, a4, a5, a6, a7));
272 	}
273 	sn1_abort(0, "invalid entry in sn1_sysent_table");
274 	return (EINVAL);
275 }
276 #endif /* __sparc && !__sparcv9 */
277 
278 static long
279 sn1_uname(sysret_t *rv, uintptr_t p1)
280 {
281 	struct utsname	un, *unp = (struct utsname *)p1;
282 	int		rev, err;
283 
284 	if ((err = __systemcall(rv, SYS_uname + 1024, &un)) != 0)
285 		return (err);
286 
287 	rev = atoi(&un.release[2]);
288 	sn1_assert(rev >= 10);
289 	(void) sprintf(un.release, "5.%d", rev - 1);
290 
291 	if (uucopy(&un, unp, sizeof (un)) != 0)
292 		return (EFAULT);
293 	return (0);
294 }
295 
296 /*
297  * Close a libc file handle, but don't actually close the underlying
298  * file descriptor.
299  */
300 static void
301 sn1_close_fh(FILE *file)
302 {
303 	int fd, fd_new;
304 
305 	if (file == NULL)
306 		return;
307 
308 	if ((fd = fileno(file)) < 0)
309 		return;
310 
311 	fd_new = dup(fd);
312 	if (fd_new == -1)
313 		return;
314 
315 	(void) fclose(file);
316 	(void) dup2(fd_new, fd);
317 	(void) close(fd_new);
318 }
319 
320 /*ARGSUSED*/
321 int
322 sn1_init(int argc, char *argv[], char *envp[])
323 {
324 	sysret_t		rval;
325 	sn1_brand_reg_t		reg;
326 	sn1_elf_data_t		sed;
327 	auxv_t			*ap;
328 	uintptr_t		*p;
329 	int			i, err;
330 
331 	/* Sanity check our translation table return value codes */
332 	for (i = 0; i < NSYSCALL; i++) {
333 		sn1_sysent_table_t *est = &(sn1_sysent_table[i]);
334 		sn1_assert(BIT_ONLYONESET(est->st_args & RV_MASK));
335 	}
336 
337 	/*
338 	 * We need to shutdown all libc stdio.  libc stdio normally goes to
339 	 * file descriptors, but since we're actually part of a another
340 	 * process we don't own these file descriptors and we can't make
341 	 * any assumptions about their state.
342 	 */
343 	sn1_close_fh(stdin);
344 	sn1_close_fh(stdout);
345 	sn1_close_fh(stderr);
346 
347 	/*
348 	 * Register our syscall emulation table with the kernel.
349 	 * Note that we don't have to do invoke (syscall_number + 1024)
350 	 * until we've actually establised a syscall emulation callback
351 	 * handler address, which is what we're doing with this brand
352 	 * syscall.
353 	 */
354 	reg.sbr_version = SN1_VERSION;
355 #ifdef	__x86
356 	reg.sbr_handler = (caddr_t)sn1_handler_table;
357 #else	/* !__x86 */
358 	reg.sbr_handler = (caddr_t)sn1_handler;
359 #endif	/* !__x86 */
360 	if ((err = __systemcall(&rval, SYS_brand, B_REGISTER, &reg)) != 0) {
361 		sn1_abort(err, "Failed to brand current process");
362 		/*NOTREACHED*/
363 	}
364 
365 	/* Get data about the executable we're running from the kernel. */
366 	if ((err = __systemcall(&rval, SYS_brand + 1024,
367 	    B_ELFDATA, (void *)&sed)) != 0) {
368 		sn1_abort(err,
369 		    "Failed to get required brand ELF data from the kernel");
370 		/*NOTREACHED*/
371 	}
372 
373 	/*
374 	 * Find the aux vector on the stack.
375 	 */
376 	p = (uintptr_t *)envp;
377 	while (*p != NULL)
378 		p++;
379 
380 	/*
381 	 * p is now pointing at the 0 word after the environ pointers.
382 	 * After that is the aux vectors.
383 	 *
384 	 * The aux vectors are currently pointing to the brand emulation
385 	 * library and associated linker.  We're going to change them to
386 	 * point to the brand executable and associated linker (or to no
387 	 * linker for static binaries).  This matches the process data
388 	 * stored within the kernel and visible from /proc, which was
389 	 * all setup in sn1_elfexec().  We do this so that when a debugger
390 	 * attaches to the process it sees the process as a normal solaris
391 	 * process, this brand emulation library and everything on it's
392 	 * link map will not be visible, unless our librtld_db plugin
393 	 * is used.  Note that this is very different from how Linux
394 	 * branded processes are implemented within lx branded zones.
395 	 * In that situation, the primary linkmap of the process is the
396 	 * brand emulation libraries linkmap, not the Linux applications
397 	 * linkmap.
398 	 *
399 	 * We also need to clear the AF_SUN_NOPLM flag from the AT_SUN_AUXFLAGS
400 	 * aux vector.  This flag told our linker that we don't have a
401 	 * primary link map.  Now that our linker is done initializing, we
402 	 * want to clear this flag before we transfer control to the
403 	 * applications copy of the linker, since we want that linker to have
404 	 * a primary link map which will be the link map for the application
405 	 * we're running.
406 	 */
407 	p++;
408 	for (ap = (auxv_t *)p; ap->a_type != AT_NULL; ap++) {
409 		switch (ap->a_type) {
410 			case AT_BASE:
411 				/* Hide AT_BASE if static binary */
412 				if (sed.sed_base == NULL) {
413 					ap->a_type = AT_IGNORE;
414 					ap->a_un.a_val = NULL;
415 				} else {
416 					ap->a_un.a_val = sed.sed_base;
417 				}
418 				break;
419 			case AT_ENTRY:
420 				ap->a_un.a_val = sed.sed_entry;
421 				break;
422 			case AT_PHDR:
423 				ap->a_un.a_val = sed.sed_phdr;
424 				break;
425 			case AT_PHENT:
426 				ap->a_un.a_val = sed.sed_phent;
427 				break;
428 			case AT_PHNUM:
429 				ap->a_un.a_val = sed.sed_phnum;
430 				break;
431 			case AT_SUN_AUXFLAGS:
432 				ap->a_un.a_val &= ~AF_SUN_NOPLM;
433 				break;
434 			case AT_SUN_EMULATOR:
435 				/*
436 				 * ld.so.1 inspects AT_SUN_EMULATOR to see if
437 				 * if it is the linker for the brand emulation
438 				 * library.  Hide AT_SUN_EMULATOR, as the
439 				 * linker we are about to jump to is the linker
440 				 * for the binary.
441 				 */
442 				ap->a_type = AT_IGNORE;
443 				ap->a_un.a_val = NULL;
444 				break;
445 			case AT_SUN_LDDATA:
446 				/* Hide AT_SUN_LDDATA if static binary */
447 				if (sed.sed_lddata == NULL) {
448 					ap->a_type = AT_IGNORE;
449 					ap->a_un.a_val = NULL;
450 				} else {
451 					ap->a_un.a_val = sed.sed_lddata;
452 				}
453 				break;
454 			default:
455 				break;
456 		}
457 	}
458 
459 	sn1_runexe(argv, sed.sed_ldentry);
460 	/*NOTREACHED*/
461 	sn1_abort(0, "sn1_runexe() returned");
462 	return (-1);
463 }
464 
465 #define	IN_KERNEL_SYSCALL(name, num)					\
466 static long								\
467 sn1_##name(sysret_t *rv,						\
468     uintptr_t a0, uintptr_t a1, uintptr_t a2, uintptr_t a3,		\
469     uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7)		\
470 {									\
471 	return (__systemcall(rv, num + 1024,				\
472 	    a0, a1, a2, a3, a4, a5, a6, a7));				\
473 }
474 
475 /*
476  * These are branded system calls, which have been redirected to this
477  * userland emulation library, and are emulated by passing them strait
478  * on to the kernel as native system calls.
479  */
480 IN_KERNEL_SYSCALL(read,		SYS_read)		/*   3 */
481 IN_KERNEL_SYSCALL(write,	SYS_write)		/*   4 */
482 IN_KERNEL_SYSCALL(wait,		SYS_wait)		/*   7 */
483 IN_KERNEL_SYSCALL(time,		SYS_time)		/*  13 */
484 IN_KERNEL_SYSCALL(getpid,	SYS_getpid)		/*  20 */
485 IN_KERNEL_SYSCALL(mount,	SYS_mount)		/*  21 */
486 IN_KERNEL_SYSCALL(getuid,	SYS_getuid)		/*  24 */
487 IN_KERNEL_SYSCALL(times,	SYS_times)		/*  43 */
488 IN_KERNEL_SYSCALL(getgid,	SYS_getgid)		/*  47 */
489 IN_KERNEL_SYSCALL(utssys,	SYS_utssys)		/*  57 */
490 IN_KERNEL_SYSCALL(readlink,	SYS_readlink)		/*  90 */
491 
492 /*
493  * This table must have at least NSYSCALL entries in it.
494  *
495  * The second parameter of each entry in the sn1_sysent_table
496  * contains the number of parameters and flags that describe the
497  * syscall return value encoding.  See the block comments at the
498  * top of this file for more information about the syscall return
499  * value flags and when they should be used.
500  */
501 sn1_sysent_table_t sn1_sysent_table[] = {
502 #if defined(__sparc) && !defined(__sparcv9)
503 	EMULATE(sn1_indir, 9 | RV_64RVAL),	/*  0 */
504 #else /* !__sparc || __sparcv9 */
505 	NOSYS,					/*  0 */
506 #endif /* !__sparc || __sparcv9 */
507 	NOSYS,					/*   1 */
508 	NOSYS,					/*   2 */
509 	EMULATE(sn1_read, 3 | RV_DEFAULT),	/*   3 */
510 	EMULATE(sn1_write, 3 | RV_DEFAULT),	/*   4 */
511 	NOSYS,					/*   5 */
512 	NOSYS,					/*   6 */
513 	EMULATE(sn1_wait, 0 | RV_32RVAL2),	/*   7 */
514 	NOSYS,					/*   8 */
515 	NOSYS,					/*   9 */
516 	NOSYS,					/*  10 */
517 	NOSYS,					/*  11 */
518 	NOSYS,					/*  12 */
519 	EMULATE(sn1_time, 0 | RV_DEFAULT),	/*  13 */
520 	NOSYS,					/*  14 */
521 	NOSYS,					/*  15 */
522 	NOSYS,					/*  16 */
523 	NOSYS,					/*  17 */
524 	NOSYS,					/*  18 */
525 	NOSYS,					/*  19 */
526 	EMULATE(sn1_getpid, 0 | RV_32RVAL2),	/*  20 */
527 	EMULATE(sn1_mount, 8 | RV_DEFAULT),	/*  21 */
528 	NOSYS,					/*  22 */
529 	NOSYS,					/*  23 */
530 	EMULATE(sn1_getuid, 0 | RV_32RVAL2),	/*  24 */
531 	NOSYS,					/*  25 */
532 	NOSYS,					/*  26 */
533 	NOSYS,					/*  27 */
534 	NOSYS,					/*  28 */
535 	NOSYS,					/*  29 */
536 	NOSYS,					/*  30 */
537 	NOSYS,					/*  31 */
538 	NOSYS,					/*  32 */
539 	NOSYS,					/*  33 */
540 	NOSYS,					/*  34 */
541 	NOSYS,					/*  35 */
542 	NOSYS,					/*  36 */
543 	NOSYS,					/*  37 */
544 	NOSYS,					/*  38 */
545 	NOSYS,					/*  39 */
546 	NOSYS,					/*  40 */
547 	NOSYS,					/*  41 */
548 	NOSYS,					/*  42 */
549 	EMULATE(sn1_times, 1 | RV_DEFAULT),	/*  43 */
550 	NOSYS,					/*  44 */
551 	NOSYS,					/*  45 */
552 	NOSYS,					/*  46 */
553 	EMULATE(sn1_getgid, 0 | RV_32RVAL2),	/*  47 */
554 	NOSYS,					/*  48 */
555 	NOSYS,					/*  49 */
556 	NOSYS,					/*  50 */
557 	NOSYS,					/*  51 */
558 	NOSYS,					/*  52 */
559 	NOSYS,					/*  53 */
560 	NOSYS,					/*  54 */
561 	NOSYS,					/*  55 */
562 	NOSYS,					/*  56 */
563 	EMULATE(sn1_utssys, 4 | RV_32RVAL2),	/*  57 */
564 	NOSYS,					/*  58 */
565 	NOSYS,					/*  59 */
566 	NOSYS,					/*  60 */
567 	NOSYS,					/*  61 */
568 	NOSYS,					/*  62 */
569 	NOSYS,					/*  63 */
570 	NOSYS,					/*  64 */
571 	NOSYS,					/*  65 */
572 	NOSYS,					/*  66 */
573 	NOSYS,					/*  67 */
574 	NOSYS,					/*  68 */
575 	NOSYS,					/*  69 */
576 	NOSYS,					/*  70 */
577 	NOSYS,					/*  71 */
578 	NOSYS,					/*  72 */
579 	NOSYS,					/*  73 */
580 	NOSYS,					/*  74 */
581 	NOSYS,					/*  75 */
582 	NOSYS,					/*  76 */
583 	NOSYS,					/*  77 */
584 	NOSYS,					/*  78 */
585 	NOSYS,					/*  79 */
586 	NOSYS,					/*  80 */
587 	NOSYS,					/*  81 */
588 	NOSYS,					/*  82 */
589 	NOSYS,					/*  83 */
590 	NOSYS,					/*  84 */
591 	NOSYS,					/*  85 */
592 	NOSYS,					/*  86 */
593 	NOSYS,					/*  87 */
594 	NOSYS,					/*  88 */
595 	NOSYS,					/*  89 */
596 	EMULATE(sn1_readlink, 3 | RV_DEFAULT),	/*  90 */
597 	NOSYS,					/*  91 */
598 	NOSYS,					/*  92 */
599 	NOSYS,					/*  93 */
600 	NOSYS,					/*  94 */
601 	NOSYS,					/*  95 */
602 	NOSYS,					/*  96 */
603 	NOSYS,					/*  97 */
604 	NOSYS,					/*  98 */
605 	NOSYS,					/*  99 */
606 	NOSYS,					/* 100 */
607 	NOSYS,					/* 101 */
608 	NOSYS,					/* 102 */
609 	NOSYS,					/* 103 */
610 	NOSYS,					/* 104 */
611 	NOSYS,					/* 105 */
612 	NOSYS,					/* 106 */
613 	NOSYS,					/* 107 */
614 	NOSYS,					/* 108 */
615 	NOSYS,					/* 109 */
616 	NOSYS,					/* 110 */
617 	NOSYS,					/* 111 */
618 	NOSYS,					/* 112 */
619 	NOSYS,					/* 113 */
620 	NOSYS,					/* 114 */
621 	NOSYS,					/* 115 */
622 	NOSYS,					/* 116 */
623 	NOSYS,					/* 117 */
624 	NOSYS,					/* 118 */
625 	NOSYS,					/* 119 */
626 	NOSYS,					/* 120 */
627 	NOSYS,					/* 121 */
628 	NOSYS,					/* 122 */
629 	NOSYS,					/* 123 */
630 	NOSYS,					/* 124 */
631 	NOSYS,					/* 125 */
632 	NOSYS,					/* 126 */
633 	NOSYS,					/* 127 */
634 	NOSYS,					/* 128 */
635 	NOSYS,					/* 129 */
636 	NOSYS,					/* 130 */
637 	NOSYS,					/* 131 */
638 	NOSYS,					/* 132 */
639 	NOSYS,					/* 133 */
640 	NOSYS,					/* 134 */
641 	EMULATE(sn1_uname, 1 | RV_DEFAULT),	/* 135 */
642 	NOSYS,					/* 136 */
643 	NOSYS,					/* 137 */
644 	NOSYS,					/* 138 */
645 	NOSYS,					/* 139 */
646 	NOSYS,					/* 140 */
647 	NOSYS,					/* 141 */
648 	NOSYS,					/* 142 */
649 	NOSYS,					/* 143 */
650 	NOSYS,					/* 144 */
651 	NOSYS,					/* 145 */
652 	NOSYS,					/* 146 */
653 	NOSYS,					/* 147 */
654 	NOSYS,					/* 148 */
655 	NOSYS,					/* 149 */
656 	NOSYS,					/* 150 */
657 	NOSYS,					/* 151 */
658 	NOSYS,					/* 152 */
659 	NOSYS,					/* 153 */
660 	NOSYS,					/* 154 */
661 	NOSYS,					/* 155 */
662 	NOSYS,					/* 156 */
663 	NOSYS,					/* 157 */
664 	NOSYS,					/* 158 */
665 	NOSYS,					/* 159 */
666 	NOSYS,					/* 160 */
667 	NOSYS,					/* 161 */
668 	NOSYS,					/* 162 */
669 	NOSYS,					/* 163 */
670 	NOSYS,					/* 164 */
671 	NOSYS,					/* 165 */
672 	NOSYS,					/* 166 */
673 	NOSYS,					/* 167 */
674 	NOSYS,					/* 168 */
675 	NOSYS,					/* 169 */
676 	NOSYS,					/* 170 */
677 	NOSYS,					/* 171 */
678 	NOSYS,					/* 172 */
679 	NOSYS,					/* 173 */
680 	NOSYS,					/* 174 */
681 	NOSYS,					/* 175 */
682 	NOSYS,					/* 176 */
683 	NOSYS,					/* 177 */
684 	NOSYS,					/* 178 */
685 	NOSYS,					/* 179 */
686 	NOSYS,					/* 180 */
687 	NOSYS,					/* 181 */
688 	NOSYS,					/* 182 */
689 	NOSYS,					/* 183 */
690 	NOSYS,					/* 184 */
691 	NOSYS,					/* 185 */
692 	NOSYS,					/* 186 */
693 	NOSYS,					/* 187 */
694 	NOSYS,					/* 188 */
695 	NOSYS,					/* 189 */
696 	NOSYS,					/* 190 */
697 	NOSYS,					/* 191 */
698 	NOSYS,					/* 192 */
699 	NOSYS,					/* 193 */
700 	NOSYS,					/* 194 */
701 	NOSYS,					/* 195 */
702 	NOSYS,					/* 196 */
703 	NOSYS,					/* 197 */
704 	NOSYS,					/* 198 */
705 	NOSYS,					/* 199 */
706 	NOSYS,					/* 200 */
707 	NOSYS,					/* 201 */
708 	NOSYS,					/* 202 */
709 	NOSYS,					/* 203 */
710 	NOSYS,					/* 204 */
711 	NOSYS,					/* 205 */
712 	NOSYS,					/* 206 */
713 	NOSYS,					/* 207 */
714 	NOSYS,					/* 208 */
715 	NOSYS,					/* 209 */
716 	NOSYS,					/* 210 */
717 	NOSYS,					/* 211 */
718 	NOSYS,					/* 212 */
719 	NOSYS,					/* 213 */
720 	NOSYS,					/* 214 */
721 	NOSYS,					/* 215 */
722 	NOSYS,					/* 216 */
723 	NOSYS,					/* 217 */
724 	NOSYS,					/* 218 */
725 	NOSYS,					/* 219 */
726 	NOSYS,					/* 220 */
727 	NOSYS,					/* 221 */
728 	NOSYS,					/* 222 */
729 	NOSYS,					/* 223 */
730 	NOSYS,					/* 224 */
731 	NOSYS,					/* 225 */
732 	NOSYS,					/* 226 */
733 	NOSYS,					/* 227 */
734 	NOSYS,					/* 228 */
735 	NOSYS,					/* 229 */
736 	NOSYS,					/* 230 */
737 	NOSYS,					/* 231 */
738 	NOSYS,					/* 232 */
739 	NOSYS,					/* 233 */
740 	NOSYS,					/* 234 */
741 	NOSYS,					/* 235 */
742 	NOSYS,					/* 236 */
743 	NOSYS,					/* 237 */
744 	NOSYS,					/* 238 */
745 	NOSYS,					/* 239 */
746 	NOSYS,					/* 240 */
747 	NOSYS,					/* 241 */
748 	NOSYS,					/* 242 */
749 	NOSYS,					/* 243 */
750 	NOSYS,					/* 244 */
751 	NOSYS,					/* 245 */
752 	NOSYS,					/* 246 */
753 	NOSYS,					/* 247 */
754 	NOSYS,					/* 248 */
755 	NOSYS,					/* 249 */
756 	NOSYS,					/* 250 */
757 	NOSYS,					/* 251 */
758 	NOSYS,					/* 252 */
759 	NOSYS,					/* 253 */
760 	NOSYS,					/* 254 */
761 	NOSYS					/* 255 */
762 };
763