From: Stefano Stabellini Subject: Re: Re: [Xen-changelog] [xen-unstable] stubdom: mmap on /dev/mem support Date: Wed, 21 Oct 2009 16:57:54 +0100 Message-ID: References: <200910211510.n9LFAGT7019922@xenbits.xensource.com> <20091021153649.GM4693@const.bordeaux.inria.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1028360292-1256140674=:15538" Return-path: In-Reply-To: <20091021153649.GM4693@const.bordeaux.inria.fr> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Samuel Thibault Cc: "xen-devel@lists.xensource.com" , "xen-changelog@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --8323329-1028360292-1256140674=:15538 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable On Wed, 21 Oct 2009, Samuel Thibault wrote: > Xen patchbot-unstable, le Wed 21 Oct 2009 08:10:15 -0700, a =E9crit : > > + unsigned long mfns[n]; > > + for (i =3D 0; i < n; i++) > > + mfns[i] =3D ((unsigned long) offset + (i * PAGE_SIZE)) >= > PAGE_SHIFT; >=20 > Mmm, is there a reason for adding (i*PAGE_SIZE) before right-shifting? >=20 > > + return map_frames_ex(mfns, n, 1, 0, 1, DOMID_IO, 0, _PAGE_PR= ESENT|_PAGE_RW); >=20 > Actually I think the whole could just be >=20 > unsigned long first_mfn =3D offset >> PAGE_SHIFT; > return map_frames_ex(&first_mfn, n, 0, 1, 1, DOMID_IO, 0, _PAGE= _PRESENT|_PAGE_RW); >=20 > which avoids the need to prepare a table. Yeah, you are right. Both versions are fine for me. --8323329-1028360292-1256140674=:15538 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --8323329-1028360292-1256140674=:15538--