aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Whitehorn <nwhitehorn@FreeBSD.org>2010-03-11 14:49:06 +0000
committerNathan Whitehorn <nwhitehorn@FreeBSD.org>2010-03-11 14:49:06 +0000
commit841c0c7ec75bef3c9920cd811270f9f84791ee04 (patch)
treee7bb2301107c48074cb0dbfffd43ee1f7e425d97
parent343803ad831302c8914105ef7dec9e7544750d1e (diff)
downloadsrc-841c0c7ec75bef3c9920cd811270f9f84791ee04.tar.gz
src-841c0c7ec75bef3c9920cd811270f9f84791ee04.zip
Provide groundwork for 32-bit binary compatibility on non-x86 platforms,
for upcoming 64-bit PowerPC and MIPS support. This renames the COMPAT_IA32 option to COMPAT_FREEBSD32, removes some IA32-specific code from MI parts of the kernel and enhances the freebsd32 compatibility code to support big-endian platforms. Reviewed by: kib, jhb
Notes
Notes: svn path=/head/; revision=205014
-rw-r--r--UPDATING6
-rw-r--r--sys/amd64/amd64/db_trace.c2
-rw-r--r--sys/amd64/amd64/exception.S2
-rw-r--r--sys/amd64/amd64/vm_machdep.c4
-rw-r--r--sys/amd64/conf/GENERIC2
-rw-r--r--sys/amd64/conf/NOTES4
-rw-r--r--sys/amd64/conf/XENHVM2
-rw-r--r--sys/amd64/include/elf.h1
-rw-r--r--sys/amd64/include/reg.h9
-rw-r--r--sys/amd64/linux32/linux32_sysvec.c4
-rw-r--r--sys/compat/freebsd32/freebsd32.h24
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c185
-rw-r--r--sys/compat/freebsd32/freebsd32_proto.h200
-rw-r--r--sys/compat/freebsd32/freebsd32_syscall.h9
-rw-r--r--sys/compat/freebsd32/freebsd32_syscalls.c18
-rw-r--r--sys/compat/freebsd32/freebsd32_sysent.c18
-rw-r--r--sys/compat/freebsd32/freebsd32_util.h2
-rw-r--r--sys/compat/freebsd32/syscalls.master92
-rw-r--r--sys/compat/ia32/ia32_reg.h23
-rw-r--r--sys/compat/ia32/ia32_sysvec.c124
-rw-r--r--sys/conf/files.amd6424
-rw-r--r--sys/conf/files.ia6420
-rw-r--r--sys/conf/options.amd642
-rw-r--r--sys/conf/options.ia642
-rw-r--r--sys/fs/procfs/procfs_dbregs.c7
-rw-r--r--sys/fs/procfs/procfs_fpregs.c7
-rw-r--r--sys/fs/procfs/procfs_ioctl.c6
-rw-r--r--sys/fs/procfs/procfs_map.c8
-rw-r--r--sys/fs/procfs/procfs_regs.c7
-rw-r--r--sys/ia64/conf/GENERIC1
-rw-r--r--sys/ia64/conf/NOTES4
-rw-r--r--sys/ia64/ia64/exception.S2
-rw-r--r--sys/ia64/ia64/genassym.c4
-rw-r--r--sys/ia64/ia64/machdep.c6
-rw-r--r--sys/ia64/include/elf.h1
-rw-r--r--sys/ia64/include/reg.h9
-rw-r--r--sys/kern/imgact_elf.c15
-rw-r--r--sys/kern/kern_jail.c8
-rw-r--r--sys/kern/kern_module.c2
-rw-r--r--sys/kern/kern_thr.c2
-rw-r--r--sys/kern/kern_umtx.c6
-rw-r--r--sys/kern/sys_generic.c34
-rw-r--r--sys/kern/sys_process.c30
-rw-r--r--sys/kern/uipc_socket.c6
-rw-r--r--sys/kern/vfs_aio.c2
-rw-r--r--sys/modules/linux/Makefile2
-rw-r--r--sys/modules/procfs/Makefile2
-rw-r--r--sys/sys/ptrace.h3
48 files changed, 602 insertions, 351 deletions
diff --git a/UPDATING b/UPDATING
index 6331db6dd865..fd8a611f320b 100644
--- a/UPDATING
+++ b/UPDATING
@@ -22,6 +22,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.x IS SLOW:
machines to maximize performance. (To disable malloc debugging, run
ln -s aj /etc/malloc.conf.)
+20100311:
+ The kernel option COMPAT_IA32 has been replaced with COMPAT_FREEBSD32
+ to allow 32-bit compatibility on non-x86 platforms. All kernel
+ configurations on amd64 and ia64 platforms using these options must
+ be modified accordingly.
+
20100113:
The utmp user accounting database has been replaced with utmpx,
the user accounting interface standardized by POSIX.
diff --git a/sys/amd64/amd64/db_trace.c b/sys/amd64/amd64/db_trace.c
index 73ffac53def5..cba90f2f5778 100644
--- a/sys/amd64/amd64/db_trace.c
+++ b/sys/amd64/amd64/db_trace.c
@@ -319,7 +319,7 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, struct thread *td)
frame_type = INTERRUPT;
else if (strcmp(name, "Xfast_syscall") == 0)
frame_type = SYSCALL;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
else if (strcmp(name, "Xint0x80_syscall") == 0)
frame_type = SYSCALL;
#endif
diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
index 16d50c590148..3d6401e3cd04 100644
--- a/sys/amd64/amd64/exception.S
+++ b/sys/amd64/amd64/exception.S
@@ -572,7 +572,7 @@ ENTRY(fork_trampoline)
* included.
*/
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
.data
.p2align 4
.text
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index 2c670a4e86a9..3f7d76a802cb 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -439,7 +439,7 @@ cpu_set_upcall_kse(struct thread *td, void (*entry)(void *), void *arg,
*/
cpu_thread_clean(td);
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (td->td_proc->p_sysent->sv_flags & SV_ILP32) {
/*
* Set the trap frame to point at the beginning of the uts
@@ -490,7 +490,7 @@ cpu_set_user_tls(struct thread *td, void *tls_base)
if ((u_int64_t)tls_base >= VM_MAXUSER_ADDRESS)
return (EINVAL);
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (td->td_proc->p_sysent->sv_flags & SV_ILP32) {
td->td_pcb->pcb_gsbase = (register_t)tls_base;
return (0);
diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
index a9eb19c63c8a..5d41112b9c7f 100644
--- a/sys/amd64/conf/GENERIC
+++ b/sys/amd64/conf/GENERIC
@@ -45,7 +45,7 @@ options PSEUDOFS # Pseudo-filesystem framework
options GEOM_PART_GPT # GUID Partition Tables.
options GEOM_LABEL # Provides labelization
options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty)
-options COMPAT_IA32 # Compatible with i386 binaries
+options COMPAT_FREEBSD32 # Compatible with i386 binaries
options COMPAT_FREEBSD4 # Compatible with FreeBSD4
options COMPAT_FREEBSD5 # Compatible with FreeBSD5
options COMPAT_FREEBSD6 # Compatible with FreeBSD6
diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES
index 8b56e54288db..dbd689cb1059 100644
--- a/sys/amd64/conf/NOTES
+++ b/sys/amd64/conf/NOTES
@@ -483,7 +483,7 @@ options PMAP_SHPGPERPROC=201
#XXX these 32 bit binaries is added.
# Enable 32-bit runtime support for FreeBSD/i386 binaries.
-options COMPAT_IA32
+options COMPAT_FREEBSD32
# Enable iBCS2 runtime support for SCO and ISC binaries
#XXX#options IBCS2
@@ -494,7 +494,7 @@ options COMPAT_IA32
# Enable Linux ABI emulation
#XXX#options COMPAT_LINUX
-# Enable 32-bit Linux ABI emulation (requires COMPAT_43 and COMPAT_IA32)
+# Enable 32-bit Linux ABI emulation (requires COMPAT_43 and COMPAT_FREEBSD32)
options COMPAT_LINUX32
# Enable the linux-like proc filesystem support (requires COMPAT_LINUX32
diff --git a/sys/amd64/conf/XENHVM b/sys/amd64/conf/XENHVM
index 7bfb8e2dde50..ce6ea1fe5250 100644
--- a/sys/amd64/conf/XENHVM
+++ b/sys/amd64/conf/XENHVM
@@ -46,7 +46,7 @@ options PSEUDOFS # Pseudo-filesystem framework
options GEOM_PART_GPT # GUID Partition Tables.
options GEOM_LABEL # Provides labelization
options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty)
-options COMPAT_IA32 # Compatible with i386 binaries
+options COMPAT_FREEBSD32 # Compatible with i386 binaries
options COMPAT_FREEBSD4 # Compatible with FreeBSD4
options COMPAT_FREEBSD5 # Compatible with FreeBSD5
options COMPAT_FREEBSD6 # Compatible with FreeBSD6
diff --git a/sys/amd64/include/elf.h b/sys/amd64/include/elf.h
index 88f439805ba1..678f5d3ba0f4 100644
--- a/sys/amd64/include/elf.h
+++ b/sys/amd64/include/elf.h
@@ -42,6 +42,7 @@
#include <sys/elf_generic.h>
#define ELF_ARCH EM_X86_64
+#define ELF_ARCH32 EM_386
#define ELF_MACHINE_OK(x) ((x) == EM_X86_64)
diff --git a/sys/amd64/include/reg.h b/sys/amd64/include/reg.h
index 89211a32651b..4a839181882e 100644
--- a/sys/amd64/include/reg.h
+++ b/sys/amd64/include/reg.h
@@ -37,6 +37,10 @@
#ifndef _MACHINE_REG_H_
#define _MACHINE_REG_H_
+#if defined(_KERNEL) && !defined(_STANDALONE)
+#include "opt_compat.h"
+#endif
+
/*
* Register set accessible via /proc/$pid/regs and PT_{SET,GET}REGS.
*/
@@ -116,6 +120,11 @@ struct dbreg {
#define DBREG_DRX(d,x) ((d)->dr[(x)]) /* reference dr0 - dr15 by
register number */
+#ifdef COMPAT_FREEBSD32
+#include <machine/fpu.h>
+#include <compat/ia32/ia32_reg.h>
+#endif
+
#ifdef _KERNEL
/*
* XXX these interfaces are MI, so they should be declared in a MI place.
diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c
index 6e3e32622bf0..d967ad70113f 100644
--- a/sys/amd64/linux32/linux32_sysvec.c
+++ b/sys/amd64/linux32/linux32_sysvec.c
@@ -34,8 +34,8 @@
__FBSDID("$FreeBSD$");
#include "opt_compat.h"
-#ifndef COMPAT_IA32
-#error "Unable to compile Linux-emulator due to missing COMPAT_IA32 option!"
+#ifndef COMPAT_FREEBSD32
+#error "Unable to compile Linux-emulator due to missing COMPAT_FREEBSD32 option!"
#endif
#define __ELF_WORD_SIZE 32
diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h
index 84e832c4e619..058ac72fe5fd 100644
--- a/sys/compat/freebsd32/freebsd32.h
+++ b/sys/compat/freebsd32/freebsd32.h
@@ -29,6 +29,9 @@
#ifndef _COMPAT_FREEBSD32_FREEBSD32_H_
#define _COMPAT_FREEBSD32_FREEBSD32_H_
+#include <sys/procfs.h>
+#include <sys/socket.h>
+
#define PTRIN(v) (void *)(uintptr_t) (v)
#define PTROUT(v) (u_int32_t)(uintptr_t) (v)
@@ -197,4 +200,25 @@ struct i386_ldt_args32 {
uint32_t num;
};
+/*
+ * Alternative layouts for <sys/procfs.h>
+ */
+struct prstatus32 {
+ int pr_version;
+ u_int pr_statussz;
+ u_int pr_gregsetsz;
+ u_int pr_fpregsetsz;
+ int pr_osreldate;
+ int pr_cursig;
+ pid_t pr_pid;
+ struct reg32 pr_reg;
+};
+
+struct prpsinfo32 {
+ int pr_version;
+ u_int pr_psinfosz;
+ char pr_fname[PRFNAMESZ+1];
+ char pr_psargs[PRARGSZ+1];
+};
+
#endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index 75b290b365f0..c20e5fbd2268 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -31,6 +31,8 @@ __FBSDID("$FreeBSD$");
#include "opt_inet.h"
#include "opt_inet6.h"
+#define __ELF_WORD_SIZE 32
+
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/clock.h>
@@ -44,6 +46,7 @@ __FBSDID("$FreeBSD$");
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/file.h> /* Must come after sys/malloc.h */
+#include <sys/imgact.h>
#include <sys/mbuf.h>
#include <sys/mman.h>
#include <sys/module.h>
@@ -91,6 +94,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_extern.h>
#include <machine/cpu.h>
+#include <machine/elf.h>
#include <security/audit/audit.h>
@@ -115,6 +119,16 @@ CTASSERT(sizeof(struct sigaction32) == 24);
static int freebsd32_kevent_copyout(void *arg, struct kevent *kevp, int count);
static int freebsd32_kevent_copyin(void *arg, struct kevent *kevp, int count);
+#if BYTE_ORDER == BIG_ENDIAN
+#define PAIR32TO64(type, name) ((name ## 2) | ((type)(name ## 1) << 32))
+#define RETVAL_HI 0
+#define RETVAL_LO 1
+#else
+#define PAIR32TO64(type, name) ((name ## 1) | ((type)(name ## 2) << 32))
+#define RETVAL_HI 1
+#define RETVAL_LO 0
+#endif
+
int
freebsd32_wait4(struct thread *td, struct freebsd32_wait4_args *uap)
{
@@ -426,8 +440,7 @@ freebsd32_mmap(struct thread *td, struct freebsd32_mmap_args *uap)
int prot = uap->prot;
int flags = uap->flags;
int fd = uap->fd;
- off_t pos = (uap->poslo
- | ((off_t)uap->poshi << 32));
+ off_t pos = PAIR32TO64(off_t,uap->pos);
#ifdef __ia64__
vm_size_t pageoff;
int error;
@@ -523,8 +536,8 @@ freebsd6_freebsd32_mmap(struct thread *td, struct freebsd6_freebsd32_mmap_args *
ap.prot = uap->prot;
ap.flags = uap->flags;
ap.fd = uap->fd;
- ap.poslo = uap->poslo;
- ap.poshi = uap->poshi;
+ ap.pos1 = uap->pos1;
+ ap.pos2 = uap->pos2;
return (freebsd32_mmap(td, &ap));
}
@@ -586,7 +599,6 @@ freebsd32_select(struct thread *td, struct freebsd32_select_args *uap)
} else
tvp = NULL;
/*
- * XXX big-endian needs to convert the fd_sets too.
* XXX Do pointers need PTRIN()?
*/
return (kern_select(td, uap->nd, uap->in, uap->ou, uap->ex, tvp,
@@ -620,7 +632,6 @@ freebsd32_pselect(struct thread *td, struct freebsd32_pselect_args *uap)
} else
uset = NULL;
/*
- * XXX big-endian needs to convert the fd_sets too.
* XXX Do pointers need PTRIN()?
*/
error = kern_pselect(td, uap->nd, uap->in, uap->ou, uap->ex, tvp,
@@ -843,7 +854,7 @@ freebsd32_preadv(struct thread *td, struct freebsd32_preadv_args *uap)
error = freebsd32_copyinuio(uap->iovp, uap->iovcnt, &auio);
if (error)
return (error);
- error = kern_preadv(td, uap->fd, auio, uap->offset);
+ error = kern_preadv(td, uap->fd, auio, PAIR32TO64(off_t,uap->offset));
free(auio, M_IOV);
return (error);
}
@@ -857,7 +868,7 @@ freebsd32_pwritev(struct thread *td, struct freebsd32_pwritev_args *uap)
error = freebsd32_copyinuio(uap->iovp, uap->iovcnt, &auio);
if (error)
return (error);
- error = kern_pwritev(td, uap->fd, auio, uap->offset);
+ error = kern_pwritev(td, uap->fd, auio, PAIR32TO64(off_t,uap->offset));
free(auio, M_IOV);
return (error);
}
@@ -1982,7 +1993,7 @@ freebsd32_pread(struct thread *td, struct freebsd32_pread_args *uap)
ap.fd = uap->fd;
ap.buf = uap->buf;
ap.nbyte = uap->nbyte;
- ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32));
+ ap.offset = PAIR32TO64(off_t,uap->offset);
return (pread(td, &ap));
}
@@ -1994,7 +2005,7 @@ freebsd32_pwrite(struct thread *td, struct freebsd32_pwrite_args *uap)
ap.fd = uap->fd;
ap.buf = uap->buf;
ap.nbyte = uap->nbyte;
- ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32));
+ ap.offset = PAIR32TO64(off_t,uap->offset);
return (pwrite(td, &ap));
}
@@ -2006,13 +2017,13 @@ freebsd32_lseek(struct thread *td, struct freebsd32_lseek_args *uap)
off_t pos;
ap.fd = uap->fd;
- ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32));
+ ap.offset = PAIR32TO64(off_t,uap->offset);
ap.whence = uap->whence;
error = lseek(td, &ap);
/* Expand the quad return into two parts for eax and edx */
pos = *(off_t *)(td->td_retval);
- td->td_retval[0] = pos & 0xffffffff; /* %eax */
- td->td_retval[1] = pos >> 32; /* %edx */
+ td->td_retval[RETVAL_LO] = pos & 0xffffffff; /* %eax */
+ td->td_retval[RETVAL_HI] = pos >> 32; /* %edx */
return error;
}
@@ -2022,7 +2033,7 @@ freebsd32_truncate(struct thread *td, struct freebsd32_truncate_args *uap)
struct truncate_args ap;
ap.path = uap->path;
- ap.length = (uap->lengthlo | ((off_t)uap->lengthhi << 32));
+ ap.length = PAIR32TO64(off_t,uap->length);
return (truncate(td, &ap));
}
@@ -2032,7 +2043,7 @@ freebsd32_ftruncate(struct thread *td, struct freebsd32_ftruncate_args *uap)
struct ftruncate_args ap;
ap.fd = uap->fd;
- ap.length = (uap->lengthlo | ((off_t)uap->lengthhi << 32));
+ ap.length = PAIR32TO64(off_t,uap->length);
return (ftruncate(td, &ap));
}
@@ -2064,7 +2075,7 @@ freebsd6_freebsd32_pread(struct thread *td, struct freebsd6_freebsd32_pread_args
ap.fd = uap->fd;
ap.buf = uap->buf;
ap.nbyte = uap->nbyte;
- ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32));
+ ap.offset = PAIR32TO64(off_t,uap->offset);
return (pread(td, &ap));
}
@@ -2076,7 +2087,7 @@ freebsd6_freebsd32_pwrite(struct thread *td, struct freebsd6_freebsd32_pwrite_ar
ap.fd = uap->fd;
ap.buf = uap->buf;
ap.nbyte = uap->nbyte;
- ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32));
+ ap.offset = PAIR32TO64(off_t,uap->offset);
return (pwrite(td, &ap));
}
@@ -2088,13 +2099,13 @@ freebsd6_freebsd32_lseek(struct thread *td, struct freebsd6_freebsd32_lseek_args
off_t pos;
ap.fd = uap->fd;
- ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32));
+ ap.offset = PAIR32TO64(off_t,uap->offset);
ap.whence = uap->whence;
error = lseek(td, &ap);
/* Expand the quad return into two parts for eax and edx */
pos = *(off_t *)(td->td_retval);
- td->td_retval[0] = pos & 0xffffffff; /* %eax */
- td->td_retval[1] = pos >> 32; /* %edx */
+ td->td_retval[RETVAL_LO] = pos & 0xffffffff; /* %eax */
+ td->td_retval[RETVAL_HI] = pos >> 32; /* %edx */
return error;
}
@@ -2104,7 +2115,7 @@ freebsd6_freebsd32_truncate(struct thread *td, struct freebsd6_freebsd32_truncat
struct truncate_args ap;
ap.path = uap->path;
- ap.length = (uap->lengthlo | ((off_t)uap->lengthhi << 32));
+ ap.length = PAIR32TO64(off_t,uap->length);
return (truncate(td, &ap));
}
@@ -2114,7 +2125,7 @@ freebsd6_freebsd32_ftruncate(struct thread *td, struct freebsd6_freebsd32_ftrunc
struct ftruncate_args ap;
ap.fd = uap->fd;
- ap.length = (uap->lengthlo | ((off_t)uap->lengthhi << 32));
+ ap.length = PAIR32TO64(off_t,uap->length);
return (ftruncate(td, &ap));
}
#endif /* COMPAT_FREEBSD6 */
@@ -2141,7 +2152,7 @@ freebsd32_do_sendfile(struct thread *td,
ap.fd = uap->fd;
ap.s = uap->s;
- ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32));
+ ap.offset = PAIR32TO64(off_t,uap->offset);
ap.nbytes = uap->nbytes;
ap.hdtr = (struct sf_hdtr *)uap->hdtr; /* XXX not used */
ap.sbytes = uap->sbytes;
@@ -2879,7 +2890,7 @@ freebsd32_cpuset_setid(struct thread *td,
struct cpuset_setid_args ap;
ap.which = uap->which;
- ap.id = (uap->idlo | ((id_t)uap->idhi << 32));
+ ap.id = PAIR32TO64(id_t,uap->id);
ap.setid = uap->setid;
return (cpuset_setid(td, &ap));
@@ -2893,7 +2904,7 @@ freebsd32_cpuset_getid(struct thread *td,
ap.level = uap->level;
ap.which = uap->which;
- ap.id = (uap->idlo | ((id_t)uap->idhi << 32));
+ ap.id = PAIR32TO64(id_t,uap->id);
ap.setid = uap->setid;
return (cpuset_getid(td, &ap));
@@ -2907,7 +2918,7 @@ freebsd32_cpuset_getaffinity(struct thread *td,
ap.level = uap->level;
ap.which = uap->which;
- ap.id = (uap->idlo | ((id_t)uap->idhi << 32));
+ ap.id = PAIR32TO64(id_t,uap->id);
ap.cpusetsize = uap->cpusetsize;
ap.mask = uap->mask;
@@ -2922,7 +2933,7 @@ freebsd32_cpuset_setaffinity(struct thread *td,
ap.level = uap->level;
ap.which = uap->which;
- ap.id = (uap->idlo | ((id_t)uap->idhi << 32));
+ ap.id = PAIR32TO64(id_t,uap->id);
ap.cpusetsize = uap->cpusetsize;
ap.mask = uap->mask;
@@ -3072,3 +3083,123 @@ syscall32_module_handler(struct module *mod, int what, void *arg)
return (error);
}
}
+
+register_t *
+freebsd32_copyout_strings(struct image_params *imgp)
+{
+ int argc, envc;
+ u_int32_t *vectp;
+ char *stringp, *destp;
+ u_int32_t *stack_base;
+ struct freebsd32_ps_strings *arginfo;
+ size_t execpath_len;
+ int szsigcode;
+
+ /*
+ * Calculate string base and vector table pointers.
+ * Also deal with signal trampoline code for this exec type.
+ */
+ if (imgp->execpath != NULL && imgp->auxargs != NULL)
+ execpath_len = strlen(imgp->execpath) + 1;
+ else
+ execpath_len = 0;
+ arginfo = (struct freebsd32_ps_strings *)FREEBSD32_PS_STRINGS;
+ szsigcode = *(imgp->proc->p_sysent->sv_szsigcode);
+ destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE -
+ roundup(execpath_len, sizeof(char *)) -
+ roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *));
+
+ /*
+ * install sigcode
+ */
+ if (szsigcode)
+ copyout(imgp->proc->p_sysent->sv_sigcode,
+ ((caddr_t)arginfo - szsigcode), szsigcode);
+
+ /*
+ * Copy the image path for the rtld.
+ */
+ if (execpath_len != 0) {
+ imgp->execpathp = (uintptr_t)arginfo - szsigcode - execpath_len;
+ copyout(imgp->execpath, (void *)imgp->execpathp,
+ execpath_len);
+ }
+
+ /*
+ * If we have a valid auxargs ptr, prepare some room
+ * on the stack.
+ */
+ if (imgp->auxargs) {
+ /*
+ * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for
+ * lower compatibility.
+ */
+ imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size
+ : (AT_COUNT * 2);
+ /*
+ * The '+ 2' is for the null pointers at the end of each of
+ * the arg and env vector sets,and imgp->auxarg_size is room
+ * for argument of Runtime loader.
+ */
+ vectp = (u_int32_t *) (destp - (imgp->args->argc +
+ imgp->args->envc + 2 + imgp->auxarg_size + execpath_len) *
+ sizeof(u_int32_t));
+ } else
+ /*
+ * The '+ 2' is for the null pointers at the end of each of
+ * the arg and env vector sets
+ */
+ vectp = (u_int32_t *)
+ (destp - (imgp->args->argc + imgp->args->envc + 2) * sizeof(u_int32_t));
+
+ /*
+ * vectp also becomes our initial stack base
+ */
+ stack_base = vectp;
+
+ stringp = imgp->args->begin_argv;
+ argc = imgp->args->argc;
+ envc = imgp->args->envc;
+ /*
+ * Copy out strings - arguments and environment.
+ */
+ copyout(stringp, destp, ARG_MAX - imgp->args->stringspace);
+
+ /*
+ * Fill in "ps_strings" struct for ps, w, etc.
+ */
+ suword32(&arginfo->ps_argvstr, (u_int32_t)(intptr_t)vectp);
+ suword32(&arginfo->ps_nargvstr, argc);
+
+ /*
+ * Fill in argument portion of vector table.
+ */
+ for (; argc > 0; --argc) {
+ suword32(vectp++, (u_int32_t)(intptr_t)destp);
+ while (*stringp++ != 0)
+ destp++;
+ destp++;
+ }
+
+ /* a null vector table pointer separates the argp's from the envp's */
+ suword32(vectp++, 0);
+
+ suword32(&arginfo->ps_envstr, (u_int32_t)(intptr_t)vectp);
+ suword32(&arginfo->ps_nenvstr, envc);
+
+ /*
+ * Fill in environment portion of vector table.
+ */
+ for (; envc > 0; --envc) {
+ suword32(vectp++, (u_int32_t)(intptr_t)destp);
+ while (*stringp++ != 0)
+ destp++;
+ destp++;
+ }
+
+ /* end of vector table is a null pointer */
+ suword32(vectp, 0);
+
+ return ((register_t *)stack_base);
+}
+
diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h
index 7418dbdc2512..8da78f432600 100644
--- a/sys/compat/freebsd32/freebsd32_proto.h
+++ b/sys/compat/freebsd32/freebsd32_proto.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 200111 2009-12-04 21:52:31Z kib
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 203660 2010-02-08 10:02:01Z ed
*/
#ifndef _FREEBSD32_SYSPROTO_H_
@@ -32,6 +32,9 @@ struct thread;
#define PADR_(t) 0
#endif
+#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#define PAD64_REQUIRED
+#endif
struct freebsd32_wait4_args {
char pid_l_[PADL_(int)]; int pid; char pid_r_[PADR_(int)];
char status_l_[PADL_(int *)]; int * status; char status_r_[PADR_(int *)];
@@ -223,13 +226,15 @@ struct freebsd32_preadv_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char iovp_l_[PADL_(struct iovec32 *)]; struct iovec32 * iovp; char iovp_r_[PADR_(struct iovec32 *)];
char iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)];
- char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];
+ char offset1_l_[PADL_(u_int32_t)]; u_int32_t offset1; char offset1_r_[PADR_(u_int32_t)];
+ char offset2_l_[PADL_(u_int32_t)]; u_int32_t offset2; char offset2_r_[PADR_(u_int32_t)];
};
struct freebsd32_pwritev_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char iovp_l_[PADL_(struct iovec32 *)]; struct iovec32 * iovp; char iovp_r_[PADR_(struct iovec32 *)];
char iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)];
- char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];
+ char offset1_l_[PADL_(u_int32_t)]; u_int32_t offset1; char offset1_r_[PADR_(u_int32_t)];
+ char offset2_l_[PADL_(u_int32_t)]; u_int32_t offset2; char offset2_r_[PADR_(u_int32_t)];
};
struct freebsd32_modstat_args {
char modid_l_[PADL_(int)]; int modid; char modid_r_[PADR_(int)];
@@ -294,8 +299,8 @@ struct freebsd32_nmount_args {
struct freebsd32_sendfile_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
- char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
- char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char offset1_l_[PADL_(u_int32_t)]; u_int32_t offset1; char offset1_r_[PADR_(u_int32_t)];
+ char offset2_l_[PADL_(u_int32_t)]; u_int32_t offset2; char offset2_r_[PADR_(u_int32_t)];
char nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];
char hdtr_l_[PADL_(struct sf_hdtr32 *)]; struct sf_hdtr32 * hdtr; char hdtr_r_[PADR_(struct sf_hdtr32 *)];
char sbytes_l_[PADL_(off_t *)]; off_t * sbytes; char sbytes_r_[PADR_(off_t *)];
@@ -343,19 +348,22 @@ struct freebsd32_aio_fsync_args {
char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)];
char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)];
};
+#ifdef PAD64_REQUIRED
struct freebsd32_pread_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)];
char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
- char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
- char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ char offset1_l_[PADL_(u_int32_t)]; u_int32_t offset1; char offset1_r_[PADR_(u_int32_t)];
+ char offset2_l_[PADL_(u_int32_t)]; u_int32_t offset2; char offset2_r_[PADR_(u_int32_t)];
};
struct freebsd32_pwrite_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)];
char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
- char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
- char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ char offset1_l_[PADL_(u_int32_t)]; u_int32_t offset1; char offset1_r_[PADR_(u_int32_t)];
+ char offset2_l_[PADL_(u_int32_t)]; u_int32_t offset2; char offset2_r_[PADR_(u_int32_t)];
};
struct freebsd32_mmap_args {
char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)];
@@ -363,51 +371,106 @@ struct freebsd32_mmap_args {
char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];
char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
- char poslo_l_[PADL_(u_int32_t)]; u_int32_t poslo; char poslo_r_[PADR_(u_int32_t)];
- char poshi_l_[PADL_(u_int32_t)]; u_int32_t poshi; char poshi_r_[PADR_(u_int32_t)];
+ char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ char pos1_l_[PADL_(u_int32_t)]; u_int32_t pos1; char pos1_r_[PADR_(u_int32_t)];
+ char pos2_l_[PADL_(u_int32_t)]; u_int32_t pos2; char pos2_r_[PADR_(u_int32_t)];
};
struct freebsd32_lseek_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
- char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
- char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ char offset1_l_[PADL_(u_int32_t)]; u_int32_t offset1; char offset1_r_[PADR_(u_int32_t)];
+ char offset2_l_[PADL_(u_int32_t)]; u_int32_t offset2; char offset2_r_[PADR_(u_int32_t)];
char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)];
};
struct freebsd32_truncate_args {
char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
- char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
- char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
+ char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ char length1_l_[PADL_(u_int32_t)]; u_int32_t length1; char length1_r_[PADR_(u_int32_t)];
+ char length2_l_[PADL_(u_int32_t)]; u_int32_t length2; char length2_r_[PADR_(u_int32_t)];
};
struct freebsd32_ftruncate_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
- char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
- char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
+ char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ char length1_l_[PADL_(u_int32_t)]; u_int32_t length1; char length1_r_[PADR_(u_int32_t)];
+ char length2_l_[PADL_(u_int32_t)]; u_int32_t length2; char length2_r_[PADR_(u_int32_t)];
+};
+#else
+struct freebsd32_pread_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)];
+ char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
+ char offset1_l_[PADL_(u_int32_t)]; u_int32_t offset1; char offset1_r_[PADR_(u_int32_t)];
+ char offset2_l_[PADL_(u_int32_t)]; u_int32_t offset2; char offset2_r_[PADR_(u_int32_t)];
+};
+struct freebsd32_pwrite_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)];
+ char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
+ char offset1_l_[PADL_(u_int32_t)]; u_int32_t offset1; char offset1_r_[PADR_(u_int32_t)];
+ char offset2_l_[PADL_(u_int32_t)]; u_int32_t offset2; char offset2_r_[PADR_(u_int32_t)];
+};
+struct freebsd32_mmap_args {
+ char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)];
+ char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];
+ char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];
+ char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char pos1_l_[PADL_(u_int32_t)]; u_int32_t pos1; char pos1_r_[PADR_(u_int32_t)];
+ char pos2_l_[PADL_(u_int32_t)]; u_int32_t pos2; char pos2_r_[PADR_(u_int32_t)];
+};
+struct freebsd32_lseek_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char offset1_l_[PADL_(u_int32_t)]; u_int32_t offset1; char offset1_r_[PADR_(u_int32_t)];
+ char offset2_l_[PADL_(u_int32_t)]; u_int32_t offset2; char offset2_r_[PADR_(u_int32_t)];
+ char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)];
+};
+struct freebsd32_truncate_args {
+ char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
+ char length1_l_[PADL_(u_int32_t)]; u_int32_t length1; char length1_r_[PADR_(u_int32_t)];
+ char length2_l_[PADL_(u_int32_t)]; u_int32_t length2; char length2_r_[PADR_(u_int32_t)];
+};
+struct freebsd32_ftruncate_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char length1_l_[PADL_(u_int32_t)]; u_int32_t length1; char length1_r_[PADR_(u_int32_t)];
+ char length2_l_[PADL_(u_int32_t)]; u_int32_t length2; char length2_r_[PADR_(u_int32_t)];
+};
+#endif
+#ifdef PAD64_REQUIRED
+struct freebsd32_cpuset_setid_args {
+ char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)];
+ char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ char id1_l_[PADL_(u_int32_t)]; u_int32_t id1; char id1_r_[PADR_(u_int32_t)];
+ char id2_l_[PADL_(u_int32_t)]; u_int32_t id2; char id2_r_[PADR_(u_int32_t)];
+ char setid_l_[PADL_(cpusetid_t)]; cpusetid_t setid; char setid_r_[PADR_(cpusetid_t)];
};
+#else
struct freebsd32_cpuset_setid_args {
char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)];
- char idlo_l_[PADL_(uint32_t)]; uint32_t idlo; char idlo_r_[PADR_(uint32_t)];
- char idhi_l_[PADL_(uint32_t)]; uint32_t idhi; char idhi_r_[PADR_(uint32_t)];
+ char id1_l_[PADL_(u_int32_t)]; u_int32_t id1; char id1_r_[PADR_(u_int32_t)];
+ char id2_l_[PADL_(u_int32_t)]; u_int32_t id2; char id2_r_[PADR_(u_int32_t)];
char setid_l_[PADL_(cpusetid_t)]; cpusetid_t setid; char setid_r_[PADR_(cpusetid_t)];
};
+#endif
struct freebsd32_cpuset_getid_args {
char level_l_[PADL_(cpulevel_t)]; cpulevel_t level; char level_r_[PADR_(cpulevel_t)];
char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)];
- char idlo_l_[PADL_(uint32_t)]; uint32_t idlo; char idlo_r_[PADR_(uint32_t)];
- char idhi_l_[PADL_(uint32_t)]; uint32_t idhi; char idhi_r_[PADR_(uint32_t)];
+ char id1_l_[PADL_(u_int32_t)]; u_int32_t id1; char id1_r_[PADR_(u_int32_t)];
+ char id2_l_[PADL_(u_int32_t)]; u_int32_t id2; char id2_r_[PADR_(u_int32_t)];
char setid_l_[PADL_(cpusetid_t *)]; cpusetid_t * setid; char setid_r_[PADR_(cpusetid_t *)];
};
struct freebsd32_cpuset_getaffinity_args {
char level_l_[PADL_(cpulevel_t)]; cpulevel_t level; char level_r_[PADR_(cpulevel_t)];
char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)];
- char idlo_l_[PADL_(uint32_t)]; uint32_t idlo; char idlo_r_[PADR_(uint32_t)];
- char idhi_l_[PADL_(uint32_t)]; uint32_t idhi; char idhi_r_[PADR_(uint32_t)];
+ char id1_l_[PADL_(u_int32_t)]; u_int32_t id1; char id1_r_[PADR_(u_int32_t)];
+ char id2_l_[PADL_(u_int32_t)]; u_int32_t id2; char id2_r_[PADR_(u_int32_t)];
char cpusetsize_l_[PADL_(size_t)]; size_t cpusetsize; char cpusetsize_r_[PADR_(size_t)];
char mask_l_[PADL_(cpuset_t *)]; cpuset_t * mask; char mask_r_[PADR_(cpuset_t *)];
};
struct freebsd32_cpuset_setaffinity_args {
char level_l_[PADL_(cpulevel_t)]; cpulevel_t level; char level_r_[PADR_(cpulevel_t)];
char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)];
- char idlo_l_[PADL_(uint32_t)]; uint32_t idlo; char idlo_r_[PADR_(uint32_t)];
- char idhi_l_[PADL_(uint32_t)]; uint32_t idhi; char idhi_r_[PADR_(uint32_t)];
+ char id1_l_[PADL_(u_int32_t)]; u_int32_t id1; char id1_r_[PADR_(u_int32_t)];
+ char id2_l_[PADL_(u_int32_t)]; u_int32_t id2; char id2_r_[PADR_(u_int32_t)];
char cpusetsize_l_[PADL_(size_t)]; size_t cpusetsize; char cpusetsize_r_[PADR_(size_t)];
char mask_l_[PADL_(const cpuset_t *)]; const cpuset_t * mask; char mask_r_[PADR_(const cpuset_t *)];
};
@@ -461,6 +524,9 @@ struct freebsd32_pselect_args {
char ts_l_[PADL_(const struct timespec32 *)]; const struct timespec32 * ts; char ts_r_[PADR_(const struct timespec32 *)];
char sm_l_[PADL_(const sigset_t *)]; const sigset_t * sm; char sm_r_[PADR_(const sigset_t *)];
};
+#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#define PAD64_REQUIRED
+#endif
int freebsd32_wait4(struct thread *, struct freebsd32_wait4_args *);
int freebsd32_recvmsg(struct thread *, struct freebsd32_recvmsg_args *);
int freebsd32_sendmsg(struct thread *, struct freebsd32_sendmsg_args *);
@@ -526,13 +592,26 @@ int freebsd32_thr_suspend(struct thread *, struct freebsd32_thr_suspend_args *);
int freebsd32_umtx_op(struct thread *, struct freebsd32_umtx_op_args *);
int freebsd32_thr_new(struct thread *, struct freebsd32_thr_new_args *);
int freebsd32_aio_fsync(struct thread *, struct freebsd32_aio_fsync_args *);
+#ifdef PAD64_REQUIRED
int freebsd32_pread(struct thread *, struct freebsd32_pread_args *);
int freebsd32_pwrite(struct thread *, struct freebsd32_pwrite_args *);
int freebsd32_mmap(struct thread *, struct freebsd32_mmap_args *);
int freebsd32_lseek(struct thread *, struct freebsd32_lseek_args *);
int freebsd32_truncate(struct thread *, struct freebsd32_truncate_args *);
int freebsd32_ftruncate(struct thread *, struct freebsd32_ftruncate_args *);
+#else
+int freebsd32_pread(struct thread *, struct freebsd32_pread_args *);
+int freebsd32_pwrite(struct thread *, struct freebsd32_pwrite_args *);
+int freebsd32_mmap(struct thread *, struct freebsd32_mmap_args *);
+int freebsd32_lseek(struct thread *, struct freebsd32_lseek_args *);
+int freebsd32_truncate(struct thread *, struct freebsd32_truncate_args *);
+int freebsd32_ftruncate(struct thread *, struct freebsd32_ftruncate_args *);
+#endif
+#ifdef PAD64_REQUIRED
int freebsd32_cpuset_setid(struct thread *, struct freebsd32_cpuset_setid_args *);
+#else
+int freebsd32_cpuset_setid(struct thread *, struct freebsd32_cpuset_setid_args *);
+#endif
int freebsd32_cpuset_getid(struct thread *, struct freebsd32_cpuset_getid_args *);
int freebsd32_cpuset_getaffinity(struct thread *, struct freebsd32_cpuset_getaffinity_args *);
int freebsd32_cpuset_setaffinity(struct thread *, struct freebsd32_cpuset_setaffinity_args *);
@@ -548,6 +627,9 @@ int freebsd32_pselect(struct thread *, struct freebsd32_pselect_args *);
#ifdef COMPAT_43
+#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#define PAD64_REQUIRED
+#endif
struct ofreebsd32_sigaction_args {
char signum_l_[PADL_(int)]; int signum; char signum_r_[PADR_(int)];
char nsa_l_[PADL_(struct osigaction32 *)]; struct osigaction32 * nsa; char nsa_r_[PADR_(struct osigaction32 *)];
@@ -575,6 +657,12 @@ struct ofreebsd32_sigstack_args {
char nss_l_[PADL_(struct sigstack32 *)]; struct sigstack32 * nss; char nss_r_[PADR_(struct sigstack32 *)];
char oss_l_[PADL_(struct sigstack32 *)]; struct sigstack32 * oss; char oss_r_[PADR_(struct sigstack32 *)];
};
+#ifdef PAD64_REQUIRED
+#else
+#endif
+#ifdef PAD64_REQUIRED
+#else
+#endif
int ofreebsd32_sigaction(struct thread *, struct ofreebsd32_sigaction_args *);
int ofreebsd32_sigprocmask(struct thread *, struct ofreebsd32_sigprocmask_args *);
int ofreebsd32_sigpending(struct thread *, struct ofreebsd32_sigpending_args *);
@@ -589,6 +677,9 @@ int ofreebsd32_sigstack(struct thread *, struct ofreebsd32_sigstack_args *);
#ifdef COMPAT_FREEBSD4
+#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#define PAD64_REQUIRED
+#endif
struct freebsd4_freebsd32_getfsstat_args {
char buf_l_[PADL_(struct statfs32 *)]; struct statfs32 * buf; char buf_r_[PADR_(struct statfs32 *)];
char bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)];
@@ -609,8 +700,8 @@ struct freebsd4_freebsd32_fhstatfs_args {
struct freebsd4_freebsd32_sendfile_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
- char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
- char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char offset1_l_[PADL_(u_int32_t)]; u_int32_t offset1; char offset1_r_[PADR_(u_int32_t)];
+ char offset2_l_[PADL_(u_int32_t)]; u_int32_t offset2; char offset2_r_[PADR_(u_int32_t)];
char nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];
char hdtr_l_[PADL_(struct sf_hdtr32 *)]; struct sf_hdtr32 * hdtr; char hdtr_r_[PADR_(struct sf_hdtr32 *)];
char sbytes_l_[PADL_(off_t *)]; off_t * sbytes; char sbytes_r_[PADR_(off_t *)];
@@ -624,6 +715,12 @@ struct freebsd4_freebsd32_sigaction_args {
struct freebsd4_freebsd32_sigreturn_args {
char sigcntxp_l_[PADL_(const struct freebsd4_freebsd32_ucontext *)]; const struct freebsd4_freebsd32_ucontext * sigcntxp; char sigcntxp_r_[PADR_(const struct freebsd4_freebsd32_ucontext *)];
};
+#ifdef PAD64_REQUIRED
+#else
+#endif
+#ifdef PAD64_REQUIRED
+#else
+#endif
int freebsd4_freebsd32_getfsstat(struct thread *, struct freebsd4_freebsd32_getfsstat_args *);
int freebsd4_freebsd32_statfs(struct thread *, struct freebsd4_freebsd32_statfs_args *);
int freebsd4_freebsd32_fstatfs(struct thread *, struct freebsd4_freebsd32_fstatfs_args *);
@@ -637,21 +734,24 @@ int freebsd4_freebsd32_sigreturn(struct thread *, struct freebsd4_freebsd32_sigr
#ifdef COMPAT_FREEBSD6
+#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#define PAD64_REQUIRED
+#endif
struct freebsd6_freebsd32_pread_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)];
char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
- char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
- char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char offset1_l_[PADL_(u_int32_t)]; u_int32_t offset1; char offset1_r_[PADR_(u_int32_t)];
+ char offset2_l_[PADL_(u_int32_t)]; u_int32_t offset2; char offset2_r_[PADR_(u_int32_t)];
};
struct freebsd6_freebsd32_pwrite_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)];
char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
- char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
- char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char offset1_l_[PADL_(u_int32_t)]; u_int32_t offset1; char offset1_r_[PADR_(u_int32_t)];
+ char offset2_l_[PADL_(u_int32_t)]; u_int32_t offset2; char offset2_r_[PADR_(u_int32_t)];
};
struct freebsd6_freebsd32_mmap_args {
char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)];
@@ -660,28 +760,34 @@ struct freebsd6_freebsd32_mmap_args {
char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
- char poslo_l_[PADL_(u_int32_t)]; u_int32_t poslo; char poslo_r_[PADR_(u_int32_t)];
- char poshi_l_[PADL_(u_int32_t)]; u_int32_t poshi; char poshi_r_[PADR_(u_int32_t)];
+ char pos1_l_[PADL_(u_int32_t)]; u_int32_t pos1; char pos1_r_[PADR_(u_int32_t)];
+ char pos2_l_[PADL_(u_int32_t)]; u_int32_t pos2; char pos2_r_[PADR_(u_int32_t)];
};
struct freebsd6_freebsd32_lseek_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
- char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
- char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char offset1_l_[PADL_(u_int32_t)]; u_int32_t offset1; char offset1_r_[PADR_(u_int32_t)];
+ char offset2_l_[PADL_(u_int32_t)]; u_int32_t offset2; char offset2_r_[PADR_(u_int32_t)];
char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)];
};
struct freebsd6_freebsd32_truncate_args {
char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
- char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
- char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
+ char length1_l_[PADL_(u_int32_t)]; u_int32_t length1; char length1_r_[PADR_(u_int32_t)];
+ char length2_l_[PADL_(u_int32_t)]; u_int32_t length2; char length2_r_[PADR_(u_int32_t)];
};
struct freebsd6_freebsd32_ftruncate_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
- char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
- char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
+ char length1_l_[PADL_(u_int32_t)]; u_int32_t length1; char length1_r_[PADR_(u_int32_t)];
+ char length2_l_[PADL_(u_int32_t)]; u_int32_t length2; char length2_r_[PADR_(u_int32_t)];
};
+#ifdef PAD64_REQUIRED
+#else
+#endif
+#ifdef PAD64_REQUIRED
+#else
+#endif
int freebsd6_freebsd32_pread(struct thread *, struct freebsd6_freebsd32_pread_args *);
int freebsd6_freebsd32_pwrite(struct thread *, struct freebsd6_freebsd32_pwrite_args *);
int freebsd6_freebsd32_mmap(struct thread *, struct freebsd6_freebsd32_mmap_args *);
@@ -694,6 +800,9 @@ int freebsd6_freebsd32_ftruncate(struct thread *, struct freebsd6_freebsd32_ftru
#ifdef COMPAT_FREEBSD7
+#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#define PAD64_REQUIRED
+#endif
struct freebsd7_freebsd32_semctl_args {
char semid_l_[PADL_(int)]; int semid; char semid_r_[PADR_(int)];
char semnum_l_[PADL_(int)]; int semnum; char semnum_r_[PADR_(int)];
@@ -710,6 +819,12 @@ struct freebsd7_freebsd32_shmctl_args {
char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];
char buf_l_[PADL_(struct shmid_ds32_old *)]; struct shmid_ds32_old * buf; char buf_r_[PADR_(struct shmid_ds32_old *)];
};
+#ifdef PAD64_REQUIRED
+#else
+#endif
+#ifdef PAD64_REQUIRED
+#else
+#endif
int freebsd7_freebsd32_semctl(struct thread *, struct freebsd7_freebsd32_semctl_args *);
int freebsd7_freebsd32_msgctl(struct thread *, struct freebsd7_freebsd32_msgctl_args *);
int freebsd7_freebsd32_shmctl(struct thread *, struct freebsd7_freebsd32_shmctl_args *);
@@ -811,6 +926,13 @@ int freebsd7_freebsd32_shmctl(struct thread *, struct freebsd7_freebsd32_shmctl_
#define FREEBSD32_SYS_AUE_freebsd32_lseek AUE_LSEEK
#define FREEBSD32_SYS_AUE_freebsd32_truncate AUE_TRUNCATE
#define FREEBSD32_SYS_AUE_freebsd32_ftruncate AUE_FTRUNCATE
+#define FREEBSD32_SYS_AUE_freebsd32_pread AUE_PREAD
+#define FREEBSD32_SYS_AUE_freebsd32_pwrite AUE_PWRITE
+#define FREEBSD32_SYS_AUE_freebsd32_mmap AUE_MMAP
+#define FREEBSD32_SYS_AUE_freebsd32_lseek AUE_LSEEK
+#define FREEBSD32_SYS_AUE_freebsd32_truncate AUE_TRUNCATE
+#define FREEBSD32_SYS_AUE_freebsd32_ftruncate AUE_FTRUNCATE
+#define FREEBSD32_SYS_AUE_freebsd32_cpuset_setid AUE_NULL
#define FREEBSD32_SYS_AUE_freebsd32_cpuset_setid AUE_NULL
#define FREEBSD32_SYS_AUE_freebsd32_cpuset_getid AUE_NULL
#define FREEBSD32_SYS_AUE_freebsd32_cpuset_getaffinity AUE_NULL
diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h
index abd87eb8830c..dbecee635c53 100644
--- a/sys/compat/freebsd32/freebsd32_syscall.h
+++ b/sys/compat/freebsd32/freebsd32_syscall.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 200111 2009-12-04 21:52:31Z kib
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 203660 2010-02-08 10:02:01Z ed
*/
#define FREEBSD32_SYS_syscall 0
@@ -354,11 +354,18 @@
#define FREEBSD32_SYS_freebsd32_lseek 478
#define FREEBSD32_SYS_freebsd32_truncate 479
#define FREEBSD32_SYS_freebsd32_ftruncate 480
+#define FREEBSD32_SYS_freebsd32_pread 475
+#define FREEBSD32_SYS_freebsd32_pwrite 476
+#define FREEBSD32_SYS_freebsd32_mmap 477
+#define FREEBSD32_SYS_freebsd32_lseek 478
+#define FREEBSD32_SYS_freebsd32_truncate 479
+#define FREEBSD32_SYS_freebsd32_ftruncate 480
#define FREEBSD32_SYS_thr_kill2 481
#define FREEBSD32_SYS_shm_open 482
#define FREEBSD32_SYS_shm_unlink 483
#define FREEBSD32_SYS_cpuset 484
#define FREEBSD32_SYS_freebsd32_cpuset_setid 485
+#define FREEBSD32_SYS_freebsd32_cpuset_setid 485
#define FREEBSD32_SYS_freebsd32_cpuset_getid 486
#define FREEBSD32_SYS_freebsd32_cpuset_getaffinity 487
#define FREEBSD32_SYS_freebsd32_cpuset_setaffinity 488
diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c
index 2949d1bbf3d9..9112953979b1 100644
--- a/sys/compat/freebsd32/freebsd32_syscalls.c
+++ b/sys/compat/freebsd32/freebsd32_syscalls.c
@@ -3,10 +3,13 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 200111 2009-12-04 21:52:31Z kib
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 203660 2010-02-08 10:02:01Z ed
*/
const char *freebsd32_syscallnames[] = {
+#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#define PAD64_REQUIRED
+#endif
"syscall", /* 0 = syscall */
"exit", /* 1 = exit */
"fork", /* 2 = fork */
@@ -482,17 +485,30 @@ const char *freebsd32_syscallnames[] = {
"sctp_generic_sendmsg", /* 472 = sctp_generic_sendmsg */
"sctp_generic_sendmsg_iov", /* 473 = sctp_generic_sendmsg_iov */
"sctp_generic_recvmsg", /* 474 = sctp_generic_recvmsg */
+#ifdef PAD64_REQUIRED
"freebsd32_pread", /* 475 = freebsd32_pread */
"freebsd32_pwrite", /* 476 = freebsd32_pwrite */
"freebsd32_mmap", /* 477 = freebsd32_mmap */
"freebsd32_lseek", /* 478 = freebsd32_lseek */
"freebsd32_truncate", /* 479 = freebsd32_truncate */
"freebsd32_ftruncate", /* 480 = freebsd32_ftruncate */
+#else
+ "freebsd32_pread", /* 475 = freebsd32_pread */
+ "freebsd32_pwrite", /* 476 = freebsd32_pwrite */
+ "freebsd32_mmap", /* 477 = freebsd32_mmap */
+ "freebsd32_lseek", /* 478 = freebsd32_lseek */
+ "freebsd32_truncate", /* 479 = freebsd32_truncate */
+ "freebsd32_ftruncate", /* 480 = freebsd32_ftruncate */
+#endif
"thr_kill2", /* 481 = thr_kill2 */
"shm_open", /* 482 = shm_open */
"shm_unlink", /* 483 = shm_unlink */
"cpuset", /* 484 = cpuset */
+#ifdef PAD64_REQUIRED
+ "freebsd32_cpuset_setid", /* 485 = freebsd32_cpuset_setid */
+#else
"freebsd32_cpuset_setid", /* 485 = freebsd32_cpuset_setid */
+#endif
"freebsd32_cpuset_getid", /* 486 = freebsd32_cpuset_getid */
"freebsd32_cpuset_getaffinity", /* 487 = freebsd32_cpuset_getaffinity */
"freebsd32_cpuset_setaffinity", /* 488 = freebsd32_cpuset_setaffinity */
diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c
index 479c92113092..1d768cac271a 100644
--- a/sys/compat/freebsd32/freebsd32_sysent.c
+++ b/sys/compat/freebsd32/freebsd32_sysent.c
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 200111 2009-12-04 21:52:31Z kib
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 203660 2010-02-08 10:02:01Z ed
*/
#include "opt_compat.h"
@@ -44,6 +44,9 @@
/* The casts are bogus but will do for now. */
struct sysent freebsd32_sysent[] = {
+#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#define PAD64_REQUIRED
+#endif
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 0 = syscall */
{ AS(sys_exit_args), (sy_call_t *)sys_exit, AUE_EXIT, NULL, 0, 0, 0 }, /* 1 = exit */
{ 0, (sy_call_t *)fork, AUE_FORK, NULL, 0, 0, 0 }, /* 2 = fork */
@@ -519,17 +522,30 @@ struct sysent freebsd32_sysent[] = {
{ AS(sctp_generic_sendmsg_args), (sy_call_t *)sctp_generic_sendmsg, AUE_NULL, NULL, 0, 0, 0 }, /* 472 = sctp_generic_sendmsg */
{ AS(sctp_generic_sendmsg_iov_args), (sy_call_t *)sctp_generic_sendmsg_iov, AUE_NULL, NULL, 0, 0, 0 }, /* 473 = sctp_generic_sendmsg_iov */
{ AS(sctp_generic_recvmsg_args), (sy_call_t *)sctp_generic_recvmsg, AUE_NULL, NULL, 0, 0, 0 }, /* 474 = sctp_generic_recvmsg */
+#ifdef PAD64_REQUIRED
+ { AS(freebsd32_pread_args), (sy_call_t *)freebsd32_pread, AUE_PREAD, NULL, 0, 0, 0 }, /* 475 = freebsd32_pread */
+ { AS(freebsd32_pwrite_args), (sy_call_t *)freebsd32_pwrite, AUE_PWRITE, NULL, 0, 0, 0 }, /* 476 = freebsd32_pwrite */
+ { AS(freebsd32_mmap_args), (sy_call_t *)freebsd32_mmap, AUE_MMAP, NULL, 0, 0, 0 }, /* 477 = freebsd32_mmap */
+ { AS(freebsd32_lseek_args), (sy_call_t *)freebsd32_lseek, AUE_LSEEK, NULL, 0, 0, 0 }, /* 478 = freebsd32_lseek */
+ { AS(freebsd32_truncate_args), (sy_call_t *)freebsd32_truncate, AUE_TRUNCATE, NULL, 0, 0, 0 }, /* 479 = freebsd32_truncate */
+ { AS(freebsd32_ftruncate_args), (sy_call_t *)freebsd32_ftruncate, AUE_FTRUNCATE, NULL, 0, 0, 0 }, /* 480 = freebsd32_ftruncate */
+#else
{ AS(freebsd32_pread_args), (sy_call_t *)freebsd32_pread, AUE_PREAD, NULL, 0, 0, 0 }, /* 475 = freebsd32_pread */
{ AS(freebsd32_pwrite_args), (sy_call_t *)freebsd32_pwrite, AUE_PWRITE, NULL, 0, 0, 0 }, /* 476 = freebsd32_pwrite */
{ AS(freebsd32_mmap_args), (sy_call_t *)freebsd32_mmap, AUE_MMAP, NULL, 0, 0, 0 }, /* 477 = freebsd32_mmap */
{ AS(freebsd32_lseek_args), (sy_call_t *)freebsd32_lseek, AUE_LSEEK, NULL, 0, 0, 0 }, /* 478 = freebsd32_lseek */
{ AS(freebsd32_truncate_args), (sy_call_t *)freebsd32_truncate, AUE_TRUNCATE, NULL, 0, 0, 0 }, /* 479 = freebsd32_truncate */
{ AS(freebsd32_ftruncate_args), (sy_call_t *)freebsd32_ftruncate, AUE_FTRUNCATE, NULL, 0, 0, 0 }, /* 480 = freebsd32_ftruncate */
+#endif
{ AS(thr_kill2_args), (sy_call_t *)thr_kill2, AUE_KILL, NULL, 0, 0, 0 }, /* 481 = thr_kill2 */
{ AS(shm_open_args), (sy_call_t *)shm_open, AUE_SHMOPEN, NULL, 0, 0, 0 }, /* 482 = shm_open */
{ AS(shm_unlink_args), (sy_call_t *)shm_unlink, AUE_SHMUNLINK, NULL, 0, 0, 0 }, /* 483 = shm_unlink */
{ AS(cpuset_args), (sy_call_t *)cpuset, AUE_NULL, NULL, 0, 0, 0 }, /* 484 = cpuset */
+#ifdef PAD64_REQUIRED
{ AS(freebsd32_cpuset_setid_args), (sy_call_t *)freebsd32_cpuset_setid, AUE_NULL, NULL, 0, 0, 0 }, /* 485 = freebsd32_cpuset_setid */
+#else
+ { AS(freebsd32_cpuset_setid_args), (sy_call_t *)freebsd32_cpuset_setid, AUE_NULL, NULL, 0, 0, 0 }, /* 485 = freebsd32_cpuset_setid */
+#endif
{ AS(freebsd32_cpuset_getid_args), (sy_call_t *)freebsd32_cpuset_getid, AUE_NULL, NULL, 0, 0, 0 }, /* 486 = freebsd32_cpuset_getid */
{ AS(freebsd32_cpuset_getaffinity_args), (sy_call_t *)freebsd32_cpuset_getaffinity, AUE_NULL, NULL, 0, 0, 0 }, /* 487 = freebsd32_cpuset_getaffinity */
{ AS(freebsd32_cpuset_setaffinity_args), (sy_call_t *)freebsd32_cpuset_setaffinity, AUE_NULL, NULL, 0, 0, 0 }, /* 488 = freebsd32_cpuset_setaffinity */
diff --git a/sys/compat/freebsd32/freebsd32_util.h b/sys/compat/freebsd32/freebsd32_util.h
index 6536b2ca1a71..5e5942b0930b 100644
--- a/sys/compat/freebsd32/freebsd32_util.h
+++ b/sys/compat/freebsd32/freebsd32_util.h
@@ -83,4 +83,6 @@ int syscall32_register(int *offset, struct sysent *new_sysent,
int syscall32_deregister(int *offset, struct sysent *old_sysent);
int syscall32_module_handler(struct module *mod, int what, void *arg);
+register_t *freebsd32_copyout_strings(struct image_params *imgp);
+
#endif /* !_COMPAT_FREEBSD32_FREEBSD32_UTIL_H_ */
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
index 3abd6e77d406..4817f7bd077b 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -52,6 +52,10 @@
#include <compat/freebsd32/freebsd32.h>
#include <compat/freebsd32/freebsd32_proto.h>
+#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#define PAD64_REQUIRED
+#endif
+
; Reserved/unimplemented system calls in the range 0-150 inclusive
; are reserved for use in future Berkeley releases.
; Additional system calls implemented in vendor and other
@@ -194,7 +198,6 @@
93 AUE_SELECT STD { int freebsd32_select(int nd, fd_set *in, \
fd_set *ou, fd_set *ex, \
struct timeval32 *tv); }
-; XXX need to override for big-endian - little-endian should work fine.
94 AUE_NULL UNIMPL setdopt
95 AUE_FSYNC NOPROTO { int fsync(int fd); }
96 AUE_SETPRIORITY NOPROTO { int setpriority(int which, int who, \
@@ -315,12 +318,10 @@
172 AUE_NULL UNIMPL nosys
173 AUE_PREAD COMPAT6 { ssize_t freebsd32_pread(int fd, void *buf, \
size_t nbyte, int pad, \
- u_int32_t offsetlo, u_int32_t offsethi); }
-; XXX note - bigendian is different
+ u_int32_t offset1, u_int32_t offset2); }
174 AUE_PWRITE COMPAT6 { ssize_t freebsd32_pwrite(int fd, \
const void *buf, size_t nbyte, int pad, \
- u_int32_t offsetlo, u_int32_t offsethi); }
-; XXX note - bigendian is different
+ u_int32_t offset1, u_int32_t offset2); }
175 AUE_NULL UNIMPL nosys
176 AUE_NTP_ADJTIME NOPROTO { int ntp_adjtime(struct timex *tp); }
177 AUE_NULL UNIMPL sfork (BSD/OS 2.x)
@@ -355,21 +356,17 @@
char *buf, u_int count, int32_t *basep); }
197 AUE_MMAP COMPAT6 { caddr_t freebsd32_mmap(caddr_t addr, \
size_t len, int prot, int flags, int fd, \
- int pad, u_int32_t poslo, \
- u_int32_t poshi); }
+ int pad, u_int32_t pos1, u_int32_t pos2); }
198 AUE_NULL NOPROTO { int nosys(void); } __syscall \
__syscall_args int
-; XXX note - bigendian is different
199 AUE_LSEEK COMPAT6 { off_t freebsd32_lseek(int fd, int pad, \
- u_int32_t offsetlo, u_int32_t offsethi, \
+ u_int32_t offset1, u_int32_t offset2, \
int whence); }
-; XXX note - bigendian is different
200 AUE_TRUNCATE COMPAT6 { int freebsd32_truncate(char *path, \
- int pad, u_int32_t lengthlo, \
- u_int32_t lengthhi); }
-; XXX note - bigendian is different
+ int pad, u_int32_t length1, \
+ u_int32_t length2); }
201 AUE_FTRUNCATE COMPAT6 { int freebsd32_ftruncate(int fd, int pad, \
- u_int32_t lengthlo, u_int32_t lengthhi); }
+ u_int32_t length1, u_int32_t length2); }
202 AUE_SYSCTL STD { int freebsd32_sysctl(int *name, \
u_int namelen, void *old, \
u_int32_t *oldlenp, void *new, \
@@ -402,7 +399,7 @@
;
; The following were introduced with NetBSD/4.4Lite-2
-; They are initialized by thier respective modules/sysinits
+; They are initialized by their respective modules/sysinits
; XXX PROBLEM!!
220 AUE_SEMCTL COMPAT7 { int freebsd32_semctl(int semid, int semnum, \
int cmd, union semun32 *arg); }
@@ -503,12 +500,12 @@
; 289 and 290 from NetBSD (OpenBSD: 267 and 268)
289 AUE_PREADV STD { ssize_t freebsd32_preadv(int fd, \
struct iovec32 *iovp, \
- u_int iovcnt, off_t offset); }
-; XXX note - bigendian is different
+ u_int iovcnt, \
+ u_int32_t offset1, u_int32_t offset2); }
290 AUE_PWRITEV STD { ssize_t freebsd32_pwritev(int fd, \
struct iovec32 *iovp, \
- u_int iovcnt, off_t offset); }
-; XXX note - bigendian is different
+ u_int iovcnt, \
+ u_int32_t offset1, u_int32_t offset2); }
291 AUE_NULL UNIMPL nosys
292 AUE_NULL UNIMPL nosys
293 AUE_NULL UNIMPL nosys
@@ -581,9 +578,8 @@
334 AUE_NULL NOPROTO { int sched_rr_get_interval (pid_t pid, \
struct timespec *interval); }
335 AUE_NULL NOPROTO { int utrace(const void *addr, size_t len); }
-; XXX note - bigendian is different
336 AUE_SENDFILE COMPAT4 { int freebsd32_sendfile(int fd, int s, \
- u_int32_t offsetlo, u_int32_t offsethi, \
+ u_int32_t offset1, u_int32_t offset2, \
size_t nbytes, struct sf_hdtr32 *hdtr, \
off_t *sbytes, int flags); }
337 AUE_NULL NOPROTO { int kldsym(int fileid, int cmd, \
@@ -686,7 +682,7 @@
392 AUE_NULL NOPROTO { int uuidgen(struct uuid *store, \
int count); }
393 AUE_SENDFILE STD { int freebsd32_sendfile(int fd, int s, \
- u_int32_t offsetlo, u_int32_t offsethi, \
+ u_int32_t offset1, u_int32_t offset2, \
size_t nbytes, struct sf_hdtr32 *hdtr, \
off_t *sbytes, int flags); }
394 AUE_NULL UNIMPL mac_syscall
@@ -820,42 +816,74 @@
474 AUE_NULL NOPROTO { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \
struct sockaddr * from, __socklen_t *fromlenaddr, \
struct sctp_sndrcvinfo *sinfo, int *msg_flags); }
+#ifdef PAD64_REQUIRED
475 AUE_PREAD STD { ssize_t freebsd32_pread(int fd, \
void *buf,size_t nbyte, \
- u_int32_t offsetlo, u_int32_t offsethi); }
+ int pad, \
+ u_int32_t offset1, u_int32_t offset2); }
476 AUE_PWRITE STD { ssize_t freebsd32_pwrite(int fd, \
const void *buf, size_t nbyte, \
- u_int32_t offsetlo, u_int32_t offsethi); }
+ int pad, \
+ u_int32_t offset1, u_int32_t offset2); }
477 AUE_MMAP STD { caddr_t freebsd32_mmap(caddr_t addr, \
size_t len, int prot, int flags, int fd, \
- u_int32_t poslo, u_int32_t poshi); }
+ int pad, \
+ u_int32_t pos1, u_int32_t pos2); }
478 AUE_LSEEK STD { off_t freebsd32_lseek(int fd, \
- u_int32_t offsetlo, u_int32_t offsethi, \
+ int pad, \
+ u_int32_t offset1, u_int32_t offset2, \
int whence); }
479 AUE_TRUNCATE STD { int freebsd32_truncate(char *path, \
- u_int32_t lengthlo, u_int32_t lengthhi); }
+ int pad, \
+ u_int32_t length1, u_int32_t length2); }
480 AUE_FTRUNCATE STD { int freebsd32_ftruncate(int fd, \
- u_int32_t lengthlo, u_int32_t lengthhi); }
+ int pad, \
+ u_int32_t length1, u_int32_t length2); }
+#else
+475 AUE_PREAD STD { ssize_t freebsd32_pread(int fd, \
+ void *buf,size_t nbyte, \
+ u_int32_t offset1, u_int32_t offset2); }
+476 AUE_PWRITE STD { ssize_t freebsd32_pwrite(int fd, \
+ const void *buf, size_t nbyte, \
+ u_int32_t offset1, u_int32_t offset2); }
+477 AUE_MMAP STD { caddr_t freebsd32_mmap(caddr_t addr, \
+ size_t len, int prot, int flags, int fd, \
+ u_int32_t pos1, u_int32_t pos2); }
+478 AUE_LSEEK STD { off_t freebsd32_lseek(int fd, \
+ u_int32_t offset1, u_int32_t offset2, \
+ int whence); }
+479 AUE_TRUNCATE STD { int freebsd32_truncate(char *path, \
+ u_int32_t length1, u_int32_t length2); }
+480 AUE_FTRUNCATE STD { int freebsd32_ftruncate(int fd, \
+ u_int32_t length1, u_int32_t length2); }
+#endif
481 AUE_KILL NOPROTO { int thr_kill2(pid_t pid, long id, int sig); }
482 AUE_SHMOPEN NOPROTO { int shm_open(const char *path, int flags, \
mode_t mode); }
483 AUE_SHMUNLINK NOPROTO { int shm_unlink(const char *path); }
484 AUE_NULL NOPROTO { int cpuset(cpusetid_t *setid); }
+#ifdef PAD64_REQUIRED
+485 AUE_NULL STD { int freebsd32_cpuset_setid(cpuwhich_t which, \
+ int pad, \
+ u_int32_t id1, u_int32_t id2, \
+ cpusetid_t setid); }
+#else
485 AUE_NULL STD { int freebsd32_cpuset_setid(cpuwhich_t which, \
- uint32_t idlo, uint32_t idhi, \
+ u_int32_t id1, u_int32_t id2, \
cpusetid_t setid); }
+#endif
486 AUE_NULL STD { int freebsd32_cpuset_getid(cpulevel_t level, \
cpuwhich_t which, \
- uint32_t idlo, uint32_t idhi, \
+ u_int32_t id1, u_int32_t id2, \
cpusetid_t *setid); }
487 AUE_NULL STD { int freebsd32_cpuset_getaffinity( \
cpulevel_t level, cpuwhich_t which, \
- uint32_t idlo, uint32_t idhi, \
+ u_int32_t id1, u_int32_t id2, \
size_t cpusetsize, \
cpuset_t *mask); }
488 AUE_NULL STD { int freebsd32_cpuset_setaffinity( \
cpulevel_t level, cpuwhich_t which, \
- uint32_t idlo, uint32_t idhi, \
+ u_int32_t id1, u_int32_t id2, \
size_t cpusetsize, \
const cpuset_t *mask); }
489 AUE_FACCESSAT NOPROTO { int faccessat(int fd, char *path, int mode, \
diff --git a/sys/compat/ia32/ia32_reg.h b/sys/compat/ia32/ia32_reg.h
index 5a9cdf2eebf9..b93019746074 100644
--- a/sys/compat/ia32/ia32_reg.h
+++ b/sys/compat/ia32/ia32_reg.h
@@ -105,29 +105,6 @@ struct save87 {
u_char sv_pad[64]; /* padding; used by emulators */
};
-
-/*
- * Alternative layouts for <sys/procfs.h>
- * Used in core dumps, the reason for this file existing.
- */
-struct prstatus32 {
- int pr_version;
- u_int pr_statussz;
- u_int pr_gregsetsz;
- u_int pr_fpregsetsz;
- int pr_osreldate;
- int pr_cursig;
- pid_t pr_pid;
- struct reg32 pr_reg;
-};
-
-struct prpsinfo32 {
- int pr_version;
- u_int pr_psinfosz;
- char pr_fname[PRFNAMESZ+1];
- char pr_psargs[PRARGSZ+1];
-};
-
/*
* Wrappers and converters.
*/
diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c
index cb8d33df43ac..79448a52507f 100644
--- a/sys/compat/ia32/ia32_sysvec.c
+++ b/sys/compat/ia32/ia32_sysvec.c
@@ -93,7 +93,6 @@ CTASSERT(sizeof(struct ia32_ucontext4) == 324);
CTASSERT(sizeof(struct ia32_sigframe4) == 408);
#endif
-static register_t *ia32_copyout_strings(struct image_params *imgp);
static void ia32_fixlimit(struct rlimit *rl, int which);
SYSCTL_NODE(_compat, OID_AUTO, ia32, CTLFLAG_RW, 0, "ia32 mode");
@@ -132,7 +131,7 @@ struct sysentvec ia32_freebsd_sysvec = {
.sv_usrstack = FREEBSD32_USRSTACK,
.sv_psstrings = FREEBSD32_PS_STRINGS,
.sv_stackprot = VM_PROT_ALL,
- .sv_copyout_strings = ia32_copyout_strings,
+ .sv_copyout_strings = freebsd32_copyout_strings,
.sv_setregs = ia32_setregs,
.sv_fixlimit = ia32_fixlimit,
.sv_maxssiz = &ia32_maxssiz,
@@ -194,127 +193,6 @@ elf32_dump_thread(struct thread *td __unused, void *dst __unused,
{
}
-
-/* XXX may be freebsd32 MI */
-static register_t *
-ia32_copyout_strings(struct image_params *imgp)
-{
- int argc, envc;
- u_int32_t *vectp;
- char *stringp, *destp;
- u_int32_t *stack_base;
- struct freebsd32_ps_strings *arginfo;
- size_t execpath_len;
- int szsigcode;
-
- /*
- * Calculate string base and vector table pointers.
- * Also deal with signal trampoline code for this exec type.
- */
- if (imgp->execpath != NULL && imgp->auxargs != NULL)
- execpath_len = strlen(imgp->execpath) + 1;
- else
- execpath_len = 0;
- arginfo = (struct freebsd32_ps_strings *)FREEBSD32_PS_STRINGS;
- szsigcode = *(imgp->proc->p_sysent->sv_szsigcode);
- destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE -
- roundup(execpath_len, sizeof(char *)) -
- roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *));
-
- /*
- * install sigcode
- */
- if (szsigcode)
- copyout(imgp->proc->p_sysent->sv_sigcode,
- ((caddr_t)arginfo - szsigcode), szsigcode);
-
- /*
- * Copy the image path for the rtld.
- */
- if (execpath_len != 0) {
- imgp->execpathp = (uintptr_t)arginfo - szsigcode - execpath_len;
- copyout(imgp->execpath, (void *)imgp->execpathp,
- execpath_len);
- }
-
- /*
- * If we have a valid auxargs ptr, prepare some room
- * on the stack.
- */
- if (imgp->auxargs) {
- /*
- * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for
- * lower compatibility.
- */
- imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size
- : (AT_COUNT * 2);
- /*
- * The '+ 2' is for the null pointers at the end of each of
- * the arg and env vector sets,and imgp->auxarg_size is room
- * for argument of Runtime loader.
- */
- vectp = (u_int32_t *) (destp - (imgp->args->argc +
- imgp->args->envc + 2 + imgp->auxarg_size + execpath_len) *
- sizeof(u_int32_t));
- } else
- /*
- * The '+ 2' is for the null pointers at the end of each of
- * the arg and env vector sets
- */
- vectp = (u_int32_t *)
- (destp - (imgp->args->argc + imgp->args->envc + 2) * sizeof(u_int32_t));
-
- /*
- * vectp also becomes our initial stack base
- */
- stack_base = vectp;
-
- stringp = imgp->args->begin_argv;
- argc = imgp->args->argc;
- envc = imgp->args->envc;
- /*
- * Copy out strings - arguments and environment.
- */
- copyout(stringp, destp, ARG_MAX - imgp->args->stringspace);
-
- /*
- * Fill in "ps_strings" struct for ps, w, etc.
- */
- suword32(&arginfo->ps_argvstr, (u_int32_t)(intptr_t)vectp);
- suword32(&arginfo->ps_nargvstr, argc);
-
- /*
- * Fill in argument portion of vector table.
- */
- for (; argc > 0; --argc) {
- suword32(vectp++, (u_int32_t)(intptr_t)destp);
- while (*stringp++ != 0)
- destp++;
- destp++;
- }
-
- /* a null vector table pointer separates the argp's from the envp's */
- suword32(vectp++, 0);
-
- suword32(&arginfo->ps_envstr, (u_int32_t)(intptr_t)vectp);
- suword32(&arginfo->ps_nenvstr, envc);
-
- /*
- * Fill in environment portion of vector table.
- */
- for (; envc > 0; --envc) {
- suword32(vectp++, (u_int32_t)(intptr_t)destp);
- while (*stringp++ != 0)
- destp++;
- destp++;
- }
-
- /* end of vector table is a null pointer */
- suword32(vectp, 0);
-
- return ((register_t *)stack_base);
-}
-
static void
ia32_fixlimit(struct rlimit *rl, int which)
{
diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64
index 9300f898eb3e..905d24637db6 100644
--- a/sys/conf/files.amd64
+++ b/sys/conf/files.amd64
@@ -227,20 +227,20 @@ kern/link_elf_obj.c standard
#
# IA32 binary support
#
-#amd64/ia32/ia32_exception.S optional compat_ia32
-amd64/ia32/ia32_reg.c optional compat_ia32
-amd64/ia32/ia32_signal.c optional compat_ia32
-amd64/ia32/ia32_sigtramp.S optional compat_ia32
-amd64/ia32/ia32_syscall.c optional compat_ia32
-amd64/ia32/ia32_misc.c optional compat_ia32
-compat/freebsd32/freebsd32_ioctl.c optional compat_ia32
-compat/freebsd32/freebsd32_misc.c optional compat_ia32
-compat/freebsd32/freebsd32_syscalls.c optional compat_ia32
-compat/freebsd32/freebsd32_sysent.c optional compat_ia32
-compat/ia32/ia32_sysvec.c optional compat_ia32
+#amd64/ia32/ia32_exception.S optional compat_freebsd32
+amd64/ia32/ia32_reg.c optional compat_freebsd32
+amd64/ia32/ia32_signal.c optional compat_freebsd32
+amd64/ia32/ia32_sigtramp.S optional compat_freebsd32
+amd64/ia32/ia32_syscall.c optional compat_freebsd32
+amd64/ia32/ia32_misc.c optional compat_freebsd32
+compat/freebsd32/freebsd32_ioctl.c optional compat_freebsd32
+compat/freebsd32/freebsd32_misc.c optional compat_freebsd32
+compat/freebsd32/freebsd32_syscalls.c optional compat_freebsd32
+compat/freebsd32/freebsd32_sysent.c optional compat_freebsd32
+compat/ia32/ia32_sysvec.c optional compat_freebsd32
compat/linprocfs/linprocfs.c optional linprocfs
compat/linsysfs/linsysfs.c optional linsysfs
-kern/imgact_elf32.c optional compat_ia32
+kern/imgact_elf32.c optional compat_freebsd32
#
# Linux/i386 binary support
#
diff --git a/sys/conf/files.ia64 b/sys/conf/files.ia64
index 86ca96394d2e..33d93acfdbfe 100644
--- a/sys/conf/files.ia64
+++ b/sys/conf/files.ia64
@@ -28,11 +28,11 @@ ukbdmap.h optional ukbd_dflt_keymap \
no-obj no-implicit-rule before-depend \
clean "ukbdmap.h"
#
-compat/freebsd32/freebsd32_ioctl.c optional compat_ia32
-compat/freebsd32/freebsd32_misc.c optional compat_ia32
-compat/freebsd32/freebsd32_syscalls.c optional compat_ia32
-compat/freebsd32/freebsd32_sysent.c optional compat_ia32
-compat/ia32/ia32_sysvec.c optional compat_ia32
+compat/freebsd32/freebsd32_ioctl.c optional compat_freebsd32
+compat/freebsd32/freebsd32_misc.c optional compat_freebsd32
+compat/freebsd32/freebsd32_syscalls.c optional compat_freebsd32
+compat/freebsd32/freebsd32_sysent.c optional compat_freebsd32
+compat/ia32/ia32_sysvec.c optional compat_freebsd32
contrib/ia64/libuwx/src/uwx_bstream.c standard
contrib/ia64/libuwx/src/uwx_context.c standard
contrib/ia64/libuwx/src/uwx_env.c standard
@@ -68,10 +68,10 @@ ia64/acpica/madt.c optional acpi
ia64/disasm/disasm_decode.c standard
ia64/disasm/disasm_extract.c standard
ia64/disasm/disasm_format.c standard
-ia64/ia32/ia32_misc.c optional compat_ia32
-ia64/ia32/ia32_reg.c optional compat_ia32
-ia64/ia32/ia32_signal.c optional compat_ia32
-ia64/ia32/ia32_trap.c optional compat_ia32
+ia64/ia32/ia32_misc.c optional compat_freebsd32
+ia64/ia32/ia32_reg.c optional compat_freebsd32
+ia64/ia32/ia32_signal.c optional compat_freebsd32
+ia64/ia32/ia32_trap.c optional compat_freebsd32
ia64/ia64/autoconf.c standard
ia64/ia64/bus_machdep.c standard
ia64/ia64/busdma_machdep.c standard
@@ -117,7 +117,7 @@ ia64/isa/isa_dma.c optional isa
ia64/pci/pci_cfgreg.c optional pci
isa/syscons_isa.c optional sc
isa/vga_isa.c optional vga
-kern/imgact_elf32.c optional compat_ia32
+kern/imgact_elf32.c optional compat_freebsd32
libkern/bcmp.c standard
libkern/ffsl.c standard
libkern/fls.c standard
diff --git a/sys/conf/options.amd64 b/sys/conf/options.amd64
index 5617da4e181d..20a49a188c6e 100644
--- a/sys/conf/options.amd64
+++ b/sys/conf/options.amd64
@@ -11,7 +11,7 @@ MP_WATCHDOG
# Options for emulators. These should only be used at config time, so
# they are handled like options for static filesystems
# (see src/sys/conf/options), except for broken debugging options.
-COMPAT_IA32 opt_compat.h
+COMPAT_FREEBSD32 opt_compat.h
#IBCS2 opt_dontuse.h
#COMPAT_LINUX opt_dontuse.h
COMPAT_LINUX32 opt_compat.h
diff --git a/sys/conf/options.ia64 b/sys/conf/options.ia64
index 7a292ed711d5..603c5ed011f1 100644
--- a/sys/conf/options.ia64
+++ b/sys/conf/options.ia64
@@ -9,7 +9,7 @@ LOG2_PAGE_SIZE opt_global.h
UWX_TRACE_ENABLE opt_global.h
-COMPAT_IA32 opt_compat.h
+COMPAT_FREEBSD32 opt_compat.h
EXCEPTION_TRACING opt_xtrace.h
diff --git a/sys/fs/procfs/procfs_dbregs.c b/sys/fs/procfs/procfs_dbregs.c
index efa4e14d668d..68945ef952fe 100644
--- a/sys/fs/procfs/procfs_dbregs.c
+++ b/sys/fs/procfs/procfs_dbregs.c
@@ -59,10 +59,9 @@
#include <fs/pseudofs/pseudofs.h>
#include <fs/procfs/procfs.h>
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
#include <sys/procfs.h>
#include <machine/fpu.h>
-#include <compat/ia32/ia32_reg.h>
/*
* PROC(write, dbregs, td2, &r) becomes
@@ -90,7 +89,7 @@ procfs_doprocdbregs(PFS_FILL_ARGS)
int error;
struct dbreg r;
struct thread *td2;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
struct dbreg32 r32;
int wrap32 = 0;
#endif
@@ -106,7 +105,7 @@ procfs_doprocdbregs(PFS_FILL_ARGS)
}
td2 = FIRST_THREAD_IN_PROC(p);
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (SV_CURPROC_FLAG(SV_ILP32)) {
if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) {
PROC_UNLOCK(p);
diff --git a/sys/fs/procfs/procfs_fpregs.c b/sys/fs/procfs/procfs_fpregs.c
index 43af53e3ce59..c35b0660f1ad 100644
--- a/sys/fs/procfs/procfs_fpregs.c
+++ b/sys/fs/procfs/procfs_fpregs.c
@@ -53,10 +53,9 @@
#include <fs/pseudofs/pseudofs.h>
#include <fs/procfs/procfs.h>
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
#include <sys/procfs.h>
#include <machine/fpu.h>
-#include <compat/ia32/ia32_reg.h>
/*
* PROC(write, fpregs, td2, &r) becomes
@@ -84,7 +83,7 @@ procfs_doprocfpregs(PFS_FILL_ARGS)
int error;
struct fpreg r;
struct thread *td2;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
struct fpreg32 r32;
int wrap32 = 0;
#endif
@@ -101,7 +100,7 @@ procfs_doprocfpregs(PFS_FILL_ARGS)
/* XXXKSE: */
td2 = FIRST_THREAD_IN_PROC(p);
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (SV_CURPROC_FLAG(SV_ILP32)) {
if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) {
PROC_UNLOCK(p);
diff --git a/sys/fs/procfs/procfs_ioctl.c b/sys/fs/procfs/procfs_ioctl.c
index ccff555280f6..4b45af67009e 100644
--- a/sys/fs/procfs/procfs_ioctl.c
+++ b/sys/fs/procfs/procfs_ioctl.c
@@ -42,7 +42,7 @@
#include <fs/pseudofs/pseudofs.h>
#include <fs/procfs/procfs.h>
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
struct procfs_status32 {
int state; /* Running, stopped, something else? */
int flags; /* Any flags */
@@ -62,7 +62,7 @@ int
procfs_ioctl(PFS_IOCTL_ARGS)
{
struct procfs_status *ps;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
struct procfs_status32 *ps32;
#endif
int error, flags, sig;
@@ -142,7 +142,7 @@ procfs_ioctl(PFS_IOCTL_ARGS)
ps->why = p->p_step ? p->p_stype : 0;
ps->val = p->p_step ? p->p_xstat : 0;
break;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
case PIOCWAIT32:
while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) {
/* sleep until p stops */
diff --git a/sys/fs/procfs/procfs_map.c b/sys/fs/procfs/procfs_map.c
index 878e2d5a6580..2622d1e335fa 100644
--- a/sys/fs/procfs/procfs_map.c
+++ b/sys/fs/procfs/procfs_map.c
@@ -47,7 +47,7 @@
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/sbuf.h>
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
#include <sys/sysent.h>
#endif
#include <sys/uio.h>
@@ -86,7 +86,7 @@ procfs_doprocmap(PFS_FILL_ARGS)
struct uidinfo *uip;
int error, vfslocked;
unsigned int last_timestamp;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
int wrap32 = 0;
#endif
@@ -99,7 +99,7 @@ procfs_doprocmap(PFS_FILL_ARGS)
if (uio->uio_rw != UIO_READ)
return (EOPNOTSUPP);
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (curproc->p_sysent->sv_flags & SV_ILP32) {
if (!(p->p_sysent->sv_flags & SV_ILP32))
return (EOPNOTSUPP);
@@ -209,7 +209,7 @@ procfs_doprocmap(PFS_FILL_ARGS)
"0x%lx 0x%lx %d %d %p %s%s%s %d %d 0x%x %s %s %s %s %s %d\n",
(u_long)e_start, (u_long)e_end,
resident, privateresident,
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
wrap32 ? NULL : obj, /* Hide 64 bit value */
#else
obj,
diff --git a/sys/fs/procfs/procfs_regs.c b/sys/fs/procfs/procfs_regs.c
index 82922fbe8974..5bf1c0ac7f9f 100644
--- a/sys/fs/procfs/procfs_regs.c
+++ b/sys/fs/procfs/procfs_regs.c
@@ -53,10 +53,9 @@
#include <fs/pseudofs/pseudofs.h>
#include <fs/procfs/procfs.h>
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
#include <sys/procfs.h>
#include <machine/fpu.h>
-#include <compat/ia32/ia32_reg.h>
/*
* PROC(write, regs, td2, &r) becomes
@@ -84,7 +83,7 @@ procfs_doprocregs(PFS_FILL_ARGS)
int error;
struct reg r;
struct thread *td2;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
struct reg32 r32;
int wrap32 = 0;
#endif
@@ -101,7 +100,7 @@ procfs_doprocregs(PFS_FILL_ARGS)
/* XXXKSE: */
td2 = FIRST_THREAD_IN_PROC(p);
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (SV_CURPROC_FLAG(SV_ILP32)) {
if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) {
PROC_UNLOCK(p);
diff --git a/sys/ia64/conf/GENERIC b/sys/ia64/conf/GENERIC
index b64c0143bd4c..fed28bbb6402 100644
--- a/sys/ia64/conf/GENERIC
+++ b/sys/ia64/conf/GENERIC
@@ -28,6 +28,7 @@ makeoptions DEBUG=-g # Build kernel with debug information.
options AUDIT # Security event auditing
options CD9660 # ISO 9660 Filesystem
options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty)
+options COMPAT_FREEBSD32 # Compatible with FreeBSD6
options COMPAT_FREEBSD6 # Compatible with FreeBSD6
options COMPAT_FREEBSD7 # Compatible with FreeBSD7
options DDB # Support DDB
diff --git a/sys/ia64/conf/NOTES b/sys/ia64/conf/NOTES
index 873199a61b01..3f3821856b10 100644
--- a/sys/ia64/conf/NOTES
+++ b/sys/ia64/conf/NOTES
@@ -12,10 +12,10 @@
cpu ITANIUM
cpu ITANIUM2
-# option: COMPAT_IA32
+# option: COMPAT_FREEBSD32
# This option enables the support for execution of i386 (32-bit) programs on
# ia64. It is based on the ia32 emulation in the processor.
-options COMPAT_IA32
+options COMPAT_FREEBSD32
# option: LOG2_ID_PAGE_SIZE
# Specify the log2 size of the identity (direct) mappings in regions 6 and 7
diff --git a/sys/ia64/ia64/exception.S b/sys/ia64/ia64/exception.S
index 3a4ac0331bfb..2868c8a3f771 100644
--- a/sys/ia64/ia64/exception.S
+++ b/sys/ia64/ia64/exception.S
@@ -676,7 +676,7 @@ ivt_##name: \
#define IVT_END(name) \
.endp ivt_##name
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
#define IA32_TRAP ia32_trap
#else
#define IA32_TRAP trap
diff --git a/sys/ia64/ia64/genassym.c b/sys/ia64/ia64/genassym.c
index 9f7625279d9c..d81054b9cea1 100644
--- a/sys/ia64/ia64/genassym.c
+++ b/sys/ia64/ia64/genassym.c
@@ -61,8 +61,8 @@
#include <net/if.h>
#include <netinet/in.h>
-#ifdef COMPAT_IA32
-ASSYM(COMPAT_IA32, COMPAT_IA32);
+#ifdef COMPAT_FREEBSD32
+ASSYM(COMPAT_FREEBSD32, COMPAT_FREEBSD32);
#endif
ASSYM(DT_NULL, DT_NULL);
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c
index cddf6c0b8f96..cb64f7fc804a 100644
--- a/sys/ia64/ia64/machdep.c
+++ b/sys/ia64/ia64/machdep.c
@@ -443,7 +443,7 @@ cpu_switch(struct thread *old, struct thread *new, struct mtx *mtx)
struct pcb *oldpcb, *newpcb;
oldpcb = old->td_pcb;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
ia32_savectx(oldpcb);
#endif
if (PCPU_GET(fpcurthread) == old)
@@ -459,7 +459,7 @@ cpu_switch(struct thread *old, struct thread *new, struct mtx *mtx)
oldpcb->pcb_current_pmap =
pmap_switch(newpcb->pcb_current_pmap);
PCPU_SET(curthread, new);
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
ia32_restorectx(newpcb);
#endif
if (PCPU_GET(fpcurthread) == new)
@@ -479,7 +479,7 @@ cpu_throw(struct thread *old __unused, struct thread *new)
newpcb = new->td_pcb;
(void)pmap_switch(newpcb->pcb_current_pmap);
PCPU_SET(curthread, new);
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
ia32_restorectx(newpcb);
#endif
restorectx(newpcb);
diff --git a/sys/ia64/include/elf.h b/sys/ia64/include/elf.h
index c6a43fcdc170..27182dbcae95 100644
--- a/sys/ia64/include/elf.h
+++ b/sys/ia64/include/elf.h
@@ -43,6 +43,7 @@
#include <sys/elf_generic.h>
#define ELF_ARCH EM_IA_64
+#define ELF_ARCH32 EM_386
#define ELF_MACHINE_OK(x) ((x) == EM_IA_64)
diff --git a/sys/ia64/include/reg.h b/sys/ia64/include/reg.h
index 453c9b831412..e95db312d4a8 100644
--- a/sys/ia64/include/reg.h
+++ b/sys/ia64/include/reg.h
@@ -31,6 +31,10 @@
#include <machine/_regset.h>
+#if defined(_KERNEL) && !defined(_STANDALONE)
+#include "opt_compat.h"
+#endif
+
struct reg {
struct _special r_special;
struct _callee_saved r_preserved;
@@ -48,6 +52,11 @@ struct dbreg {
unsigned long dbr_inst[8];
};
+#ifdef COMPAT_FREEBSD32
+#include <machine/fpu.h>
+#include <compat/ia32/ia32_reg.h>
+#endif
+
#ifdef _KERNEL
struct thread;
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 7e48a3b5e641..0fffb9fb4c97 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -75,11 +75,6 @@ __FBSDID("$FreeBSD$");
#include <machine/elf.h>
#include <machine/md_var.h>
-#if defined(COMPAT_IA32) && __ELF_WORD_SIZE == 32
-#include <machine/fpu.h>
-#include <compat/ia32/ia32_reg.h>
-#endif
-
#define OLD_EI_BRAND 8
static int __elfN(check_header)(const Elf_Ehdr *hdr);
@@ -1303,7 +1298,9 @@ __elfN(corehdr)(td, vp, cred, numsegs, hdr, hdrsize, gzfile)
}
}
-#if defined(COMPAT_IA32) && __ELF_WORD_SIZE == 32
+#if defined(COMPAT_FREEBSD32) && __ELF_WORD_SIZE == 32
+#include <compat/freebsd32/freebsd32.h>
+
typedef struct prstatus32 elf_prstatus_t;
typedef struct prpsinfo32 elf_prpsinfo_t;
typedef struct fpreg32 elf_prfpregset_t;
@@ -1387,7 +1384,7 @@ __elfN(puthdr)(struct thread *td, void *dst, size_t *off, int numsegs)
status->pr_osreldate = osreldate;
status->pr_cursig = p->p_sig;
status->pr_pid = thr->td_tid;
-#if defined(COMPAT_IA32) && __ELF_WORD_SIZE == 32
+#if defined(COMPAT_FREEBSD32) && __ELF_WORD_SIZE == 32
fill_regs32(thr, &status->pr_reg);
fill_fpregs32(thr, fpregset);
#else
@@ -1439,8 +1436,8 @@ __elfN(puthdr)(struct thread *td, void *dst, size_t *off, int numsegs)
ehdr->e_ident[EI_ABIVERSION] = 0;
ehdr->e_ident[EI_PAD] = 0;
ehdr->e_type = ET_CORE;
-#if defined(COMPAT_IA32) && __ELF_WORD_SIZE == 32
- ehdr->e_machine = EM_386;
+#if defined(COMPAT_FREEBSD32) && __ELF_WORD_SIZE == 32
+ ehdr->e_machine = ELF_ARCH32;
#else
ehdr->e_machine = ELF_ARCH;
#endif
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index 93fdfa9303bc..d419833dadaf 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -734,8 +734,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags)
}
}
-#ifdef COMPAT_IA32
- if (td->td_proc->p_sysent->sv_flags & SV_IA32) {
+#ifdef COMPAT_FREEBSD32
+ if (td->td_proc->p_sysent->sv_flags & SV_ILP32) {
uint32_t hid32;
error = vfs_copyopt(opts, "host.hostid", &hid32, sizeof(hid32));
@@ -1961,8 +1961,8 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags)
error = vfs_setopts(opts, "host.hostuuid", pr->pr_hostuuid);
if (error != 0 && error != ENOENT)
goto done_deref;
-#ifdef COMPAT_IA32
- if (td->td_proc->p_sysent->sv_flags & SV_IA32) {
+#ifdef COMPAT_FREEBSD32
+ if (td->td_proc->p_sysent->sv_flags & SV_ILP32) {
uint32_t hid32 = pr->pr_hostid;
error = vfs_setopt(opts, "host.hostid", &hid32, sizeof(hid32));
diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c
index 9c53bf6f4638..0409344b9b08 100644
--- a/sys/kern/kern_module.c
+++ b/sys/kern/kern_module.c
@@ -446,7 +446,7 @@ modfind(struct thread *td, struct modfind_args *uap)
MODULE_VERSION(kernel, __FreeBSD_version);
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
#include <sys/mount.h>
#include <sys/socket.h>
#include <compat/freebsd32/freebsd32_util.h>
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c
index 116e79bae333..0b90dfc34067 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$");
#include <security/audit/audit.h>
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
static inline int
suword_lwpid(void *addr, lwpid_t lwpid)
diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
index 14a79a3dafa6..137ffe535052 100644
--- a/sys/kern/kern_umtx.c
+++ b/sys/kern/kern_umtx.c
@@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$");
#include <machine/cpu.h>
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
#include <compat/freebsd32/freebsd32_proto.h>
#endif
@@ -818,7 +818,7 @@ do_unlock_umtx(struct thread *td, struct umtx *umtx, u_long id)
return (0);
}
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
/*
* Lock a umtx object.
@@ -3269,7 +3269,7 @@ _umtx_op(struct thread *td, struct _umtx_op_args *uap)
return (EINVAL);
}
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
int
freebsd32_umtx_lock(struct thread *td, struct freebsd32_umtx_lock_args *uap)
/* struct umtx *umtx */
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index b34af6132372..eaefd9c69035 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -878,9 +878,10 @@ kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
sbp = selbits;
#define getbits(name, x) \
do { \
- if (name == NULL) \
+ if (name == NULL) { \
ibits[x] = NULL; \
- else { \
+ obits[x] = NULL; \
+ } else { \
ibits[x] = sbp + nbufbytes / 2 / sizeof *sbp; \
obits[x] = sbp; \
sbp += ncpbytes / sizeof *sbp; \
@@ -895,6 +896,28 @@ kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
getbits(fd_ou, 1);
getbits(fd_ex, 2);
#undef getbits
+
+#if BYTE_ORDER == BIG_ENDIAN && defined(__LP64__)
+ /*
+ * XXX: swizzle_fdset assumes that if abi_nfdbits != NFDBITS,
+ * we are running under 32-bit emulation. This should be more
+ * generic.
+ */
+#define swizzle_fdset(bits) \
+ if (abi_nfdbits != NFDBITS && bits != NULL) { \
+ int i; \
+ for (i = 0; i < ncpbytes / sizeof *sbp; i++) \
+ bits[i] = (bits[i] >> 32) | (bits[i] << 32); \
+ }
+#else
+#define swizzle_fdset(bits)
+#endif
+
+ /* Make sure the bit order makes it through an ABI transition */
+ swizzle_fdset(ibits[0]);
+ swizzle_fdset(ibits[1]);
+ swizzle_fdset(ibits[2]);
+
if (nbufbytes != 0)
bzero(selbits, nbufbytes / 2);
@@ -941,6 +964,13 @@ done:
error = EINTR;
if (error == EWOULDBLOCK)
error = 0;
+
+ /* swizzle bit order back, if necessary */
+ swizzle_fdset(obits[0]);
+ swizzle_fdset(obits[1]);
+ swizzle_fdset(obits[2]);
+#undef swizzle_fdset
+
#define putbits(name, x) \
if (name && (error2 = copyout(obits[x], name, ncpubytes))) \
error = error2;
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index d4b5d4dec8de..f5671d9c608a 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -62,10 +62,8 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_pager.h>
#include <vm/vm_param.h>
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
#include <sys/procfs.h>
-#include <machine/fpu.h>
-#include <compat/ia32/ia32_reg.h>
struct ptrace_io_desc32 {
int piod_op;
@@ -172,7 +170,7 @@ proc_write_fpregs(struct thread *td, struct fpreg *fpregs)
PROC_ACTION(set_fpregs(td, fpregs));
}
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
/* For 32 bit binaries, we need to expose the 32 bit regs layouts. */
int
proc_read_regs32(struct thread *td, struct reg32 *regs32)
@@ -473,7 +471,7 @@ ptrace_vm_entry(struct thread *td, struct proc *p, struct ptrace_vm_entry *pve)
return (error);
}
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
static int
ptrace_vm_entry32(struct thread *td, struct proc *p,
struct ptrace_vm_entry32 *pve32)
@@ -500,7 +498,7 @@ ptrace_vm_entry32(struct thread *td, struct proc *p,
pve32->pve_pathlen = pve.pve_pathlen;
return (error);
}
-#endif /* COMPAT_IA32 */
+#endif /* COMPAT_FREEBSD32 */
/*
* Process debugging system call.
@@ -514,7 +512,7 @@ struct ptrace_args {
};
#endif
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
/*
* This CPP subterfuge is to try and reduce the number of ifdefs in
* the body of the code.
@@ -549,7 +547,7 @@ ptrace(struct thread *td, struct ptrace_args *uap)
struct dbreg dbreg;
struct fpreg fpreg;
struct reg reg;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
struct dbreg32 dbreg32;
struct fpreg32 fpreg32;
struct reg32 reg32;
@@ -559,7 +557,7 @@ ptrace(struct thread *td, struct ptrace_args *uap)
} r;
void *addr;
int error = 0;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
int wrap32 = 0;
if (SV_CURPROC_FLAG(SV_ILP32))
@@ -627,7 +625,7 @@ ptrace(struct thread *td, struct ptrace_args *uap)
#undef COPYIN
#undef COPYOUT
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
/*
* PROC_READ(regs, td2, addr);
* becomes either:
@@ -661,7 +659,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
int error, write, tmp, num;
int proctree_locked = 0;
lwpid_t tid = 0, *buf;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
int wrap32 = 0, safe = 0;
struct ptrace_io_desc32 *piod32 = NULL;
#endif
@@ -749,7 +747,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
tid = td2->td_tid;
}
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
/*
* Test if we're a 32 bit client and what the target is.
* Set the wrap controls accordingly.
@@ -1017,7 +1015,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
break;
case PT_IO:
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (wrap32) {
piod32 = addr;
iov.iov_base = (void *)(uintptr_t)piod32->piod_addr;
@@ -1037,7 +1035,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
uio.uio_iovcnt = 1;
uio.uio_segflg = UIO_USERSPACE;
uio.uio_td = td;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
tmp = wrap32 ? piod32->piod_op : piod->piod_op;
#else
tmp = piod->piod_op;
@@ -1058,7 +1056,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
}
PROC_UNLOCK(p);
error = proc_rwmem(p, &uio);
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (wrap32)
piod32->piod_len -= uio.uio_resid;
else
@@ -1147,7 +1145,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
case PT_VM_ENTRY:
PROC_UNLOCK(p);
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (wrap32)
error = ptrace_vm_entry32(td, p, addr);
else
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 5cbdc4086a9e..569aed097603 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -136,7 +136,7 @@ __FBSDID("$FreeBSD$");
#include <vm/uma.h>
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
#include <sys/mount.h>
#include <sys/sysent.h>
#include <compat/freebsd32/freebsd32.h>
@@ -2507,7 +2507,7 @@ sosetopt(struct socket *so, struct sockopt *sopt)
case SO_SNDTIMEO:
case SO_RCVTIMEO:
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (SV_CURPROC_FLAG(SV_ILP32)) {
struct timeval32 tv32;
@@ -2688,7 +2688,7 @@ integer:
tv.tv_sec = optval / hz;
tv.tv_usec = (optval % hz) * tick;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (SV_CURPROC_FLAG(SV_ILP32)) {
struct timeval32 tv32;
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index 088e4f6431a3..25328d6f6a6d 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -2532,7 +2532,7 @@ filt_lio(struct knote *kn, long hint)
return (lj->lioj_flags & LIOJ_KEVENT_POSTED);
}
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
#include <sys/mount.h>
#include <sys/socket.h>
#include <compat/freebsd32/freebsd32.h>
diff --git a/sys/modules/linux/Makefile b/sys/modules/linux/Makefile
index a24b6b27be7f..a67fcc70284b 100644
--- a/sys/modules/linux/Makefile
+++ b/sys/modules/linux/Makefile
@@ -2,7 +2,7 @@
.if ${MACHINE_ARCH} == "amd64"
SFX= 32
-CFLAGS+=-DCOMPAT_IA32 -DCOMPAT_LINUX32
+CFLAGS+=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32
.endif
.PATH: ${.CURDIR}/../../compat/linux ${.CURDIR}/../../${MACHINE_ARCH}/linux${SFX}
diff --git a/sys/modules/procfs/Makefile b/sys/modules/procfs/Makefile
index c3b36337f02e..9a94838c70a3 100644
--- a/sys/modules/procfs/Makefile
+++ b/sys/modules/procfs/Makefile
@@ -35,7 +35,7 @@ opt_compat.h:
echo "#define COMPAT_FREEBSD5 1" >> ${.TARGET}
echo "#define COMPAT_FREEBSD6 1" >> ${.TARGET}
.if ${MACHINE_ARCH} == "amd64"
- echo "#define COMPAT_IA32 1" >> ${.TARGET}
+ echo "#define COMPAT_FREEBSD32 1" >> ${.TARGET}
echo "#define COMPAT_LINUX32 1" >> ${.TARGET}
.endif
.endif
diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h
index e3653b657d1a..b30447cfb682 100644
--- a/sys/sys/ptrace.h
+++ b/sys/sys/ptrace.h
@@ -34,6 +34,7 @@
#define _SYS_PTRACE_H_
#include <sys/_sigset.h>
+#include <machine/reg.h>
#define PT_TRACE_ME 0 /* child declares it's being traced */
#define PT_READ_I 1 /* read word in child's I space */
@@ -157,7 +158,7 @@ int proc_read_dbregs(struct thread *_td, struct dbreg *_dbreg);
int proc_write_dbregs(struct thread *_td, struct dbreg *_dbreg);
int proc_sstep(struct thread *_td);
int proc_rwmem(struct proc *_p, struct uio *_uio);
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
struct reg32;
struct fpreg32;
struct dbreg32;