From owner-freebsd-hackers Mon Apr 22 20:13:26 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mailhub.yumyumyum.org (dsl092-171-091.wdc1.dsl.speakeasy.net [66.92.171.91]) by hub.freebsd.org (Postfix) with SMTP id 02E1B37B416 for ; Mon, 22 Apr 2002 20:13:12 -0700 (PDT) Received: (qmail 25573 invoked from network); 23 Apr 2002 03:12:54 -0000 Received: from ken.yumyumyum.org (192.168.0.2) by router.yumyumyum.org with SMTP; 23 Apr 2002 03:12:54 -0000 Content-Type: text/plain; charset="iso-8859-1" From: Kenneth Culver To: Andrew Gallatin Subject: Re: implementing linux mmap2 syscall Date: Mon, 22 Apr 2002 23:13:29 -0400 X-Mailer: KMail [version 1.4] References: <200204211525.08827.culverk@yumyumyum.org> <15556.6399.62081.426193@grasshopper.cs.duke.edu> In-Reply-To: <15556.6399.62081.426193@grasshopper.cs.duke.edu> Cc: freebsd-hackers@freebsd.org, freebsd-emulation@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200204222313.29181.culverk@yumyumyum.org> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Monday 22 April 2002 10:06 am, you wrote: > Kenneth Culver writes: > > static inline unsigned long do_mmap(struct file *file, unsigned long > > addr, > > <..> > > > =09=09ret =3D do_mmap_pgoff(file, addr, len, prot, flag, offset >> > > PAGE_SHIFT); out: > > =09return ret; > > } > > > > This is what mmap2 does: > > > > andstatic inline long do_mmap2( > > =09unsigned long addr, unsigned long len, > > =09unsigned long prot, unsigned long flags, > > =09unsigned long fd, unsigned long pgoff) > > <...> > > > =09error =3D do_mmap_pgoff(file, addr, len, prot, flags, pgoff); > > > > > > So what it looks like to me is that mmap2 expects an offset that's > > already page-aligned (I'm not sure if this is the right way to say i= t), > > where mmap doesn't. the FreeBSD code in the linuxulator basically ju= st > > takes the offset > > To me, it looks like mmap2 takes an offset that's a page index, rather > than a byte position. Since linux passes the offset with a 32-bit > long, rather than a 64-bit off_t like we do, they need to do this in > order to be able to map offsets larger than 4GB into a file. > > For linux_mmap2, I'd think we want to do roughly the same things as > linux_mmap, but with bsd_args.pos =3D ctob((off_t)linux_args.pos) > > Drew OK, I found another problem, here it is: static void linux_prepsyscall(struct trapframe *tf, int *args, u_int *code, caddr_t=20 *params) { =09args[0] =3D tf->tf_ebx; =09args[1] =3D tf->tf_ecx; =09args[2] =3D tf->tf_edx; =09args[3] =3D tf->tf_esi; =09args[4] =3D tf->tf_edi; =09*params =3D NULL;=09=09/* no copyin */ } Basically, linux_mmap2 takes 6 args, and this looks here like only 5 args= are=20 making it in... I checked this because the sixth argument to linux_mmap2(= ) in=20 truss was showing 0x6, but when I printed out that arg from the kernel, i= t=20 was showing 0x0. Am I correct here? Ken To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message