xref: /netbsd-src/sys/compat/netbsd32/netbsd32.h (revision 481fca6e59249d8ffcf24fef7cfbe7b131bfb080)
1 /*	$NetBSD: netbsd32.h,v 1.11 2000/07/09 13:39:31 mrg Exp $	*/
2 
3 /*
4  * Copyright (c) 1998 Matthew R. Green
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. The name of the author may not be used to endorse or promote products
16  *    derived from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  */
30 
31 #ifndef _COMPAT_NETBSD32_NETBSD32_H_
32 #define _COMPAT_NETBSD32_NETBSD32_H_
33 /* We need to change the size of register_t */
34 #ifdef syscallargs
35 #undef syscallargs
36 #endif
37 /*
38  * NetBSD 32-bit compatibility module.
39  */
40 
41 #include <sys/mount.h>
42 #include <sys/ipc.h>
43 #include <sys/shm.h>
44 
45 /*
46  * first, define all the types we need.
47  */
48 
49 typedef int32_t netbsd32_long;
50 typedef u_int32_t netbsd32_u_long;
51 
52 typedef u_int32_t netbsd32_clock_t;
53 typedef u_int32_t netbsd32_size_t;
54 typedef int32_t netbsd32_ssize_t;
55 typedef int32_t netbsd32_clockid_t;
56 typedef u_int32_t netbsd32_caddr_t;
57 typedef int32_t netbsd32_key_t;
58 typedef int32_t netbsd32_intptr_t;
59 typedef u_int32_t netbsd32_uintptr_t;
60 
61 /* all pointers are u_int32_t */
62 
63 typedef u_int32_t netbsd32_voidp;
64 typedef u_int32_t netbsd32_u_shortp;
65 typedef u_int32_t netbsd32_charp;
66 typedef u_int32_t netbsd32_u_charp;
67 typedef u_int32_t netbsd32_charpp;
68 typedef u_int32_t netbsd32_size_tp;
69 typedef u_int32_t netbsd32_intp;
70 typedef u_int32_t netbsd32_longp;
71 typedef u_int32_t netbsd32_caddrp;
72 typedef u_int32_t netbsd32_caddr;
73 typedef u_int32_t netbsd32_gid_tp;
74 typedef u_int32_t netbsd32_fsid_tp_t;
75 
76 /*
77  * now, the compatibility structures and their fake pointer types.
78  */
79 
80 /* from <sys/types.h> */
81 typedef u_int32_t netbsd32_fd_setp_t;
82 
83 /* from <sys/uio.h> */
84 typedef u_int32_t netbsd32_iovecp_t;
85 struct netbsd32_iovec {
86 	netbsd32_voidp	iov_base;	/* Base address. */
87 	netbsd32_size_t	 iov_len;	/* Length. */
88 };
89 
90 /* from <sys/time.h> */
91 typedef int32_t netbsd32_timer_t;
92 typedef	int32_t netbsd32_time_t;
93 
94 typedef u_int32_t netbsd32_timespecp_t;
95 struct netbsd32_timespec {
96 	netbsd32_time_t	tv_sec;			/* seconds */
97 	netbsd32_long	tv_nsec;	/* and nanoseconds */
98 };
99 
100 typedef u_int32_t netbsd32_timevalp_t;
101 struct netbsd32_timeval {
102 	netbsd32_long	tv_sec;		/* seconds */
103 	netbsd32_long	tv_usec;	/* and microseconds */
104 };
105 
106 typedef u_int32_t netbsd32_timezonep_t;
107 struct netbsd32_timezone {
108 	int	tz_minuteswest;	/* minutes west of Greenwich */
109 	int	tz_dsttime;	/* type of dst correction */
110 };
111 
112 typedef u_int32_t netbsd32_itimervalp_t;
113 struct	netbsd32_itimerval {
114 	struct	netbsd32_timeval it_interval;	/* timer interval */
115 	struct	netbsd32_timeval it_value;	/* current value */
116 };
117 
118 /* from <sys/mount.h> */
119 typedef u_int32_t netbsd32_fidp_t;
120 
121 typedef u_int32_t netbsd32_fhandlep_t;
122 
123 typedef u_int32_t netbsd32_statfsp_t;
124 struct netbsd32_statfs {
125 	short	f_type;			/* type of file system */
126 	u_short	f_flags;		/* copy of mount flags */
127 	netbsd32_long	f_bsize;	/* fundamental file system block size */
128 	netbsd32_long	f_iosize;	/* optimal transfer block size */
129 	netbsd32_long	f_blocks;	/* total data blocks in file system */
130 	netbsd32_long	f_bfree;	/* free blocks in fs */
131 	netbsd32_long	f_bavail;	/* free blocks avail to non-superuser */
132 	netbsd32_long	f_files;	/* total file nodes in file system */
133 	netbsd32_long	f_ffree;	/* free file nodes in fs */
134 	fsid_t	f_fsid;			/* file system id */
135 	uid_t	f_owner;		/* user that mounted the file system */
136 	netbsd32_long	f_spare[4];	/* spare for later */
137 	char	f_fstypename[MFSNAMELEN]; /* fs type name */
138 	char	f_mntonname[MNAMELEN];	  /* directory on which mounted */
139 	char	f_mntfromname[MNAMELEN];  /* mounted file system */
140 };
141 
142 /* from <sys/poll.h> */
143 typedef u_int32_t netbsd32_pollfdp_t;
144 
145 /* from <sys/resource.h> */
146 typedef u_int32_t netbsd32_rusagep_t;
147 struct	netbsd32_rusage {
148 	struct netbsd32_timeval ru_utime;/* user time used */
149 	struct netbsd32_timeval ru_stime;/* system time used */
150 	netbsd32_long	ru_maxrss;	/* max resident set size */
151 	netbsd32_long	ru_ixrss;	/* integral shared memory size */
152 	netbsd32_long	ru_idrss;	/* integral unshared data " */
153 	netbsd32_long	ru_isrss;	/* integral unshared stack " */
154 	netbsd32_long	ru_minflt;	/* page reclaims */
155 	netbsd32_long	ru_majflt;	/* page faults */
156 	netbsd32_long	ru_nswap;	/* swaps */
157 	netbsd32_long	ru_inblock;	/* block input operations */
158 	netbsd32_long	ru_oublock;	/* block output operations */
159 	netbsd32_long	ru_msgsnd;	/* messages sent */
160 	netbsd32_long	ru_msgrcv;	/* messages received */
161 	netbsd32_long	ru_nsignals;	/* signals received */
162 	netbsd32_long	ru_nvcsw;	/* voluntary context switches */
163 	netbsd32_long	ru_nivcsw;	/* involuntary " */
164 };
165 
166 typedef u_int32_t netbsd32_orlimitp_t;
167 
168 typedef u_int32_t netbsd32_rlimitp_t;
169 
170 /* from <sys/ipc.h> */
171 typedef u_int32_t netbsd32_ipc_permp_t;
172 struct netbsd32_ipc_perm {
173 	ushort	cuid;		/* creator user id */
174 	ushort	cgid;		/* creator group id */
175 	ushort	uid;		/* user id */
176 	ushort	gid;		/* group id */
177 	ushort	mode;		/* r/w permission */
178 	ushort	_seq;		/* sequence # (to generate unique msg/sem/shm id) */
179 	netbsd32_key_t	_key;	/* user specified msg/sem/shm key */
180 };
181 struct netbsd32_ipc_perm14 {
182 	ushort	cuid;		/* creator user id */
183 	ushort	cgid;		/* creator group id */
184 	ushort	uid;		/* user id */
185 	ushort	gid;		/* group id */
186 	ushort	mode;		/* r/w permission */
187 	ushort	seq;		/* sequence # (to generate unique msg/sem/shm id) */
188 	netbsd32_key_t	key;	/* user specified msg/sem/shm key */
189 };
190 
191 /* from <sys/msg.h> */
192 typedef u_int32_t netbsd32_msgp_t;
193 struct netbsd32_msg {
194 	netbsd32_msgp_t msg_next;	/* next msg in the chain */
195 	netbsd32_long	msg_type;	/* type of this message */
196     				/* >0 -> type of this message */
197     				/* 0 -> free header */
198 	u_short	msg_ts;		/* size of this message */
199 	short	msg_spot;	/* location of start of msg in buffer */
200 };
201 
202 typedef u_int32_t netbsd32_msqid_dsp_t;
203 typedef u_int32_t netbsd32_msgqnum_t;
204 typedef netbsd32_size_t netbsd32_msglen_t;
205 
206 struct netbsd32_msqid_ds {
207 	struct netbsd32_ipc_perm	msg_perm;	/* operation permission strucure */
208 	netbsd32_msgqnum_t	msg_qnum;	/* number of messages in the queue */
209 	netbsd32_msglen_t	msg_qbytes;	/* max # of bytes in the queue */
210 	pid_t		msg_lspid;	/* process ID of last msgsend() */
211 	pid_t		msg_lrpid;	/* process ID of last msgrcv() */
212 	netbsd32_time_t		msg_stime;	/* time of last msgsend() */
213 	netbsd32_time_t		msg_rtime;	/* time of last msgrcv() */
214 	netbsd32_time_t		msg_ctime;	/* time of last change */
215 
216 	/*
217 	 * These members are private and used only in the internal
218 	 * implementation of this interface.
219 	 */
220 	netbsd32_msgp_t _msg_first;	/* first message in the queue */
221 	netbsd32_msgp_t	_msg_last;	/* last message in the queue */
222 	netbsd32_msglen_t	_msg_cbytes;	/* # of bytes currently in queue */
223 };
224 struct netbsd32_msqid_ds14 {
225 	struct	netbsd32_ipc_perm14 msg_perm;	/* msg queue permission bits */
226 	netbsd32_msgp_t	msg_first;	/* first message in the queue */
227 	netbsd32_msgp_t	msg_last;	/* last message in the queue */
228 	netbsd32_u_long	msg_cbytes;	/* number of bytes in use on the queue */
229 	netbsd32_u_long	msg_qnum;	/* number of msgs in the queue */
230 	netbsd32_u_long	msg_qbytes;	/* max # of bytes on the queue */
231 	pid_t msg_lspid;		/* pid of last msgsnd() */
232 	pid_t msg_lrpid;		/* pid of last msgrcv() */
233 	netbsd32_time_t	msg_stime;		/* time of last msgsnd() */
234 	netbsd32_long	msg_pad1;
235 	netbsd32_time_t	msg_rtime;		/* time of last msgrcv() */
236 	netbsd32_long	msg_pad2;
237 	netbsd32_time_t	msg_ctime;		/* time of last msgctl() */
238 	netbsd32_long	msg_pad3;
239 	netbsd32_long	msg_pad4[4];
240 };
241 
242 /* from <sys/sem.h> */
243 typedef u_int32_t netbsd32_semp_t;
244 
245 typedef u_int32_t netbsd32_semid_dsp_t;
246 struct netbsd32_semid_ds {
247 	struct netbsd32_ipc_perm	sem_perm;/* operation permission struct */
248 	unsigned short	sem_nsems;	/* number of sems in set */
249 	netbsd32_time_t		sem_otime;	/* last operation time */
250 	netbsd32_time_t		sem_ctime;	/* last change time */
251 
252 	/*
253 	 * These members are private and used only in the internal
254 	 * implementation of this interface.
255 	 */
256 	netbsd32_semp_t	_sem_base;	/* pointer to first semaphore in set */
257 };
258 
259 struct netbsd32_semid_ds14 {
260 	struct netbsd32_ipc_perm	sem_perm;/* operation permission struct */
261 	netbsd32_semp_t	sem_base;	/* pointer to first semaphore in set */
262 	unsigned short	sem_nsems;	/* number of sems in set */
263 	netbsd32_time_t	sem_otime;		/* last operation time */
264 	netbsd32_long	sem_pad1;	/* SVABI/386 says I need this here */
265 	netbsd32_time_t	sem_ctime;		/* last change time */
266 					/* Times measured in secs since */
267 					/* 00:00:00 GMT, Jan. 1, 1970 */
268 	netbsd32_long	sem_pad2;	/* SVABI/386 says I need this here */
269 	netbsd32_long	sem_pad3[4];	/* SVABI/386 says I need this here */
270 };
271 
272 typedef u_int32_t netbsd32_semunu_t;
273 union netbsd32_semun {
274 	int	val;		/* value for SETVAL */
275 	netbsd32_semid_dsp_t buf; /* buffer for IPC_STAT & IPC_SET */
276 	netbsd32_u_shortp array;	/* array for GETALL & SETALL */
277 };
278 
279 typedef u_int32_t netbsd32_sembufp_t;
280 struct netbsd32_sembuf {
281 	unsigned short	sem_num;	/* semaphore # */
282 	short		sem_op;		/* semaphore operation */
283 	short		sem_flg;	/* operation flags */
284 };
285 
286 /* from <sys/shm.h> */
287 typedef u_int32_t netbsd32_shmid_dsp_t;
288 struct netbsd32_shmid_ds {
289 	struct netbsd32_ipc_perm	shm_perm; /* operation permission structure */
290 	size_t		shm_segsz;	/* size of segment in bytes */
291 	pid_t		shm_lpid;	/* process ID of last shm op */
292 	pid_t		shm_cpid;	/* process ID of creator */
293 	shmatt_t	shm_nattch;	/* number of current attaches */
294 	netbsd32_time_t	shm_atime;	/* time of last shmat() */
295 	netbsd32_time_t	shm_dtime;	/* time of last shmdt() */
296 	netbsd32_time_t	shm_ctime;	/* time of last change by shmctl() */
297 	netbsd32_voidp	_shm_internal;	/* sysv stupidity */
298 };
299 
300 struct netbsd32_shmid_ds14 {
301 	struct netbsd32_ipc_perm14	shm_perm; /* operation permission structure */
302 	int		shm_segsz;	/* size of segment in bytes */
303 	pid_t		shm_lpid;	/* process ID of last shm op */
304 	pid_t		shm_cpid;	/* process ID of creator */
305 	short		shm_nattch;	/* number of current attaches */
306 	netbsd32_time_t		shm_atime;	/* time of last shmat() */
307 	netbsd32_time_t		shm_dtime;	/* time of last shmdt() */
308 	netbsd32_time_t		shm_ctime;	/* time of last change by shmctl() */
309 	netbsd32_voidp	_shm_internal;	/* sysv stupidity */
310 };
311 
312 /* from <sys/signal.h> */
313 typedef u_int32_t netbsd32_sigsetp_t;
314 typedef u_int32_t netbsd32_sigactionp_t;
315 struct	netbsd32_sigaction {
316 	netbsd32_voidp sa_handler;	/* signal handler */
317 	sigset_t sa_mask;		/* signal mask to apply */
318 	int	sa_flags;		/* see signal options below */
319 };
320 
321 typedef u_int32_t netbsd32_sigaltstack13p_t;
322 struct netbsd32_sigaltstack13 {
323 	netbsd32_charp	ss_sp;			/* signal stack base */
324 	int	ss_size;		/* signal stack length */
325 	int	ss_flags;		/* SS_DISABLE and/or SS_ONSTACK */
326 };
327 
328 typedef u_int32_t netbsd32_sigaltstackp_t;
329 struct netbsd32_sigaltstack {
330 	netbsd32_voidp	ss_sp;			/* signal stack base */
331 	netbsd32_size_t	ss_size;		/* signal stack length */
332 	int	ss_flags;		/* SS_DISABLE and/or SS_ONSTACK */
333 };
334 
335 typedef u_int32_t netbsd32_sigstackp_t;
336 struct	netbsd32_sigstack {
337 	netbsd32_voidp	ss_sp;			/* signal stack pointer */
338 	int	ss_onstack;		/* current status */
339 };
340 
341 typedef u_int32_t netbsd32_sigvecp_t;
342 struct	netbsd32_sigvec {
343 	netbsd32_voidp sv_handler;	/* signal handler */
344 	int	sv_mask;		/* signal mask to apply */
345 	int	sv_flags;		/* see signal options below */
346 };
347 
348 /* from <sys/socket.h> */
349 typedef u_int32_t netbsd32_sockaddrp_t;
350 typedef u_int32_t netbsd32_osockaddrp_t;
351 
352 typedef u_int32_t netbsd32_msghdrp_t;
353 struct netbsd32_msghdr {
354 	netbsd32_caddr_t	msg_name;		/* optional address */
355 	u_int	msg_namelen;		/* size of address */
356 	netbsd32_iovecp_t msg_iov;		/* scatter/gather array */
357 	u_int	msg_iovlen;		/* # elements in msg_iov */
358 	netbsd32_caddr_t	msg_control;		/* ancillary data, see below */
359 	u_int	msg_controllen;		/* ancillary data buffer len */
360 	int	msg_flags;		/* flags on received message */
361 };
362 
363 typedef u_int32_t netbsd32_omsghdrp_t;
364 struct netbsd32_omsghdr {
365 	netbsd32_caddr_t	msg_name;		/* optional address */
366 	int	msg_namelen;		/* size of address */
367 	netbsd32_iovecp_t msg_iov;		/* scatter/gather array */
368 	int	msg_iovlen;		/* # elements in msg_iov */
369 	netbsd32_caddr_t	msg_accrights;		/* access rights sent/received */
370 	int	msg_accrightslen;
371 };
372 
373 /* from <sys/stat.h> */
374 typedef u_int32_t netbsd32_stat12p_t;
375 struct netbsd32_stat12 {			/* NetBSD-1.2 stat struct */
376 	dev_t	  st_dev;		/* inode's device */
377 	ino_t	  st_ino;		/* inode's number */
378 	u_int16_t st_mode;		/* inode protection mode */
379 	u_int16_t st_nlink;		/* number of hard links */
380 	uid_t	  st_uid;		/* user ID of the file's owner */
381 	gid_t	  st_gid;		/* group ID of the file's group */
382 	dev_t	  st_rdev;		/* device type */
383 	struct	  netbsd32_timespec st_atimespec;/* time of last access */
384 	struct	  netbsd32_timespec st_mtimespec;/* time of last data modification */
385 	struct	  netbsd32_timespec st_ctimespec;/* time of last file status change */
386 	off_t	  st_size;		/* file size, in bytes */
387 	int64_t	  st_blocks;		/* blocks allocated for file */
388 	u_int32_t st_blksize;		/* optimal blocksize for I/O */
389 	u_int32_t st_flags;		/* user defined flags for file */
390 	u_int32_t st_gen;		/* file generation number */
391 	int32_t	  st_lspare;
392 	int64_t	  st_qspare[2];
393 };
394 
395 typedef u_int32_t netbsd32_stat43p_t;
396 struct netbsd32_stat43 {			/* BSD-4.3 stat struct */
397 	u_int16_t st_dev;		/* inode's device */
398 	ino_t	  st_ino;		/* inode's number */
399 	u_int16_t st_mode;		/* inode protection mode */
400 	u_int16_t st_nlink;		/* number of hard links */
401 	u_int16_t st_uid;		/* user ID of the file's owner */
402 	u_int16_t st_gid;		/* group ID of the file's group */
403 	u_int16_t st_rdev;		/* device type */
404 	int32_t	  st_size;		/* file size, in bytes */
405 	struct	  netbsd32_timespec st_atimespec;/* time of last access */
406 	struct	  netbsd32_timespec st_mtimespec;/* time of last data modification */
407 	struct	  netbsd32_timespec st_ctimespec;/* time of last file status change */
408 	int32_t	  st_blksize;		/* optimal blocksize for I/O */
409 	int32_t	  st_blocks;		/* blocks allocated for file */
410 	u_int32_t st_flags;		/* user defined flags for file */
411 	u_int32_t st_gen;		/* file generation number */
412 };
413 typedef u_int32_t netbsd32_statp_t;
414 struct netbsd32_stat {
415 	dev_t	  st_dev;		/* inode's device */
416 	ino_t	  st_ino;		/* inode's number */
417 	mode_t	  st_mode;		/* inode protection mode */
418 	nlink_t	  st_nlink;		/* number of hard links */
419 	uid_t	  st_uid;		/* user ID of the file's owner */
420 	gid_t	  st_gid;		/* group ID of the file's group */
421 	dev_t	  st_rdev;		/* device type */
422 	struct	  netbsd32_timespec st_atimespec;/* time of last access */
423 	struct	  netbsd32_timespec st_mtimespec;/* time of last data modification */
424 	struct	  netbsd32_timespec st_ctimespec;/* time of last file status change */
425 	off_t	  st_size;		/* file size, in bytes */
426 	blkcnt_t  st_blocks;		/* blocks allocated for file */
427 	blksize_t st_blksize;		/* optimal blocksize for I/O */
428 	u_int32_t st_flags;		/* user defined flags for file */
429 	u_int32_t st_gen;		/* file generation number */
430 	int64_t	  st_qspare[2];
431 };
432 
433 /* from <sys/timex.h> */
434 typedef u_int32_t netbsd32_ntptimevalp_t;
435 struct netbsd32_ntptimeval {
436 	struct netbsd32_timeval time;	/* current time (ro) */
437 	netbsd32_long maxerror;	/* maximum error (us) (ro) */
438 	netbsd32_long esterror;	/* estimated error (us) (ro) */
439 };
440 
441 typedef u_int32_t netbsd32_timexp_t;
442 struct netbsd32_timex {
443 	unsigned int modes;	/* clock mode bits (wo) */
444 	netbsd32_long offset;	/* time offset (us) (rw) */
445 	netbsd32_long freq;	/* frequency offset (scaled ppm) (rw) */
446 	netbsd32_long maxerror;	/* maximum error (us) (rw) */
447 	netbsd32_long esterror;	/* estimated error (us) (rw) */
448 	int status;		/* clock status bits (rw) */
449 	netbsd32_long constant;	/* pll time constant (rw) */
450 	netbsd32_long precision;	/* clock precision (us) (ro) */
451 	netbsd32_long tolerance;	/* clock frequency tolerance (scaled
452 				 * ppm) (ro) */
453 	/*
454 	 * The following read-only structure members are implemented
455 	 * only if the PPS signal discipline is configured in the
456 	 * kernel.
457 	 */
458 	netbsd32_long ppsfreq;	/* pps frequency (scaled ppm) (ro) */
459 	netbsd32_long jitter;	/* pps jitter (us) (ro) */
460 	int shift;		/* interval duration (s) (shift) (ro) */
461 	netbsd32_long stabil;	/* pps stability (scaled ppm) (ro) */
462 	netbsd32_long jitcnt;	/* jitter limit exceeded (ro) */
463 	netbsd32_long calcnt;	/* calibration intervals (ro) */
464 	netbsd32_long errcnt;	/* calibration errors (ro) */
465 	netbsd32_long stbcnt;	/* stability limit exceeded (ro) */
466 };
467 
468 /* from <ufs/lfs/lfs.h> */
469 typedef u_int32_t netbsd32_block_infop_t;  /* XXX broken */
470 
471 /* from <sys/utsname.h> */
472 typedef u_int32_t netbsd32_utsnamep_t;
473 
474 /* from <compat/common/kern_info_09.c> */
475 typedef u_int32_t netbsd32_outsnamep_t;
476 
477 /*
478  * machine depedant section; must define:
479  *	struct netbsd32_sigcontext
480  *		- 32bit compatibility sigcontext structure for this arch.
481  *	netbsd32_sigcontextp_t
482  *		- type of pointer to above, normally u_int32_t
483  *	void netbsd32_setregs(struct proc *p, struct exec_package *pack,
484  *	    u_long stack);
485  *	int netbsd32_sigreturn(struct proc *p, void *v,
486  *	    register_t *retval);
487  *	void netbsd32_sendsig(sig_t catcher, int sig, int mask, u_long code);
488  *	char netbsd32_esigcode[], netbsd32_sigcode[]
489  *		- the above are abvious
490  *
491  * pull in the netbsd32 machine dependant header, that may help with the
492  * above, or it may be provided via the MD layer itself.
493  */
494 #include <machine/netbsd32_machdep.h>
495 
496 /*
497  * here are some macros to convert between netbsd32 and sparc64 types.
498  * note that they do *NOT* act like good macros and put ()'s around all
499  * arguments cuz this _breaks_ SCARG().
500  */
501 #define NETBSD32TO64(s32uap, uap, name) \
502 	    SCARG(uap, name) = SCARG(s32uap, name)
503 #define NETBSD32TOP(s32uap, uap, name, type) \
504 	    SCARG(uap, name) = (type *)(u_long)(u_int)SCARG(s32uap, name)
505 #define NETBSD32TOX(s32uap, uap, name, type) \
506 	    SCARG(uap, name) = (type)SCARG(s32uap, name)
507 #define NETBSD32TOX64(s32uap, uap, name, type) \
508 	    SCARG(uap, name) = (type)(u_long)SCARG(s32uap, name)
509 
510 /* and some standard versions */
511 #define	NETBSD32TO64_UAP(name)		NETBSD32TO64(uap, &ua, name);
512 #define	NETBSD32TOP_UAP(name, type)	NETBSD32TOP(uap, &ua, name, type);
513 #define	NETBSD32TOX_UAP(name, type)	NETBSD32TOX(uap, &ua, name, type);
514 #define	NETBSD32TOX64_UAP(name, type)	NETBSD32TOX64(uap, &ua, name, type);
515 
516 /*
517  * random other stuff
518  */
519 #include <compat/common/compat_util.h>
520 
521 extern const char netbsd32_emul_path[];
522 
523 #define NETBSD32_CHECK_ALT_EXIST(p, sgp, path) \
524     emul_find(p, sgp, netbsd32_emul_path, (const char *)path, \
525 	(const char **)&path, 0)
526 
527 #endif /* _COMPAT_NETBSD32_NETBSD32_H_ */
528