diff options
author | dfr <dfr@FreeBSD.org> | 1998-06-07 17:13:14 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 1998-06-07 17:13:14 +0000 |
commit | 1d5f38ac2264102518a09c66a7b285f57e81e67e (patch) | |
tree | 83ce2f0e2b8041d2c933d3beffc1f4465ea5b929 /sys/i386/linux | |
parent | 83423d0e5a4ad035e44392f0427cb39232031e45 (diff) | |
download | FreeBSD-src-1d5f38ac2264102518a09c66a7b285f57e81e67e.zip FreeBSD-src-1d5f38ac2264102518a09c66a7b285f57e81e67e.tar.gz |
This commit fixes various 64bit portability problems required for
FreeBSD/alpha. The most significant item is to change the command
argument to ioctl functions from int to u_long. This change brings us
inline with various other BSD versions. Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.
The prototype FreeBSD/alpha machdep will follow in a couple of days
time.
Diffstat (limited to 'sys/i386/linux')
-rw-r--r-- | sys/i386/linux/linux_ioctl.c | 4 | ||||
-rw-r--r-- | sys/i386/linux/linux_proto.h | 339 | ||||
-rw-r--r-- | sys/i386/linux/linux_sysvec.c | 24 |
3 files changed, 186 insertions, 181 deletions
diff --git a/sys/i386/linux/linux_ioctl.c b/sys/i386/linux/linux_ioctl.c index dfe001d..ed5f751 100644 --- a/sys/i386/linux/linux_ioctl.c +++ b/sys/i386/linux/linux_ioctl.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_ioctl.c,v 1.22 1997/11/17 04:00:32 ahasty Exp $ + * $Id: linux_ioctl.c,v 1.23 1997/12/15 06:09:11 msmith Exp $ */ #include <sys/param.h> @@ -455,7 +455,7 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args) struct linux_termio linux_termio; struct filedesc *fdp = p->p_fd; struct file *fp; - int (*func)(struct file *fp, int com, caddr_t data, struct proc *p); + int (*func)(struct file *fp, u_long com, caddr_t data, struct proc *p); int bsd_line, linux_line; int error; diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h index 8fd2ed0..c5909b6 100644 --- a/sys/i386/linux/linux_proto.h +++ b/sys/i386/linux/linux_proto.h @@ -12,362 +12,365 @@ struct proc; +#define PAD_(t) sizeof(register_t) <= sizeof(t) ? \ + 0 : sizeof(register_t) - sizeof(t) + struct linux_setup_args { - int dummy; + register_t dummy; }; struct linux_fork_args { - int dummy; + register_t dummy; }; struct linux_open_args { - char * path; - int flags; - int mode; + char * path; char path_[PAD_(char *)]; + int flags; char flags_[PAD_(int)]; + int mode; char mode_[PAD_(int)]; }; struct linux_waitpid_args { - int pid; - int * status; - int options; + int pid; char pid_[PAD_(int)]; + int * status; char status_[PAD_(int *)]; + int options; char options_[PAD_(int)]; }; struct linux_creat_args { - char * path; - int mode; + char * path; char path_[PAD_(char *)]; + int mode; char mode_[PAD_(int)]; }; struct linux_unlink_args { - char * path; + char * path; char path_[PAD_(char *)]; }; struct linux_execve_args { - char * path; - char ** argp; - char ** envp; + char * path; char path_[PAD_(char *)]; + char ** argp; char argp_[PAD_(char **)]; + char ** envp; char envp_[PAD_(char **)]; }; struct linux_chdir_args { - char * path; + char * path; char path_[PAD_(char *)]; }; struct linux_time_args { - linux_time_t * tm; + linux_time_t * tm; char tm_[PAD_(linux_time_t *)]; }; struct linux_mknod_args { - char * path; - int mode; - int dev; + char * path; char path_[PAD_(char *)]; + int mode; char mode_[PAD_(int)]; + int dev; char dev_[PAD_(int)]; }; struct linux_chmod_args { - char * path; - int mode; + char * path; char path_[PAD_(char *)]; + int mode; char mode_[PAD_(int)]; }; struct linux_lchown_args { - char * path; - int uid; - int gid; + char * path; char path_[PAD_(char *)]; + int uid; char uid_[PAD_(int)]; + int gid; char gid_[PAD_(int)]; }; struct linux_break_args { - char * nsize; + char * nsize; char nsize_[PAD_(char *)]; }; struct linux_stat_args { - char * path; - struct ostat * up; + char * path; char path_[PAD_(char *)]; + struct ostat * up; char up_[PAD_(struct ostat *)]; }; struct linux_lseek_args { - int fdes; - long off; - int whence; + int fdes; char fdes_[PAD_(int)]; + long off; char off_[PAD_(long)]; + int whence; char whence_[PAD_(int)]; }; struct linux_mount_args { - int dummy; + register_t dummy; }; struct linux_umount_args { - int dummy; + register_t dummy; }; struct linux_stime_args { - int dummy; + register_t dummy; }; struct linux_ptrace_args { - int dummy; + register_t dummy; }; struct linux_alarm_args { - unsigned int secs; + unsigned int secs; char secs_[PAD_(unsigned int)]; }; struct linux_fstat_args { - int fd; - struct ostat * up; + int fd; char fd_[PAD_(int)]; + struct ostat * up; char up_[PAD_(struct ostat *)]; }; struct linux_pause_args { - int dummy; + register_t dummy; }; struct linux_utime_args { - char * fname; - struct linux_utimbuf * times; + char * fname; char fname_[PAD_(char *)]; + struct linux_utimbuf * times; char times_[PAD_(struct linux_utimbuf *)]; }; struct linux_stty_args { - int dummy; + register_t dummy; }; struct linux_gtty_args { - int dummy; + register_t dummy; }; struct linux_access_args { - char * path; - int flags; + char * path; char path_[PAD_(char *)]; + int flags; char flags_[PAD_(int)]; }; struct linux_nice_args { - int inc; + int inc; char inc_[PAD_(int)]; }; struct linux_ftime_args { - int dummy; + register_t dummy; }; struct linux_kill_args { - int pid; - int signum; + int pid; char pid_[PAD_(int)]; + int signum; char signum_[PAD_(int)]; }; struct linux_rename_args { - char * from; - char * to; + char * from; char from_[PAD_(char *)]; + char * to; char to_[PAD_(char *)]; }; struct linux_mkdir_args { - char * path; - int mode; + char * path; char path_[PAD_(char *)]; + int mode; char mode_[PAD_(int)]; }; struct linux_rmdir_args { - char * path; + char * path; char path_[PAD_(char *)]; }; struct linux_pipe_args { - int * pipefds; + int * pipefds; char pipefds_[PAD_(int *)]; }; struct linux_times_args { - struct linux_times_argv * buf; + struct linux_times_argv * buf; char buf_[PAD_(struct linux_times_argv *)]; }; struct linux_prof_args { - int dummy; + register_t dummy; }; struct linux_brk_args { - char * dsend; + char * dsend; char dsend_[PAD_(char *)]; }; struct linux_signal_args { - int sig; - linux_handler_t handler; + int sig; char sig_[PAD_(int)]; + linux_handler_t handler; char handler_[PAD_(linux_handler_t)]; }; struct linux_phys_args { - int dummy; + register_t dummy; }; struct linux_lock_args { - int dummy; + register_t dummy; }; struct linux_ioctl_args { - int fd; - u_long cmd; - int arg; + int fd; char fd_[PAD_(int)]; + u_long cmd; char cmd_[PAD_(u_long)]; + int arg; char arg_[PAD_(int)]; }; struct linux_fcntl_args { - int fd; - int cmd; - int arg; + int fd; char fd_[PAD_(int)]; + int cmd; char cmd_[PAD_(int)]; + int arg; char arg_[PAD_(int)]; }; struct linux_mpx_args { - int dummy; + register_t dummy; }; struct linux_ulimit_args { - int dummy; + register_t dummy; }; struct linux_olduname_args { - struct linux_oldold_utsname * up; + struct linux_oldold_utsname * up; char up_[PAD_(struct linux_oldold_utsname *)]; }; struct linux_ustat_args { - int dummy; + register_t dummy; }; struct linux_sigaction_args { - int sig; - struct linux_sigaction * nsa; - struct linux_sigaction * osa; + int sig; char sig_[PAD_(int)]; + struct linux_sigaction * nsa; char nsa_[PAD_(struct linux_sigaction *)]; + struct linux_sigaction * osa; char osa_[PAD_(struct linux_sigaction *)]; }; struct linux_siggetmask_args { - int dummy; + register_t dummy; }; struct linux_sigsetmask_args { - linux_sigset_t mask; + linux_sigset_t mask; char mask_[PAD_(linux_sigset_t)]; }; struct linux_sigsuspend_args { - int restart; - linux_sigset_t oldmask; - linux_sigset_t mask; + int restart; char restart_[PAD_(int)]; + linux_sigset_t oldmask; char oldmask_[PAD_(linux_sigset_t)]; + linux_sigset_t mask; char mask_[PAD_(linux_sigset_t)]; }; struct linux_sigpending_args { - linux_sigset_t * mask; + linux_sigset_t * mask; char mask_[PAD_(linux_sigset_t *)]; }; struct linux_select_args { - struct linux_select_argv * ptr; + struct linux_select_argv * ptr; char ptr_[PAD_(struct linux_select_argv *)]; }; struct linux_symlink_args { - char * path; - char * to; + char * path; char path_[PAD_(char *)]; + char * to; char to_[PAD_(char *)]; }; struct linux_readlink_args { - char * name; - char * buf; - int count; + char * name; char name_[PAD_(char *)]; + char * buf; char buf_[PAD_(char *)]; + int count; char count_[PAD_(int)]; }; struct linux_uselib_args { - char * library; + char * library; char library_[PAD_(char *)]; }; struct linux_readdir_args { - int fd; - struct linux_dirent * dent; - unsigned int count; + int fd; char fd_[PAD_(int)]; + struct linux_dirent * dent; char dent_[PAD_(struct linux_dirent *)]; + unsigned int count; char count_[PAD_(unsigned int)]; }; struct linux_mmap_args { - struct linux_mmap_argv * ptr; + struct linux_mmap_argv * ptr; char ptr_[PAD_(struct linux_mmap_argv *)]; }; struct linux_truncate_args { - char * path; - long length; + char * path; char path_[PAD_(char *)]; + long length; char length_[PAD_(long)]; }; struct linux_statfs_args { - char * path; - struct linux_statfs_buf * buf; + char * path; char path_[PAD_(char *)]; + struct linux_statfs_buf * buf; char buf_[PAD_(struct linux_statfs_buf *)]; }; struct linux_fstatfs_args { - int fd; - struct linux_statfs_buf * buf; + int fd; char fd_[PAD_(int)]; + struct linux_statfs_buf * buf; char buf_[PAD_(struct linux_statfs_buf *)]; }; struct linux_ioperm_args { - unsigned int lo; - unsigned int hi; - int val; + unsigned int lo; char lo_[PAD_(unsigned int)]; + unsigned int hi; char hi_[PAD_(unsigned int)]; + int val; char val_[PAD_(int)]; }; struct linux_socketcall_args { - int what; - void * args; + int what; char what_[PAD_(int)]; + void * args; char args_[PAD_(void *)]; }; struct linux_ksyslog_args { - int what; + int what; char what_[PAD_(int)]; }; struct linux_setitimer_args { - u_int which; - struct itimerval * itv; - struct itimerval * oitv; + u_int which; char which_[PAD_(u_int)]; + struct itimerval * itv; char itv_[PAD_(struct itimerval *)]; + struct itimerval * oitv; char oitv_[PAD_(struct itimerval *)]; }; struct linux_getitimer_args { - u_int which; - struct itimerval * itv; + u_int which; char which_[PAD_(u_int)]; + struct itimerval * itv; char itv_[PAD_(struct itimerval *)]; }; struct linux_newstat_args { - char * path; - struct linux_newstat * buf; + char * path; char path_[PAD_(char *)]; + struct linux_newstat * buf; char buf_[PAD_(struct linux_newstat *)]; }; struct linux_newlstat_args { - char * path; - struct linux_newstat * buf; + char * path; char path_[PAD_(char *)]; + struct linux_newstat * buf; char buf_[PAD_(struct linux_newstat *)]; }; struct linux_newfstat_args { - int fd; - struct linux_newstat * buf; + int fd; char fd_[PAD_(int)]; + struct linux_newstat * buf; char buf_[PAD_(struct linux_newstat *)]; }; struct linux_uname_args { - struct linux_old_utsname * up; + struct linux_old_utsname * up; char up_[PAD_(struct linux_old_utsname *)]; }; struct linux_iopl_args { - int level; + int level; char level_[PAD_(int)]; }; struct linux_vhangup_args { - int dummy; + register_t dummy; }; struct linux_idle_args { - int dummy; + register_t dummy; }; struct linux_vm86_args { - int dummy; + register_t dummy; }; struct linux_wait4_args { - int pid; - int * status; - int options; - struct rusage * rusage; + int pid; char pid_[PAD_(int)]; + int * status; char status_[PAD_(int *)]; + int options; char options_[PAD_(int)]; + struct rusage * rusage; char rusage_[PAD_(struct rusage *)]; }; struct linux_swapoff_args { - int dummy; + register_t dummy; }; struct linux_sysinfo_args { - int dummy; + register_t dummy; }; struct linux_ipc_args { - int what; - int arg1; - int arg2; - int arg3; - caddr_t ptr; + int what; char what_[PAD_(int)]; + int arg1; char arg1_[PAD_(int)]; + int arg2; char arg2_[PAD_(int)]; + int arg3; char arg3_[PAD_(int)]; + caddr_t ptr; char ptr_[PAD_(caddr_t)]; }; struct linux_sigreturn_args { - struct linux_sigcontext * scp; + struct linux_sigcontext * scp; char scp_[PAD_(struct linux_sigcontext *)]; }; struct linux_clone_args { - int dummy; + register_t dummy; }; struct linux_newuname_args { - struct linux_newuname_t * buf; + struct linux_newuname_t * buf; char buf_[PAD_(struct linux_newuname_t *)]; }; struct linux_modify_ldt_args { - int func; - void * ptr; - size_t bytecount; + int func; char func_[PAD_(int)]; + void * ptr; char ptr_[PAD_(void *)]; + size_t bytecount; char bytecount_[PAD_(size_t)]; }; struct linux_adjtimex_args { - int dummy; + register_t dummy; }; struct linux_sigprocmask_args { - int how; - linux_sigset_t * mask; - linux_sigset_t * omask; + int how; char how_[PAD_(int)]; + linux_sigset_t * mask; char mask_[PAD_(linux_sigset_t *)]; + linux_sigset_t * omask; char omask_[PAD_(linux_sigset_t *)]; }; struct linux_create_module_args { - int dummy; + register_t dummy; }; struct linux_init_module_args { - int dummy; + register_t dummy; }; struct linux_delete_module_args { - int dummy; + register_t dummy; }; struct linux_get_kernel_syms_args { - int dummy; + register_t dummy; }; struct linux_quotactl_args { - int dummy; + register_t dummy; }; struct linux_getpgid_args { - int pid; + int pid; char pid_[PAD_(int)]; }; struct linux_bdflush_args { - int dummy; + register_t dummy; }; struct linux_personality_args { - int per; + int per; char per_[PAD_(int)]; }; struct linux_llseek_args { - int fd; - u_int32_t ohigh; - u_int32_t olow; - caddr_t res; - int whence; + int fd; char fd_[PAD_(int)]; + u_int32_t ohigh; char ohigh_[PAD_(u_int32_t)]; + u_int32_t olow; char olow_[PAD_(u_int32_t)]; + caddr_t res; char res_[PAD_(caddr_t)]; + int whence; char whence_[PAD_(int)]; }; struct linux_getdents_args { - int fd; - void * dent; - unsigned count; + int fd; char fd_[PAD_(int)]; + void * dent; char dent_[PAD_(void *)]; + unsigned count; char count_[PAD_(unsigned)]; }; struct linux_newselect_args { - int nfds; - fd_set * readfds; - fd_set * writefds; - fd_set * exceptfds; - struct timeval * timeout; + int nfds; char nfds_[PAD_(int)]; + fd_set * readfds; char readfds_[PAD_(fd_set *)]; + fd_set * writefds; char writefds_[PAD_(fd_set *)]; + fd_set * exceptfds; char exceptfds_[PAD_(fd_set *)]; + struct timeval * timeout; char timeout_[PAD_(struct timeval *)]; }; struct linux_msync_args { - caddr_t addr; - int len; - int fl; + caddr_t addr; char addr_[PAD_(caddr_t)]; + int len; char len_[PAD_(int)]; + int fl; char fl_[PAD_(int)]; }; struct linux_chown_args { - char * path; - int uid; - int gid; + char * path; char path_[PAD_(char *)]; + int uid; char uid_[PAD_(int)]; + int gid; char gid_[PAD_(int)]; }; int linux_setup __P((struct proc *, struct linux_setup_args *)); int linux_fork __P((struct proc *, struct linux_fork_args *)); @@ -470,4 +473,6 @@ int linux_chown __P((struct proc *, struct linux_chown_args *)); #endif /* COMPAT_43 */ +#undef PAD_ + #endif /* !_LINUX_SYSPROTO_H_ */ diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 798d9a9..f63b9aa 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_sysvec.c,v 1.28 1998/04/28 18:15:06 eivind Exp $ + * $Id: linux_sysvec.c,v 1.29 1998/05/07 00:42:25 eivind Exp $ */ /* XXX we use functions that might not exist. */ @@ -56,9 +56,9 @@ #include <i386/linux/linux.h> #include <i386/linux/linux_proto.h> -static int linux_fixup __P((int **stack_base, +static int linux_fixup __P((long **stack_base, struct image_params *iparams)); -static int elf_linux_fixup __P((int **stack_base, +static int elf_linux_fixup __P((long **stack_base, struct image_params *iparams)); static void linux_prepsyscall __P((struct trapframe *tf, int *args, u_int *code, caddr_t *params)); @@ -119,26 +119,26 @@ translate_traps(int signal, int trap_code) } static int -linux_fixup(int **stack_base, struct image_params *imgp) +linux_fixup(long **stack_base, struct image_params *imgp) { - int *argv, *envp; + long *argv, *envp; argv = *stack_base; envp = *stack_base + (imgp->argc + 1); (*stack_base)--; - **stack_base = (int)envp; + **stack_base = (long)envp; (*stack_base)--; - **stack_base = (int)argv; + **stack_base = (long)argv; (*stack_base)--; - **stack_base = (int)imgp->argc; + **stack_base = (long)imgp->argc; return 0; } static int -elf_linux_fixup(int **stack_base, struct image_params *imgp) +elf_linux_fixup(long **stack_base, struct image_params *imgp) { Elf32_Auxargs *args = (Elf32_Auxargs *)imgp->auxargs; - int *pos; + long *pos; pos = *stack_base + (imgp->argc + imgp->envc + 2); @@ -165,7 +165,7 @@ elf_linux_fixup(int **stack_base, struct image_params *imgp) imgp->auxargs = NULL; (*stack_base)--; - **stack_base = (int)imgp->argc; + **stack_base = (long)imgp->argc; return 0; } @@ -316,7 +316,7 @@ linux_sigreturn(p, args) * It is unsafe to keep track of it ourselves, in the event that a * program jumps out of a signal handler. */ - scp = args->scp; + scp = SCARG(args,scp); if (copyin((caddr_t)scp, &context, sizeof(*scp)) != 0) return (EFAULT); |