svn commit: r199285 - in projects/ppc64/sys: amd64/conf
compat/freebsd32 compat/ia32 conf kern sys
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Sun Nov 15 07:25:24 UTC 2009
Author: nwhitehorn
Date: Sun Nov 15 07:25:24 2009
New Revision: 199285
URL: http://svn.freebsd.org/changeset/base/199285
Log:
Make 32-bit compatibility a little more MI. This separates the COMPAT_IA32
kernel option into an architectural component (COMPAT_IA32 for that arch)
and an OS component like COMPAT_LINUX[32] (COMPAT_FREEBSD32). Not yet
fully tested. Most of the changes are rototilling source code and making
things marked "XXX: might be MI" actually be MI.
Discussed with: Warner Losh
Modified:
projects/ppc64/sys/amd64/conf/GENERIC
projects/ppc64/sys/compat/freebsd32/freebsd32_misc.c
projects/ppc64/sys/compat/freebsd32/freebsd32_proto.h
projects/ppc64/sys/compat/ia32/ia32_sysvec.c
projects/ppc64/sys/conf/files.amd64
projects/ppc64/sys/conf/files.ia64
projects/ppc64/sys/conf/options.amd64
projects/ppc64/sys/conf/options.ia64
projects/ppc64/sys/kern/imgact_elf.c
projects/ppc64/sys/kern/kern_jail.c
projects/ppc64/sys/kern/kern_module.c
projects/ppc64/sys/kern/kern_thr.c
projects/ppc64/sys/kern/kern_umtx.c
projects/ppc64/sys/kern/sys_process.c
projects/ppc64/sys/kern/uipc_socket.c
projects/ppc64/sys/kern/vfs_aio.c
projects/ppc64/sys/sys/ptrace.h
projects/ppc64/sys/sys/sysctl.h
Modified: projects/ppc64/sys/amd64/conf/GENERIC
==============================================================================
--- projects/ppc64/sys/amd64/conf/GENERIC Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/amd64/conf/GENERIC Sun Nov 15 07:25:24 2009 (r199285)
@@ -55,6 +55,7 @@ options GEOM_PART_GPT # GUID Partition
options GEOM_LABEL # Provides labelization
options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty)
options COMPAT_IA32 # Compatible with i386 binaries
+options COMPAT_FREEBSD32
options COMPAT_FREEBSD4 # Compatible with FreeBSD4
options COMPAT_FREEBSD5 # Compatible with FreeBSD5
options COMPAT_FREEBSD6 # Compatible with FreeBSD6
Modified: projects/ppc64/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- projects/ppc64/sys/compat/freebsd32/freebsd32_misc.c Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/compat/freebsd32/freebsd32_misc.c Sun Nov 15 07:25:24 2009 (r199285)
@@ -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>
@@ -3072,3 +3076,123 @@ syscall32_module_handler(struct module *
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);
+}
+
Modified: projects/ppc64/sys/compat/freebsd32/freebsd32_proto.h
==============================================================================
--- projects/ppc64/sys/compat/freebsd32/freebsd32_proto.h Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/compat/freebsd32/freebsd32_proto.h Sun Nov 15 07:25:24 2009 (r199285)
@@ -17,8 +17,8 @@
#include <bsm/audit_kevents.h>
+struct image_params;
struct proc;
-
struct thread;
#define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \
@@ -545,6 +545,7 @@ int freebsd32_semctl(struct thread *, st
int freebsd32_msgctl(struct thread *, struct freebsd32_msgctl_args *);
int freebsd32_shmctl(struct thread *, struct freebsd32_shmctl_args *);
int freebsd32_pselect(struct thread *, struct freebsd32_pselect_args *);
+register_t *freebsd32_copyout_strings(struct image_params *imgp);
#ifdef COMPAT_43
Modified: projects/ppc64/sys/compat/ia32/ia32_sysvec.c
==============================================================================
--- projects/ppc64/sys/compat/ia32/ia32_sysvec.c Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/compat/ia32/ia32_sysvec.c Sun Nov 15 07:25:24 2009 (r199285)
@@ -93,7 +93,6 @@ CTASSERT(sizeof(struct ia32_ucontext4) =
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 __un
{
}
-
-/* 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)
{
Modified: projects/ppc64/sys/conf/files.amd64
==============================================================================
--- projects/ppc64/sys/conf/files.amd64 Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/conf/files.amd64 Sun Nov 15 07:25:24 2009 (r199285)
@@ -241,10 +241,10 @@ amd64/ia32/ia32_signal.c optional compat
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/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_ia32
compat/linprocfs/linprocfs.c optional linprocfs
compat/linsysfs/linsysfs.c optional linsysfs
Modified: projects/ppc64/sys/conf/files.ia64
==============================================================================
--- projects/ppc64/sys/conf/files.ia64 Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/conf/files.ia64 Sun Nov 15 07:25:24 2009 (r199285)
@@ -28,10 +28,10 @@ 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/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_ia32
contrib/ia64/libuwx/src/uwx_bstream.c standard
contrib/ia64/libuwx/src/uwx_context.c standard
Modified: projects/ppc64/sys/conf/options.amd64
==============================================================================
--- projects/ppc64/sys/conf/options.amd64 Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/conf/options.amd64 Sun Nov 15 07:25:24 2009 (r199285)
@@ -12,6 +12,7 @@ MP_WATCHDOG
# 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
Modified: projects/ppc64/sys/conf/options.ia64
==============================================================================
--- projects/ppc64/sys/conf/options.ia64 Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/conf/options.ia64 Sun Nov 15 07:25:24 2009 (r199285)
@@ -10,6 +10,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
Modified: projects/ppc64/sys/kern/imgact_elf.c
==============================================================================
--- projects/ppc64/sys/kern/imgact_elf.c Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/kern/imgact_elf.c Sun Nov 15 07:25:24 2009 (r199285)
@@ -1210,7 +1210,7 @@ __elfN(corehdr)(td, vp, cred, numsegs, h
td));
}
-#if defined(COMPAT_IA32) && __ELF_WORD_SIZE == 32
+#if defined(COMPAT_FREEBSD32) && __ELF_WORD_SIZE == 32
typedef struct prstatus32 elf_prstatus_t;
typedef struct prpsinfo32 elf_prpsinfo_t;
typedef struct fpreg32 elf_prfpregset_t;
@@ -1294,7 +1294,7 @@ __elfN(puthdr)(struct thread *td, void *
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
@@ -1346,7 +1346,7 @@ __elfN(puthdr)(struct thread *td, void *
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
+#if defined(COMPAT_FREEBSD32) && __ELF_WORD_SIZE == 32
ehdr->e_machine = EM_386;
#else
ehdr->e_machine = ELF_ARCH;
Modified: projects/ppc64/sys/kern/kern_jail.c
==============================================================================
--- projects/ppc64/sys/kern/kern_jail.c Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/kern/kern_jail.c Sun Nov 15 07:25:24 2009 (r199285)
@@ -707,7 +707,7 @@ kern_jail_set(struct thread *td, struct
}
}
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (td->td_proc->p_sysent->sv_flags & SV_IA32) {
uint32_t hid32;
@@ -1929,7 +1929,7 @@ kern_jail_get(struct thread *td, struct
error = vfs_setopts(opts, "host.hostuuid", pr->pr_hostuuid);
if (error != 0 && error != ENOENT)
goto done_deref;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (td->td_proc->p_sysent->sv_flags & SV_IA32) {
uint32_t hid32 = pr->pr_hostid;
Modified: projects/ppc64/sys/kern/kern_module.c
==============================================================================
--- projects/ppc64/sys/kern/kern_module.c Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/kern/kern_module.c Sun Nov 15 07:25:24 2009 (r199285)
@@ -446,7 +446,7 @@ modfind(struct thread *td, struct modfin
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>
Modified: projects/ppc64/sys/kern/kern_thr.c
==============================================================================
--- projects/ppc64/sys/kern/kern_thr.c Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/kern/kern_thr.c Sun Nov 15 07:25:24 2009 (r199285)
@@ -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)
Modified: projects/ppc64/sys/kern/kern_umtx.c
==============================================================================
--- projects/ppc64/sys/kern/kern_umtx.c Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/kern/kern_umtx.c Sun Nov 15 07:25:24 2009 (r199285)
@@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$");
#include <machine/cpu.h>
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
#include <compat/freebsd32/freebsd32_proto.h>
#endif
@@ -751,7 +751,7 @@ do_unlock_umtx(struct thread *td, struct
return (0);
}
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
/*
* Lock a umtx object.
@@ -3063,7 +3063,7 @@ _umtx_op(struct thread *td, struct _umtx
return (EINVAL);
}
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
int
freebsd32_umtx_lock(struct thread *td, struct freebsd32_umtx_lock_args *uap)
/* struct umtx *umtx */
Modified: projects/ppc64/sys/kern/sys_process.c
==============================================================================
--- projects/ppc64/sys/kern/sys_process.c Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/kern/sys_process.c Sun Nov 15 07:25:24 2009 (r199285)
@@ -61,10 +61,13 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_page.h>
#include <vm/vm_param.h>
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
#include <sys/procfs.h>
+
+#ifdef COMPAT_IA32
#include <machine/fpu.h>
#include <compat/ia32/ia32_reg.h>
+#endif
struct ptrace_io_desc32 {
int piod_op;
@@ -157,7 +160,7 @@ proc_write_fpregs(struct thread *td, str
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)
@@ -355,7 +358,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.
@@ -389,7 +392,7 @@ ptrace(struct thread *td, struct ptrace_
struct dbreg dbreg;
struct fpreg fpreg;
struct reg reg;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
struct dbreg32 dbreg32;
struct fpreg32 fpreg32;
struct reg32 reg32;
@@ -398,7 +401,7 @@ ptrace(struct thread *td, struct ptrace_
} r;
void *addr;
int error = 0;
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
int wrap32 = 0;
if (SV_CURPROC_FLAG(SV_ILP32))
@@ -460,7 +463,7 @@ ptrace(struct thread *td, struct ptrace_
#undef COPYIN
#undef COPYOUT
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
/*
* PROC_READ(regs, td2, addr);
* becomes either:
@@ -494,7 +497,7 @@ kern_ptrace(struct thread *td, int req,
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
@@ -582,7 +585,7 @@ kern_ptrace(struct thread *td, int req,
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.
@@ -849,7 +852,7 @@ kern_ptrace(struct thread *td, int req,
break;
case PT_IO:
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (wrap32) {
piod32 = addr;
iov.iov_base = (void *)(uintptr_t)piod32->piod_addr;
@@ -869,7 +872,7 @@ kern_ptrace(struct thread *td, int req,
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;
@@ -889,7 +892,7 @@ kern_ptrace(struct thread *td, int req,
}
PROC_UNLOCK(p);
error = proc_rwmem(p, &uio);
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (wrap32)
piod32->piod_len -= uio.uio_resid;
else
Modified: projects/ppc64/sys/kern/uipc_socket.c
==============================================================================
--- projects/ppc64/sys/kern/uipc_socket.c Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/kern/uipc_socket.c Sun Nov 15 07:25:24 2009 (r199285)
@@ -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>
@@ -2506,7 +2506,7 @@ sosetopt(struct socket *so, struct socko
case SO_SNDTIMEO:
case SO_RCVTIMEO:
-#ifdef COMPAT_IA32
+#ifdef COMPAT_FREEBSD32
if (SV_CURPROC_FLAG(SV_ILP32)) {
struct timeval32 tv32;
@@ -2687,7 +2687,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;
Modified: projects/ppc64/sys/kern/vfs_aio.c
==============================================================================
--- projects/ppc64/sys/kern/vfs_aio.c Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/kern/vfs_aio.c Sun Nov 15 07:25:24 2009 (r199285)
@@ -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>
Modified: projects/ppc64/sys/sys/ptrace.h
==============================================================================
--- projects/ppc64/sys/sys/ptrace.h Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/sys/ptrace.h Sun Nov 15 07:25:24 2009 (r199285)
@@ -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 */
@@ -139,7 +140,7 @@ int proc_read_dbregs(struct thread *_td,
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;
Modified: projects/ppc64/sys/sys/sysctl.h
==============================================================================
--- projects/ppc64/sys/sys/sysctl.h Sun Nov 15 03:09:50 2009 (r199284)
+++ projects/ppc64/sys/sys/sysctl.h Sun Nov 15 07:25:24 2009 (r199285)
@@ -123,7 +123,7 @@ struct ctlname {
#define REQ_WIRED 2 /* locked and wired */
/* definitions for sysctl_req 'flags' member */
-#if defined(__amd64__) || defined(__ia64__)
+#if defined(__amd64__) || defined(__ia64__) || defined(__powerpc64__)
#define SCTL_MASK32 1 /* 32 bit emulation */
#endif
More information about the svn-src-projects
mailing list