From 142a4d29938aa4f7dde8d4ae621c479cc53fda36 Mon Sep 17 00:00:00 2001 From: nwhitehorn Date: Thu, 11 Mar 2010 14:49:06 +0000 Subject: 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 --- sys/kern/imgact_elf.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'sys/kern/imgact_elf.c') 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 #include -#if defined(COMPAT_IA32) && __ELF_WORD_SIZE == 32 -#include -#include -#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 + 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 -- cgit v1.1