>  > 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to