Date: Mon, 16 Aug 2004 14:51:34 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 59852 for review Message-ID: <200408161451.i7GEpYpZ099476@repoman.freebsd.org>
index | next in thread | raw e-mail
http://perforce.freebsd.org/chv.cgi?CH=59852 Change 59852 by rwatson@rwatson_paprika on 2004/08/16 14:51:23 Integrate netperf_socket from FreeBSD CVS: More linux32 fixage. IA32 -> COMPAT_IA32. geom_raid3. powerpc /dev/mem. amd64 agp support. VM_KMEM_SIZE_MAX tweakage. ipfw2 ABI broken again. debug_mpsafevm to do-Giant some interesting VM pieces. Affected files ... .. //depot/projects/netperf_socket/sys/alpha/linux/linux.h#2 integrate .. //depot/projects/netperf_socket/sys/amd64/amd64/exception.S#5 integrate .. //depot/projects/netperf_socket/sys/amd64/conf/GENERIC#14 integrate .. //depot/projects/netperf_socket/sys/amd64/conf/NOTES#8 integrate .. //depot/projects/netperf_socket/sys/amd64/linux32/Makefile#1 branch .. //depot/projects/netperf_socket/sys/amd64/linux32/linux.h#1 branch .. //depot/projects/netperf_socket/sys/amd64/linux32/linux32_dummy.c#1 branch .. //depot/projects/netperf_socket/sys/amd64/linux32/linux32_genassym.c#1 branch .. //depot/projects/netperf_socket/sys/amd64/linux32/linux32_ipc64.h#1 branch .. //depot/projects/netperf_socket/sys/amd64/linux32/linux32_locore.s#1 branch .. //depot/projects/netperf_socket/sys/amd64/linux32/linux32_machdep.c#1 branch .. //depot/projects/netperf_socket/sys/amd64/linux32/linux32_proto.h#1 branch .. //depot/projects/netperf_socket/sys/amd64/linux32/linux32_syscall.h#1 branch .. //depot/projects/netperf_socket/sys/amd64/linux32/linux32_sysent.c#1 branch .. //depot/projects/netperf_socket/sys/amd64/linux32/linux32_sysvec.c#1 branch .. //depot/projects/netperf_socket/sys/amd64/linux32/syscalls.conf#1 branch .. //depot/projects/netperf_socket/sys/amd64/linux32/syscalls.master#1 branch .. //depot/projects/netperf_socket/sys/compat/linprocfs/linprocfs.c#4 integrate .. //depot/projects/netperf_socket/sys/compat/linux/linux_file.c#4 integrate .. //depot/projects/netperf_socket/sys/compat/linux/linux_getcwd.c#2 integrate .. //depot/projects/netperf_socket/sys/compat/linux/linux_ioctl.c#6 integrate .. //depot/projects/netperf_socket/sys/compat/linux/linux_ipc.c#2 integrate .. //depot/projects/netperf_socket/sys/compat/linux/linux_ipc.h#2 integrate .. //depot/projects/netperf_socket/sys/compat/linux/linux_mib.c#2 integrate .. //depot/projects/netperf_socket/sys/compat/linux/linux_misc.c#7 integrate .. //depot/projects/netperf_socket/sys/compat/linux/linux_signal.c#2 integrate .. //depot/projects/netperf_socket/sys/compat/linux/linux_socket.c#5 integrate .. //depot/projects/netperf_socket/sys/compat/linux/linux_stats.c#6 integrate .. //depot/projects/netperf_socket/sys/compat/linux/linux_sysctl.c#2 integrate .. //depot/projects/netperf_socket/sys/compat/linux/linux_uid16.c#4 integrate .. //depot/projects/netperf_socket/sys/conf/NOTES#36 integrate .. //depot/projects/netperf_socket/sys/conf/files#47 integrate .. //depot/projects/netperf_socket/sys/conf/files.amd64#15 integrate .. //depot/projects/netperf_socket/sys/conf/files.i386#27 integrate .. //depot/projects/netperf_socket/sys/conf/files.pc98#15 integrate .. //depot/projects/netperf_socket/sys/conf/files.powerpc#7 integrate .. //depot/projects/netperf_socket/sys/conf/options#25 integrate .. //depot/projects/netperf_socket/sys/conf/options.amd64#6 integrate .. //depot/projects/netperf_socket/sys/conf/options.i386#5 integrate .. //depot/projects/netperf_socket/sys/conf/options.pc98#5 integrate .. //depot/projects/netperf_socket/sys/dev/ata/ata-all.c#15 integrate .. //depot/projects/netperf_socket/sys/dev/ata/ata-chipset.c#16 integrate .. //depot/projects/netperf_socket/sys/dev/ata/ata-lowlevel.c#15 integrate .. //depot/projects/netperf_socket/sys/dev/ata/ata-queue.c#11 integrate .. //depot/projects/netperf_socket/sys/dev/cp/cpddk.c#2 integrate .. //depot/projects/netperf_socket/sys/dev/cp/cpddk.h#2 integrate .. //depot/projects/netperf_socket/sys/dev/pccbb/pccbb_isa.c#2 integrate .. //depot/projects/netperf_socket/sys/dev/pccbb/pccbb_pci.c#2 integrate .. //depot/projects/netperf_socket/sys/geom/raid3/g_raid3.c#1 branch .. //depot/projects/netperf_socket/sys/geom/raid3/g_raid3.h#1 branch .. //depot/projects/netperf_socket/sys/geom/raid3/g_raid3_ctl.c#1 branch .. //depot/projects/netperf_socket/sys/i386/conf/NOTES#25 integrate .. //depot/projects/netperf_socket/sys/i386/include/vmparam.h#3 integrate .. //depot/projects/netperf_socket/sys/i386/linux/linux.h#2 integrate .. //depot/projects/netperf_socket/sys/kern/vfs_subr.c#21 integrate .. //depot/projects/netperf_socket/sys/modules/Makefile#17 integrate .. //depot/projects/netperf_socket/sys/modules/agp/Makefile#2 integrate .. //depot/projects/netperf_socket/sys/modules/geom/Makefile#9 integrate .. //depot/projects/netperf_socket/sys/modules/geom/geom_raid3/Makefile#1 branch .. //depot/projects/netperf_socket/sys/netinet/ip_fw.h#8 integrate .. //depot/projects/netperf_socket/sys/pci/agp.c#8 integrate .. //depot/projects/netperf_socket/sys/pci/agp_amd.c#6 integrate .. //depot/projects/netperf_socket/sys/pci/agp_amd64.c#1 branch .. //depot/projects/netperf_socket/sys/pci/agp_sis.c#5 integrate .. //depot/projects/netperf_socket/sys/pci/agp_via.c#7 integrate .. //depot/projects/netperf_socket/sys/pci/agpreg.h#5 integrate .. //depot/projects/netperf_socket/sys/powerpc/conf/GENERIC#9 integrate .. //depot/projects/netperf_socket/sys/powerpc/include/memdev.h#1 branch .. //depot/projects/netperf_socket/sys/powerpc/include/ofw_machdep.h#2 integrate .. //depot/projects/netperf_socket/sys/powerpc/include/pmap.h#6 integrate .. //depot/projects/netperf_socket/sys/powerpc/ofw/ofw_syscons.c#4 integrate .. //depot/projects/netperf_socket/sys/powerpc/powerpc/mem.c#1 branch .. //depot/projects/netperf_socket/sys/powerpc/powerpc/ofw_machdep.c#2 integrate .. //depot/projects/netperf_socket/sys/powerpc/powerpc/pmap.c#14 integrate .. //depot/projects/netperf_socket/sys/ufs/ufs/ufs_dirhash.c#3 integrate .. //depot/projects/netperf_socket/sys/vm/vm.h#3 integrate .. //depot/projects/netperf_socket/sys/vm/vm_fault.c#7 integrate .. //depot/projects/netperf_socket/sys/vm/vm_map.c#22 integrate .. //depot/projects/netperf_socket/sys/vm/vm_meter.c#3 integrate Differences ... ==== //depot/projects/netperf_socket/sys/alpha/linux/linux.h#2 (text+ko) ==== @@ -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. * - * $FreeBSD: src/sys/alpha/linux/linux.h,v 1.58 2003/04/16 20:04:47 jhb Exp $ + * $FreeBSD: src/sys/alpha/linux/linux.h,v 1.59 2004/08/16 07:05:44 tjr Exp $ */ #ifndef _ALPHA_LINUX_LINUX_H_ @@ -45,6 +45,9 @@ MALLOC_DECLARE(M_LINUX); #endif +#define PTRIN(v) (void *)(v) +#define PTROUT(v) (l_uintptr_t)(v) + typedef int l_int; typedef int64_t l_long; typedef int64_t l_longlong; @@ -55,6 +58,7 @@ typedef unsigned short l_ushort; typedef char *l_caddr_t; +typedef l_ulong l_uintptr_t; typedef l_long l_clock_t; typedef l_int l_daddr_t; typedef l_uint l_dev_t; ==== //depot/projects/netperf_socket/sys/amd64/amd64/exception.S#5 (text+ko) ==== @@ -27,11 +27,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/amd64/amd64/exception.S,v 1.119 2004/05/24 12:42:16 bde Exp $ + * $FreeBSD: src/sys/amd64/amd64/exception.S,v 1.120 2004/08/16 12:51:32 obrien Exp $ */ #include "opt_atpic.h" -#include "opt_ia32.h" +#include "opt_compat.h" #include <machine/asmacros.h> #include <machine/psl.h> @@ -307,7 +307,7 @@ * included. */ -#ifdef IA32 +#ifdef COMPAT_IA32 .data .p2align 4 .text ==== //depot/projects/netperf_socket/sys/amd64/conf/GENERIC#14 (text+ko) ==== @@ -16,7 +16,7 @@ # If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # -# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.419 2004/08/03 19:24:52 markm Exp $ +# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.420 2004/08/16 12:51:32 obrien Exp $ machine amd64 cpu HAMMER @@ -44,7 +44,7 @@ options PROCFS # Process filesystem (requires PSEUDOFS) options PSEUDOFS # Pseudo-filesystem framework options GEOM_GPT # GUID Partition Tables. -options IA32 # Compatible with i386 binaries +options COMPAT_IA32 # Compatible with i386 binaries options COMPAT_FREEBSD4 # Compatible with FreeBSD4 options SCSI_DELAY=15000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support ==== //depot/projects/netperf_socket/sys/amd64/conf/NOTES#8 (text+ko) ==== @@ -4,7 +4,7 @@ # This file contains machine dependent kernel configuration notes. For # machine independent notes, look in /sys/conf/NOTES. # -# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.15 2004/08/01 11:40:51 markm Exp $ +# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.18 2004/08/16 12:39:27 tjr Exp $ # # @@ -456,6 +456,9 @@ #XXX keep these here for now and reactivate when support for emulating #XXX these 32 bit binaries is added. +# Enable 32-bit runtime support for FreeBSD/i386 binaries. +options COMPAT_IA32 + # Enable iBCS2 runtime support for SCO and ISC binaries #XXX#options IBCS2 @@ -465,9 +468,12 @@ # Enable Linux ABI emulation #XXX#options COMPAT_LINUX -# Enable the linux-like proc filesystem support (requires COMPAT_LINUX +# Enable 32-bit Linux ABI emulation (requires COMPAT_43 and IA32) +options COMPAT_LINUX32 + +# Enable the linux-like proc filesystem support (requires COMPAT_LINUX32 # and PSEUDOFS) -#XXX#options LINPROCFS +options LINPROCFS # # SysVR4 ABI emulation ==== //depot/projects/netperf_socket/sys/compat/linprocfs/linprocfs.c#4 (text+ko) ==== @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.83 2004/04/01 00:04:22 pjd Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.84 2004/08/16 08:19:18 tjr Exp $"); #include <sys/param.h> #include <sys/queue.h> @@ -86,12 +86,17 @@ extern int ncpus; #endif /* __alpha__ */ -#ifdef __i386__ +#if defined(__i386__) || defined(__amd64__) #include <machine/cputypes.h> #include <machine/md_var.h> -#endif /* __i386__ */ +#endif /* __i386__ || __amd64__ */ +#include "opt_compat.h" +#if !COMPAT_LINUX32 /* XXX */ #include <machine/../linux/linux.h> +#else +#include <machine/../linux32/linux.h> +#endif #include <compat/linux/linux_ioctl.h> #include <compat/linux/linux_mib.h> #include <compat/linux/linux_util.h> @@ -251,9 +256,9 @@ } #endif /* __alpha__ */ -#ifdef __i386__ +#if defined(__i386__) || defined(__amd64__) /* - * Filler function for proc/cpuinfo (i386 version) + * Filler function for proc/cpuinfo (i386 & amd64 version) */ static int linprocfs_docpuinfo(PFS_FILL_ARGS) @@ -276,6 +281,7 @@ }; switch (cpu_class) { +#ifdef __i386__ case CPUCLASS_286: class = 2; break; @@ -294,6 +300,11 @@ default: class = 0; break; +#else + default: + class = 6; + break; +#endif } for (i = 0; i < mp_ncpus; ++i) { @@ -331,7 +342,7 @@ return (0); } -#endif /* __i386__ */ +#endif /* __i386__ || __amd64__ */ /* * Filler function for proc/mtab ==== //depot/projects/netperf_socket/sys/compat/linux/linux_file.c#4 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_file.c,v 1.86 2004/07/27 21:38:42 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_file.c,v 1.87 2004/08/16 07:28:16 tjr Exp $"); #include "opt_compat.h" #include "opt_mac.h" @@ -54,8 +54,15 @@ #include <ufs/ufs/quota.h> #include <ufs/ufs/ufsmount.h> +#include "opt_compat.h" + +#if !COMPAT_LINUX32 #include <machine/../linux/linux.h> #include <machine/../linux/linux_proto.h> +#else +#include <machine/../linux32/linux.h> +#include <machine/../linux32/linux32_proto.h> +#endif #include <compat/linux/linux_util.h> #ifndef __alpha__ @@ -827,7 +834,11 @@ l_off_t l_start; l_off_t l_len; l_pid_t l_pid; -}; +} +#if __amd64__ && COMPAT_LINUX32 +__packed +#endif +; static void linux_to_bsd_flock(struct l_flock *linux_flock, struct flock *bsd_flock) @@ -872,14 +883,18 @@ linux_flock->l_pid = (l_pid_t)bsd_flock->l_pid; } -#if defined(__i386__) +#if defined(__i386__) || (defined(__amd64__) && COMPAT_LINUX32) struct l_flock64 { l_short l_type; l_short l_whence; l_loff_t l_start; l_loff_t l_len; l_pid_t l_pid; -}; +} +#if __amd64__ && COMPAT_LINUX32 +__packed +#endif +; static void linux_to_bsd_flock64(struct l_flock64 *linux_flock, struct flock *bsd_flock) @@ -923,7 +938,7 @@ linux_flock->l_len = (l_loff_t)bsd_flock->l_len; linux_flock->l_pid = (l_pid_t)bsd_flock->l_pid; } -#endif /* __i386__ */ +#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ #if defined(__alpha__) #define linux_fcntl64_args linux_fcntl_args @@ -1051,7 +1066,7 @@ return (fcntl_common(td, &args64)); } -#if defined(__i386__) +#if defined(__i386__) || (defined(__amd64__) && COMPAT_LINUX32) int linux_fcntl64(struct thread *td, struct linux_fcntl64_args *args) { @@ -1099,7 +1114,7 @@ return (fcntl_common(td, args)); } -#endif /* __i386__ */ +#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ int linux_chown(struct thread *td, struct linux_chown_args *args) ==== //depot/projects/netperf_socket/sys/compat/linux/linux_getcwd.c#2 (text+ko) ==== @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_getcwd.c,v 1.14 2003/11/17 18:57:20 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_getcwd.c,v 1.15 2004/08/16 07:28:16 tjr Exp $"); #include "opt_compat.h" #include "opt_mac.h" @@ -59,8 +59,15 @@ #include <sys/dirent.h> #include <ufs/ufs/dir.h> /* XXX only for DIRBLKSIZ */ +#include "opt_compat.h" + +#if !COMPAT_LINUX32 #include <machine/../linux/linux.h> #include <machine/../linux/linux_proto.h> +#else +#include <machine/../linux32/linux.h> +#include <machine/../linux32/linux32_proto.h> +#endif #include <compat/linux/linux_util.h> static int ==== //depot/projects/netperf_socket/sys/compat/linux/linux_ioctl.c#6 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_ioctl.c,v 1.120 2004/07/02 15:31:44 netchild Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_ioctl.c,v 1.121 2004/08/16 07:28:16 tjr Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -56,8 +56,15 @@ #include <net/if_dl.h> #include <net/if_types.h> +#include "opt_compat.h" + +#if !COMPAT_LINUX32 #include <machine/../linux/linux.h> #include <machine/../linux/linux_proto.h> +#else +#include <machine/../linux32/linux.h> +#include <machine/../linux32/linux32_proto.h> +#endif #include <compat/linux/linux_ioctl.h> #include <compat/linux/linux_mib.h> @@ -2081,7 +2088,11 @@ static int linux_ifconf(struct thread *td, struct ifconf *uifc) { +#if COMPAT_LINUX32 + struct l_ifconf ifc; +#else struct ifconf ifc; +#endif struct l_ifreq ifr; struct ifnet *ifp; struct ifaddr *ifa; @@ -2094,7 +2105,7 @@ return (error); /* handle the 'request buffer size' case */ - if (ifc.ifc_buf == NULL) { + if (ifc.ifc_buf == PTROUT(NULL)) { ifc.ifc_len = 0; TAILQ_FOREACH(ifp, &ifnet, if_link) { TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { @@ -2108,7 +2119,7 @@ } /* much easier to use uiomove than keep track ourselves */ - iov.iov_base = ifc.ifc_buf; + iov.iov_base = PTRIN(ifc.ifc_buf); iov.iov_len = ifc.ifc_len; uio.uio_iov = &iov; uio.uio_iovcnt = 1; ==== //depot/projects/netperf_socket/sys/compat/linux/linux_ipc.c#2 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_ipc.c,v 1.38 2003/11/05 01:53:10 fjoe Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_ipc.c,v 1.39 2004/08/16 07:28:16 tjr Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -39,9 +39,17 @@ #include <sys/sem.h> #include <sys/shm.h> +#include "opt_compat.h" + +#if !COMPAT_LINUX32 #include <machine/../linux/linux.h> #include <machine/../linux/linux_proto.h> #include <machine/../linux/linux_ipc64.h> +#else +#include <machine/../linux32/linux.h> +#include <machine/../linux32/linux32_proto.h> +#include <machine/../linux32/linux32_ipc64.h> +#endif #include <compat/linux/linux_ipc.h> #include <compat/linux/linux_util.h> @@ -133,8 +141,8 @@ struct l_msqid_ds { struct l_ipc_perm msg_perm; - struct l_msg *msg_first; /* first message on queue,unused */ - struct l_msg *msg_last; /* last message in queue,unused */ + l_uintptr_t msg_first; /* first message on queue,unused */ + l_uintptr_t msg_last; /* last message in queue,unused */ l_time_t msg_stime; /* last msgsnd time */ l_time_t msg_rtime; /* last msgrcv time */ l_time_t msg_ctime; /* last change time */ @@ -145,18 +153,26 @@ l_ushort msg_qbytes; /* max number of bytes on queue */ l_pid_t msg_lspid; /* pid of last msgsnd */ l_pid_t msg_lrpid; /* last receive pid */ -}; +} +#if __amd64__ && COMPAT_LINUX32 +__packed +#endif +; struct l_semid_ds { struct l_ipc_perm sem_perm; l_time_t sem_otime; l_time_t sem_ctime; - void *sem_base; - void *sem_pending; - void *sem_pending_last; - void *undo; + l_uintptr_t sem_base; + l_uintptr_t sem_pending; + l_uintptr_t sem_pending_last; + l_uintptr_t undo; l_ushort sem_nsems; -}; +} +#if __amd64__ && COMPAT_LINUX32 +__packed +#endif +; struct l_shmid_ds { struct l_ipc_perm shm_perm; @@ -168,8 +184,8 @@ l_ushort shm_lpid; l_short shm_nattch; l_ushort private1; - void *private2; - void *private3; + l_uintptr_t private2; + l_uintptr_t private3; }; static void @@ -179,7 +195,7 @@ bsp->sem_otime = lsp->sem_otime; bsp->sem_ctime = lsp->sem_ctime; bsp->sem_nsems = lsp->sem_nsems; - bsp->sem_base = lsp->sem_base; + bsp->sem_base = PTRIN(lsp->sem_base); } static void @@ -189,7 +205,7 @@ lsp->sem_otime = bsp->sem_otime; lsp->sem_ctime = bsp->sem_ctime; lsp->sem_nsems = bsp->sem_nsems; - lsp->sem_base = bsp->sem_base; + lsp->sem_base = PTROUT(bsp->sem_base); } static void @@ -203,7 +219,8 @@ bsp->shm_atime = lsp->shm_atime; bsp->shm_dtime = lsp->shm_dtime; bsp->shm_ctime = lsp->shm_ctime; - bsp->shm_internal = lsp->private3; /* this goes (yet) SOS */ + /* this goes (yet) SOS */ + bsp->shm_internal = PTRIN(lsp->private3); } static void @@ -217,7 +234,8 @@ lsp->shm_atime = bsp->shm_atime; lsp->shm_dtime = bsp->shm_dtime; lsp->shm_ctime = bsp->shm_ctime; - lsp->private3 = bsp->shm_internal; /* this goes (yet) SOS */ + /* this goes (yet) SOS */ + lsp->private3 = PTROUT(bsp->shm_internal); } static void @@ -447,7 +465,7 @@ } */ bsd_args; bsd_args.semid = args->semid; - bsd_args.sops = (struct sembuf *)args->tsops; + bsd_args.sops = (struct sembuf *)PTRIN(args->tsops); bsd_args.nsops = args->nsops; return semop(td, &bsd_args); } @@ -516,7 +534,7 @@ case LINUX_IPC_SET: bsd_args.cmd = IPC_SET; error = linux_semid_pullup(args->cmd & LINUX_IPC_64, - &linux_semid, (caddr_t)args->arg.buf); + &linux_semid, (caddr_t)PTRIN(args->arg.buf)); if (error) return (error); unptr->buf = stackgap_alloc(&sg, sizeof(struct semid_ds)); @@ -536,7 +554,7 @@ unptr->buf->sem_perm); bsd_to_linux_semid_ds(unptr->buf, &linux_semid); return (linux_semid_pushdown(args->cmd & LINUX_IPC_64, - &linux_semid, (caddr_t)args->arg.buf)); + &linux_semid, (caddr_t)PTRIN(args->arg.buf))); case LINUX_IPC_INFO: case LINUX_SEM_INFO: bcopy(&seminfo, &linux_seminfo, sizeof(linux_seminfo) ); @@ -546,8 +564,8 @@ linux_seminfo.semusz = used_semids; linux_seminfo.semaem = used_sems; */ - error = copyout(&linux_seminfo, args->arg.buf, - sizeof(linux_seminfo)); + error = copyout(&linux_seminfo, + PTRIN(args->arg.buf), sizeof(linux_seminfo)); if (error) return error; td->td_retval[0] = seminfo.semmni; @@ -575,7 +593,7 @@ } */ bsd_args; bsd_args.msqid = args->msqid; - bsd_args.msgp = args->msgp; + bsd_args.msgp = PTRIN(args->msgp); bsd_args.msgsz = args->msgsz; bsd_args.msgflg = args->msgflg; return msgsnd(td, &bsd_args); @@ -593,7 +611,7 @@ } */ bsd_args; bsd_args.msqid = args->msqid; - bsd_args.msgp = args->msgp; + bsd_args.msgp = PTRIN(args->msgp); bsd_args.msgsz = args->msgsz; bsd_args.msgtyp = args->msgtyp; bsd_args.msgflg = args->msgflg; @@ -626,7 +644,7 @@ caddr_t sg = stackgap_init(); error = linux_msqid_pullup(args->cmd & LINUX_IPC_64, - &linux_msqid, (caddr_t)args->buf); + &linux_msqid, (caddr_t)PTRIN(args->buf)); if (error != 0) return (error); bsd_args.buf = (struct msqid_ds*)stackgap_alloc(&sg, @@ -644,7 +662,7 @@ if (bsd_args.cmd == LINUX_IPC_STAT) { bsd_to_linux_msqid_ds(bsd_args.buf, &linux_msqid); return (linux_msqid_pushdown(args->cmd & LINUX_IPC_64, - &linux_msqid, (caddr_t)args->buf)); + &linux_msqid, (caddr_t)PTRIN(args->buf))); } return (0); @@ -659,14 +677,18 @@ int shmflg; } */ bsd_args; int error; +#if defined(__i386__) || (defined(__amd64__) && COMPAT_LINUX32) + l_uintptr_t addr; +#endif bsd_args.shmid = args->shmid; - bsd_args.shmaddr = args->shmaddr; + bsd_args.shmaddr = PTRIN(args->shmaddr); bsd_args.shmflg = args->shmflg; if ((error = shmat(td, &bsd_args))) return error; -#ifdef __i386__ - if ((error = copyout(td->td_retval, args->raddr, sizeof(l_ulong)))) +#if defined(__i386__) || (defined(__amd64__) && COMPAT_LINUX32) + addr = td->td_retval[0]; + if ((error = copyout(&addr, PTRIN(args->raddr), sizeof(addr)))) return error; td->td_retval[0] = 0; #endif @@ -680,7 +702,7 @@ void *shmaddr; } */ bsd_args; - bsd_args.shmaddr = args->shmaddr; + bsd_args.shmaddr = PTRIN(args->shmaddr); return shmdt(td, &bsd_args); } @@ -723,7 +745,7 @@ bsd_to_linux_shminfo(&bsd_shminfo, &linux_shminfo); return (linux_shminfo_pushdown(args->cmd & LINUX_IPC_64, - &linux_shminfo, (caddr_t)args->buf)); + &linux_shminfo, (caddr_t)PTRIN(args->buf))); } case LINUX_SHM_INFO: { @@ -737,7 +759,7 @@ bsd_to_linux_shm_info(&bsd_shm_info, &linux_shm_info); - return copyout(&linux_shm_info, (caddr_t)args->buf, + return copyout(&linux_shm_info, (caddr_t)PTRIN(args->buf), sizeof(struct l_shm_info)); } @@ -751,7 +773,7 @@ bsd_to_linux_shmid_ds(&bsd_shmid, &linux_shmid); return (linux_shmid_pushdown(args->cmd & LINUX_IPC_64, - &linux_shmid, (caddr_t)args->buf)); + &linux_shmid, (caddr_t)PTRIN(args->buf))); case LINUX_SHM_STAT: /* Perform shmctl wanting removed segments lookup */ @@ -763,11 +785,11 @@ bsd_to_linux_shmid_ds(&bsd_shmid, &linux_shmid); return (linux_shmid_pushdown(args->cmd & LINUX_IPC_64, - &linux_shmid, (caddr_t)args->buf)); + &linux_shmid, (caddr_t)PTRIN(args->buf))); case LINUX_IPC_SET: error = linux_shmid_pullup(args->cmd & LINUX_IPC_64, - &linux_shmid, (caddr_t)args->buf); + &linux_shmid, (caddr_t)PTRIN(args->buf)); if (error) return error; @@ -780,11 +802,11 @@ case LINUX_IPC_RMID: { void *buf; - if (args->buf == NULL) + if (args->buf == 0) buf = NULL; else { error = linux_shmid_pullup(args->cmd & LINUX_IPC_64, - &linux_shmid, (caddr_t)args->buf); + &linux_shmid, (caddr_t)PTRIN(args->buf)); if (error) return error; linux_to_bsd_shmid_ds(&linux_shmid, &bsd_shmid); ==== //depot/projects/netperf_socket/sys/compat/linux/linux_ipc.h#2 (text+ko) ==== @@ -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. * - * $FreeBSD: src/sys/compat/linux/linux_ipc.h,v 1.9 2002/10/11 11:43:08 sobomax Exp $ + * $FreeBSD: src/sys/compat/linux/linux_ipc.h,v 1.10 2004/08/16 07:28:16 tjr Exp $ */ #ifndef _LINUX_IPC_H_ @@ -40,7 +40,7 @@ #define LINUX_IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger message sizes, etc. */ -#ifdef __i386__ +#if defined(__i386__) || defined(__amd64__) struct linux_msgctl_args { @@ -135,6 +135,6 @@ int linux_shmdt(struct thread *, struct linux_shmdt_args *); int linux_shmget(struct thread *, struct linux_shmget_args *); -#endif /* __i386__ */ +#endif /* __i386__ || __amd64__ */ #endif /* _LINUX_IPC_H_ */ ==== //depot/projects/netperf_socket/sys/compat/linux/linux_mib.c#2 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_mib.c,v 1.21 2003/06/10 21:27:39 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_mib.c,v 1.22 2004/08/16 07:28:16 tjr Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -39,7 +39,13 @@ #include <sys/lock.h> #include <sys/mutex.h> +#include "opt_compat.h" + +#if !COMPAT_LINUX32 #include <machine/../linux/linux.h> +#else +#include <machine/../linux32/linux.h> +#endif #include <compat/linux/linux_mib.h> struct linux_prison { ==== //depot/projects/netperf_socket/sys/compat/linux/linux_misc.c#7 (text+ko) ==== @@ -28,14 +28,16 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.157 2004/08/15 12:34:15 tjr Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.160 2004/08/16 11:12:57 obrien Exp $"); #include "opt_mac.h" #include <sys/param.h> #include <sys/blist.h> #include <sys/fcntl.h> +#if defined(__i386__) || defined(__alpha__) #include <sys/imgact_aout.h> +#endif #include <sys/jail.h> #include <sys/kernel.h> #include <sys/limits.h> @@ -70,8 +72,15 @@ #include <posix4/sched.h> +#include "opt_compat.h" + +#if !COMPAT_LINUX32 #include <machine/../linux/linux.h> #include <machine/../linux/linux_proto.h> +#else +#include <machine/../linux32/linux.h> +#include <machine/../linux32/linux32_proto.h> +#endif #include <compat/linux/linux_mib.h> #include <compat/linux/linux_util.h> @@ -224,7 +233,7 @@ #ifdef DEBUG if (ldebug(brk)) - printf(ARGS(brk, "%p"), (void *)args->dsend); + printf(ARGS(brk, "%p"), (void *)(uintptr_t)args->dsend); #endif old = (vm_offset_t)vm->vm_daddr + ctob(vm->vm_dsize); new = (vm_offset_t)args->dsend; @@ -237,6 +246,8 @@ return 0; } +#if defined(__i386__) || defined(__alpha__) + int linux_uselib(struct thread *td, struct linux_uselib_args *args) { @@ -427,7 +438,7 @@ goto cleanup; /* copy from kernel VM space to user space */ - error = copyout((void *)(uintptr_t)(buffer + file_offset), + error = copyout(PTRIN(buffer + file_offset), (void *)vmaddr, a_out->a_text + a_out->a_data); /* release temporary kernel space */ @@ -485,6 +496,8 @@ return error; } +#endif /* __i386__ || __alpha__ */ + int linux_select(struct thread *td, struct linux_select_args *args) { @@ -596,7 +609,7 @@ #ifdef DEBUG if (ldebug(mremap)) printf(ARGS(mremap, "%p, %08lx, %08lx, %08lx"), - (void *)args->addr, + (void *)(uintptr_t)args->addr, (unsigned long)args->old_len, (unsigned long)args->new_len, (unsigned long)args->flags); @@ -610,7 +623,8 @@ } if (args->new_len < args->old_len) { - bsd_args.addr = (caddr_t)(args->addr + args->new_len); + bsd_args.addr = + (caddr_t)((uintptr_t)args->addr + args->new_len); bsd_args.len = args->old_len - args->new_len; error = munmap(td, &bsd_args); } @@ -628,8 +642,8 @@ { struct msync_args bsd_args; - bsd_args.addr = (caddr_t)args->addr; - bsd_args.len = args->len; + bsd_args.addr = (caddr_t)(uintptr_t)args->addr; + bsd_args.len = (uintptr_t)args->len; bsd_args.flags = args->fl & ~LINUX_MS_SYNC; return msync(td, &bsd_args); @@ -755,7 +769,7 @@ return (copyout(&utsname, args->buf, sizeof(utsname))); } -#if defined(__i386__) +#if defined(__i386__) || (defined(__amd64__) && COMPAT_LINUX32) struct l_utimbuf { l_time_t l_actime; l_time_t l_modtime; @@ -793,7 +807,7 @@ LFREEPATH(fname); return (error); } -#endif /* __i386__ */ +#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ #define __WCLONE 0x80000000 @@ -935,7 +949,7 @@ #ifdef DEBUG if (ldebug(setitimer)) printf(ARGS(setitimer, "%p, %p"), - (void *)args->itv, (void *)args->oitv); + (void *)uap->itv, (void *)uap->oitv); #endif lp = uap->itv; if (lp != NULL) { @@ -993,7 +1007,7 @@ #ifdef DEBUG if (ldebug(getitimer)) - printf(ARGS(getitimer, "%p"), (void *)args->itv); + printf(ARGS(getitimer, "%p"), (void *)uap->itv); #endif lp = uap->itv; if (lp != NULL) { @@ -1179,12 +1193,21 @@ lim_rlimit(p, which, &bsd_rlim); PROC_UNLOCK(p); +#if !COMPAT_LINUX32 rlim.rlim_cur = (unsigned long)bsd_rlim.rlim_cur; if (rlim.rlim_cur == ULONG_MAX) rlim.rlim_cur = LONG_MAX; rlim.rlim_max = (unsigned long)bsd_rlim.rlim_max; if (rlim.rlim_max == ULONG_MAX) rlim.rlim_max = LONG_MAX; +#else + rlim.rlim_cur = (unsigned int)bsd_rlim.rlim_cur; + if (rlim.rlim_cur == UINT_MAX) + rlim.rlim_cur = INT_MAX; + rlim.rlim_max = (unsigned int)bsd_rlim.rlim_max; + if (rlim.rlim_max == UINT_MAX) + rlim.rlim_max = INT_MAX; +#endif return (copyout(&rlim, args->rlim, sizeof(rlim))); } ==== //depot/projects/netperf_socket/sys/compat/linux/linux_signal.c#2 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_signal.c,v 1.45 2003/06/10 21:27:39 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_signal.c,v 1.47 2004/08/16 12:15:07 obrien Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -38,8 +38,15 @@ #include <sys/syscallsubr.h> #include <sys/sysproto.h> +#include "opt_compat.h" + +#if !COMPAT_LINUX32 #include <machine/../linux/linux.h> #include <machine/../linux/linux_proto.h> +#else +#include <machine/../linux32/linux.h> +#include <machine/../linux32/linux32_proto.h> +#endif #include <compat/linux/linux_signal.h> #include <compat/linux/linux_util.h> @@ -90,7 +97,7 @@ { linux_to_bsd_sigset(&lsa->lsa_mask, &bsa->sa_mask); - bsa->sa_handler = lsa->lsa_handler; + bsa->sa_handler = PTRIN(lsa->lsa_handler); bsa->sa_flags = 0; if (lsa->lsa_flags & LINUX_SA_NOCLDSTOP) bsa->sa_flags |= SA_NOCLDSTOP; @@ -113,8 +120,12 @@ { bsd_to_linux_sigset(&bsa->sa_mask, &lsa->lsa_mask); +#if COMPAT_LINUX32 + lsa->lsa_handler = (uintptr_t)bsa->sa_handler; +#else >>> TRUNCATED FOR MAIL (1000 lines) <<<help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200408161451.i7GEpYpZ099476>
