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,
>
> <..>
>
>  >            ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >>
>  > PAGE_SHIFT); out:
>  >    return ret;
>  > }
>  >
>  > This is what mmap2 does:
>  >
>  > andstatic inline long do_mmap2(
>  >    unsigned long addr, unsigned long len,
>  >    unsigned long prot, unsigned long flags,
>  >    unsigned long fd, unsigned long pgoff)
>
> <...>
>
>  >    error = 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 it),
>  > where mmap doesn't. the FreeBSD code in the linuxulator basically just
>  > 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 = 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 
*params)
{
        args[0] = tf->tf_ebx;
        args[1] = tf->tf_ecx;
        args[2] = tf->tf_edx;
        args[3] = tf->tf_esi;
        args[4] = tf->tf_edi;
        *params = NULL;         /* no copyin */
}

Basically, linux_mmap2 takes 6 args, and this looks here like only 5 args are 
making it in... I checked this because the sixth argument to linux_mmap2() in 
truss was showing 0x6, but when I printed out that arg from the kernel, it 
was showing 0x0. Am I correct here?

Ken

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to