summaryrefslogtreecommitdiffstats
path: root/sys/kern/imgact_elf.c
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2010-03-11 14:49:06 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2010-03-11 14:49:06 +0000
commit142a4d29938aa4f7dde8d4ae621c479cc53fda36 (patch)
treee7bb2301107c48074cb0dbfffd43ee1f7e425d97 /sys/kern/imgact_elf.c
parentd937b522a1d72eb6b270db5bf368d3fd1a79ebcf (diff)
downloadFreeBSD-src-142a4d29938aa4f7dde8d4ae621c479cc53fda36.zip
FreeBSD-src-142a4d29938aa4f7dde8d4ae621c479cc53fda36.tar.gz
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
Diffstat (limited to 'sys/kern/imgact_elf.c')
-rw-r--r--sys/kern/imgact_elf.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 7e48a3b..0fffb9f 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
OpenPOWER on IntegriCloud