From owner-freebsd-arch@FreeBSD.ORG Thu Oct 28 14:21:17 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38B3C1065670; Thu, 28 Oct 2010 14:21:17 +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 09E078FC08; Thu, 28 Oct 2010 14:21:17 +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 A845D46B39; Thu, 28 Oct 2010 10:21:16 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 2B5C68A01D; Thu, 28 Oct 2010 10:21:15 -0400 (EDT) From: John Baldwin To: Attilio Rao Date: Thu, 28 Oct 2010 10:13:02 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010271355.40685.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201010281013.03261.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 28 Oct 2010 10:21:15 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: Warner Losh , freebsd-arch@freebsd.org Subject: Re: [PATCH] Headers for the x86 subtree X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 14:21:17 -0000 On Thursday, October 28, 2010 3:44:21 am Attilio Rao wrote: > 2010/10/27 John Baldwin : > > On Wednesday, October 27, 2010 10:56:06 am Attilio Rao wrote: > >> This patch should convert a (simple and 100% shared between amd64 and > >> i386 header) under the x86 sub-tree. Please note that in this patch I > >> "svn cp" the file from sys/amd64/include/mptable.h into > >> sys/x86/include/mptable.h: > >> http://www.freebsd.org/~attilio/headers-x86.diff > >> > >> This is someway a POC, that I really want to get in. The idea is > >> simple and someway follows the pc98 case (even if not entirely): the > >> files under machine/include/* became just mere stubs for x86/include/* > >> contents and redirect there. > >> This won't particulary help reducing the number of available files, > >> but generally removing verbatim and would also be the way to go for > >> handling MFCs. > >> If you find this is the right way I'll commit the fix and start moving > >> other files as time permits. > > > > No, we want to do this differently because we also want this to work in > > userland. (e.g. I'd like to outright move mca.h to x86/include and then use > > '#include ' in both kernel and userland for it). We'd need some > > special glue to setup an 'x86' symlink during a kernel build that points to > > @/x86/include as we do now to setup an 'i386' link for pc98 kernels. > > > > We'd also need to install the x86 headers into /usr/include during an > > installworld. Warner has some more pointers on this I think. > > I spoke with Warner briefly about it. > One question I'm having now, though, is how getting co-living of pc98 > and x86 now, as we are basically overriding the same infrastructure > (MACHINE_CPUARCH) in the i386/amd64 case? > Do you have ideas about that? I'm still doing testing, but this seems to be working so far. I am moving mca.h as my current test. Index: include/Makefile =================================================================== --- include/Makefile (revision 214386) +++ include/Makefile (working copy) @@ -116,8 +116,11 @@ .endfor .if ${MACHINE} != ${MACHINE_CPUARCH} -_MARCH=${MACHINE_CPUARCH} +_MARCHS= ${MACHINE_CPUARCH} .endif +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +_MARCHS+= x86 +.endif .include @@ -126,7 +129,7 @@ # Take care of stale directory-level symlinks. compat: -.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCH} crypto +.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \ rm -f ${DESTDIR}${INCLUDEDIR}/$i; \ fi @@ -142,7 +145,7 @@ copies: .for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \ - ${_MARCH} + ${_MARCHS} .if exists(${DESTDIR}${INCLUDEDIR}/$i) cd ${DESTDIR}${INCLUDEDIR}/$i; \ for h in *.h; do \ @@ -189,7 +192,8 @@ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${DESTDIR}${INCLUDEDIR}/machine/pc .endif -.if defined(_MARCH) && exists(${.CURDIR}/../sys/${_MARCH}/include) +.for _MARCH in ${_MARCHS} +.if exists(${.CURDIR}/../sys/${_MARCH}/include) ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ cd ${.CURDIR}/../sys/${_MARCH}/include; \ @@ -203,6 +207,7 @@ ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc .endif .endif +.endfor cd ${.CURDIR}/../sys/rpc; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \ ${DESTDIR}${INCLUDEDIR}/rpc Index: sys/conf/kern.post.mk =================================================================== --- sys/conf/kern.post.mk (revision 214386) +++ sys/conf/kern.post.mk (working copy) @@ -169,6 +169,9 @@ .if ${MACHINE} != ${MACHINE_CPUARCH} _ILINKS+= ${MACHINE_CPUARCH} .endif +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +_ILINKS+= x86 +.endif # Ensure that the link exists without depending on it when it exists. .for _link in ${_ILINKS} @@ -181,8 +184,8 @@ @case ${.TARGET} in \ machine) \ path=${S}/${MACHINE}/include ;; \ - ${MACHINE_CPUARCH}) \ - path=${S}/${MACHINE_CPUARCH}/include ;; \ + *) \ + path=${S}/${.TARGET}/include ;; \ esac ; \ ${ECHO} ${.TARGET} "->" $$path ; \ ln -s $$path ${.TARGET} -- John Baldwin