Date: Mon, 22 Apr 2002 18:12:14 -0400 (EDT) From: Kenneth Culver <culverk@alpha.yumyumyum.org> To: Andrew Gallatin <gallatin@cs.duke.edu> Cc: freebsd-hackers@freebsd.org, <freebsd-emulation@freebsd.org> Subject: Re: implementing linux mmap2 syscall Message-ID: <20020422172703.C23429-100000@alpha.yumyumyum.org> In-Reply-To: <15556.28962.259876.509643@grasshopper.cs.duke.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
> > AHH, ok I was wondering where PAGE_SHIFT was for FreeBSD. I guess ctob > > does what I need it to. I think that's probably why it still wasn't > > working yet... I think it also has to be page aligned before you pass it > > in though, I have to look at linux's do_mmap_pgoff() (I think that's the > > right function name) to see if it's expecting an already page-aligned arg, > > or if it's aligning it before it uses it. > > The name implies that do_mmap_pgoff() takes page-shift'ed args. > An offset specified as a page-shift is page-aligned by definition. > Eg, when you call ctob(pgoff) this turns out to be (pgoff << > PAGE_SHIFT) bytes. > > Drew > > That makes sense, regular linux mmap seems to expect the offset to be in bytes (from linux's mmap): ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT); Where linux's mmap2 does this: error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); so this looks to me like do_mmap_pgoff expects a page-aligned offset, meaning that the difference between a regular linux mmap, and linux's mmap2 is that mmap expects bytes, and mmap2 expects a page offset instead... even more is that linux's old_mmap (the one that we actually emulate in linux_mmap(), calls do_mmap2 with these args: err = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); so, I'll just do the ctob() and see what happens. :-) Ken To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020422172703.C23429-100000>