Subject: COMPAT_LINUX/powerpc: dynamic executables fixed!
To: None <tech-kern@netbsd.org>
From: Emmanuel Dreyfus <p99dreyf@criens.u-psud.fr>
List: tech-kern
Date: 01/09/2001 14:24:37
The end of the mmap() story: the problem is that the offset arg is 64
bit long on NetBSD/powerpc and 32 bit long on Linux/powerpc. 

The way argument are handled made linux_sys_mmap catch into the offset
argument the first 32 bits word on the stack after the actual offset
argument, and it garbled everything.

I added a wrapper function which just does this

#define linux_off_t long
   linux_off_t linux_offset;
   off_t bsd_offset;
   bsd_offset = (off_t) linux_offset;

and then it calls linux_sys_mmap. Dynamic executables now run nicely. I
was able to play with a few executables I downloaded from a LinuxPPC
system, such as ls, awk or bash. 

I think it is time to submit the new patches in kern/11857 (after some
clean-up) and start working on signals.

About the clean-up: a "style" question: I wonder how should I handle the
problem. Shoud I add an ifdef in linux_sys_mmap that makes a 32 bit
shift on offset if we are on the powerpc? Or should I make a
powerpc/linux_mmap.c with my wrapper function? 

-- 
Emmanuel Dreyfus.   
Il ne suffit pas de crier l'iMac, l'iMac! en sautant comme un cabri...
p99dreyf@criens.u-psud.fr