From owner-svn-src-head@FreeBSD.ORG Mon Nov 17 03:51:24 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECB3F1065670; Mon, 17 Nov 2008 03:51:24 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id 95B098FC0A; Mon, 17 Nov 2008 03:51:24 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from phobos.local ([192.168.254.200]) (authenticated bits=0) by pooker.samsco.org (8.14.2/8.14.2) with ESMTP id mAH3pIEH058897; Sun, 16 Nov 2008 20:51:19 -0700 (MST) (envelope-from scottl@samsco.org) Message-ID: <4920EA36.5020909@samsco.org> Date: Sun, 16 Nov 2008 20:51:18 -0700 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9 MIME-Version: 1.0 To: Doug Ambrisko References: <200811170237.mAH2bjY5088186@ambrisko.com> In-Reply-To: <200811170237.mAH2bjY5088186@ambrisko.com> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=3.8 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org Cc: Kostik Belousov , Doug Ambrisko , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 03:51:25 -0000 Doug Ambrisko wrote: > Kostik Belousov writes: > | On Fri, Nov 14, 2008 at 09:05:45PM +0000, Doug Ambrisko wrote: > | > Author: ambrisko > | > Date: Fri Nov 14 21:05:45 2008 > | > New Revision: 184974 > | > URL: http://svn.freebsd.org/changeset/base/184974 > | > > | > Log: > | > When running a 32bit app. on amd64, ensure the bits above 32bit > | > are zero for the copyout. Confirmed by LSI. > | > > | > Modified: > | > head/sys/dev/mfi/mfi.c > | > > | > Modified: head/sys/dev/mfi/mfi.c > | > ============================================================================== > | > --- head/sys/dev/mfi/mfi.c Fri Nov 14 18:09:19 2008 (r184973) > | > +++ head/sys/dev/mfi/mfi.c Fri Nov 14 21:05:45 2008 (r184974) > | > @@ -2130,6 +2130,14 @@ mfi_ioctl(struct cdev *dev, u_long cmd, > | > ->mfi_frame.raw[ioc->mfi_sense_off], > | > &sense_ptr.sense_ptr_data[0], > | > sizeof(sense_ptr.sense_ptr_data)); > | > +#ifdef __amd64__ > | > + if (cmd != MFI_CMD) { > | > + /* > | > + * not 64bit native so zero out any address > | > + * over 32bit */ > | > + sense_ptr.high = 0; > | > + } > | > +#endif > | > error = copyout(cm->cm_sense, sense_ptr.user_space, > | > ioc->mfi_sense_len); > | > if (error != 0) { > | > @@ -2353,6 +2361,13 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ > | > ->lioc_frame.raw[l_ioc.lioc_sense_off], > | > &sense_ptr.sense_ptr_data[0], > | > sizeof(sense_ptr.sense_ptr_data)); > | > +#ifdef __amd64__ > | > + /* > | > + * only 32bit Linux support so zero out any > | > + * address over 32bit > | > + */ > | > + sense_ptr.high = 0; > | > +#endif > | > error = copyout(cm->cm_sense, sense_ptr.user_space, > | > l_ioc.lioc_sense_len); > | > if (error != 0) { > | > | Would it make sense to perform this cut slightly more generically, by > | checking whether the current process is 32bit ? > | > | We still have not grew the easy to check flag or attribute of the image, > | but usual practice is to compare p_sysent with corresponding sysvec, > | like > | if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) > | or > | if (td->td_proc->p_sysent == &elf_linux_sysvec) > > So far we do it based on the ioctl since the 32bit or 64bit ioctl > value is different. I put in that comment for Linux since there > is talk/work for Linux amd64 emulation. For 64bit Linux ioctl > support we need a 64bit structure defined. When the ioctl can't > be figured out then I've used the p_sysent. Eventually, something > that is more generic then the #ifdef __amd64__ should be done > in all the drivers that do this emulation. > > Doug A. Something that identifies the ABI needs to be put into the proc structure. This isn't the only place where such information is needed. Comparing against the sysent table symbol doesn't work very well because it requires all sysent tables be loaded, which isn't always true for the linux ABI. Scott