From owner-freebsd-amd64@FreeBSD.ORG Wed Mar 10 13:49:32 2010 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DADC106564A; Wed, 10 Mar 2010 13:49:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id E3D178FC13; Wed, 10 Mar 2010 13:49:31 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 98D3946B65; Wed, 10 Mar 2010 08:49:31 -0500 (EST) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id CBF468A021; Wed, 10 Mar 2010 08:49:30 -0500 (EST) From: John Baldwin To: freebsd-ia64@freebsd.org Date: Wed, 10 Mar 2010 08:10:10 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; ) References: <4B971CA3.9090301@freebsd.org> In-Reply-To: <4B971CA3.9090301@freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201003100810.10696.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 10 Mar 2010 08:49:30 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: freebsd-emulation@freebsd.org, Nathan Whitehorn , freebsd-amd64@freebsd.org Subject: Re: Request for review/comments: 32-bit compat for non-x86 architectures X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2010 13:49:32 -0000 On Tuesday 09 March 2010 11:14:27 pm Nathan Whitehorn wrote: > The patch at http://people.freebsd.org/~nwhitehorn/compat_freebsd32.diff > (pre-generated freebsd32 syscalls stuff is included, which will be done > in two steps on commit) provides groundwork for supporting 32-bit > compatibility for 64-bit MIPS and PowerPC systems. It has been tested on > amd64 and powerpc64, and compile-tested on ia64. There are two main > parts to the patch: > > 1) COMPAT_IA32 is renamed COMPAT_FREEBSD32, in analogy to > COMPAT_LINUX32, etc. This requires updating kernel configurations, but > is less painful than filling machine-independent bits of the kernel with > #if defined(COMPAT_IA32) || defined(COMPAT_PPC32) || > defined(COMPAT_MIPS32) || ..., and is no less descriptive than the old name. > > 2) Modifications to the freebsd32 compat layer to support big-endian > architectures. > > I would appreciate any comments, bugs, or test results on ia64. This doesn't look right for non-x86 32-bit ABIs: Index: sys/kern/imgact_elf.c =================================================================== --- sys/kern/imgact_elf.c (revision 204681) +++ sys/kern/imgact_elf.c (working copy) @@ -1439,7 +1439,7 @@ 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; It would be nice to eliminate having includes in MI code by instead including those headers in appropriate headers in . For example, we could change on amd64 and ia64 to include these headers, perhaps under an #ifdef COMPAT_FREEBSD32. Hmm, actually, I'm quite convinced now that for ia64 and amd64 should include in the #ifdef _KERNEL section to avoid polluting those includes in MI code. I'm not sure what the various includes are for, but fixing ia32_reg.h would be a good first step. It would make your diffs smaller I think. The rest of the diff looks fine to me. -- John Baldwin