Subject: Re: COMPAT_LINUX/powerpc: mmap'ing dynamic libraries
To: None <tech-kern@netbsd.org>
From: Emmanuel Dreyfus <p99dreyf@criens.u-psud.fr>
List: tech-kern
Date: 01/09/2001 12:06:33
Christos Zoulas <christos@zoulas.com> wrote:
> Is using old_mmap ok on ppc? What does the kernel source say?

According to kernel sources, i386 and m68k use linux_old_mmap(), and
other ports (alpha, sparc, ppc...) should use linux_sys_mmap().

I tried to compile a kernel using linux_old_mmap(), and the result is
not better (well, in fact it's even worst):

   215 mmap     CALL  open(0x1830b48,0,0)
   215 mmap     NAMI  "/emul/linux/etc/passwd"
   215 mmap     NAMI  "/etc/passwd"
   215 mmap     RET   open 3
   215 mmap     CALL  old_mmap(0)
   215 mmap     RET   old_mmap -1 errno -14 Bad address
   215 mmap     PSIG  SIGSEGV SIG_DFL
   215 mmap     NAMI  "mmap.core"

I just remembered that Linux has a special handling for mmap on ppc. The
Linux syscall does not go to sys_mmap(), but to ppc_mmap(). I'll try to
see in Linux sources if there could be a problem here.

But I'd like to understand what went wrong. I got this:
  3718 mmap     CALL  mmap(0,0x200,0x1,0x2,0x3,0,0x1830000,0x1870000)

Whereas I expected this
   322 mmap     CALL  mmap(0,0x200,0x1,0x2,0x3,0,0,0)

The two last arguments should just not be here. I suspect Linux/powerpc
has a specific way of passing the last argument, and that this way is
not the NetBSD way.=20

--=20
Emmanuel Dreyfus. En tant que serveur, Windows NT fait en moins bien=20
ce que UNIX fait depuis des ann=E9es avec une interface utilisateur=20
que seul un utilisateur d'UNIX est capable d'admirer.
p99dreyf@criens.u-psud.fr