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