Subject: COMPAT_LINUX for powerpc
To: None <tech-kern@netbsd.org>
From: Emmanuel Dreyfus <p99dreyf@criens.u-psud.fr>
List: tech-kern
Date: 12/24/2000 02:13:59
Hi!

I started looking at what shoul dbe done to get powerpc Linux
compatibility (my final goal is to have Linux's Java2 running on
NetBSD/powerpc)

I had a look to LinuxPPC's and Linux-m68k system call tables and to
sys/compat/linux/arch/m68k/syscalls.master, and with this, I was wable
to build a powerpc/syscalls.master. Most syscalls are the same for
LinuxPPC and Linux-m68k (except a shift starting at syscall 166), so I
had to make very little modifications to m68k/syscalls.master

Here, I have a first problem: a few syscalls are not the same, and I
don't know exactly what to do with them. I kept the m68k meaning, which
is of course not exact. If anyone have information about what to do with
them, let me know. In the meantime, I will just keep that problem for
later.

59 sys_olduname -> UNIMPL
82 ppc_select -> old_select
90 sys_mmap -> old_mmap
109 sys_uname -> UNIMPL
110 sys_iopl -> UNIMPL
113 sys_vm86 -> UNIMPL
123 sys_modify_ldt -> sys_cacheflush
142 ppc_select -> sys_select (Conflicts with 82 ???)

Second problem: I understood I needed a powerpc/linux_exec.h. I grabbed
it from i386/linux_exec.h, since it seems it's not so much CPU dependant
stuff (For ELF, I get nearly the same stuff in m68k/linux_exec.h, si I
assume it's not CPU dependant, tell me if I'm wrong). The only CPU
dependant stuff is the a.out Linux MID parameter. It's 2 for the
mc68020, 100 for the i386. Thoses values are in the NetBSD compat source
tree and in the Linux kernel sources, but I was not able to find the
value for Linux powerpc in Linux sources. What is the Linux MID pour
powerpc?

Third problem: I know the global picture is mapping Linux syscalls to
NetBSD syscalls. Obviously there are other issues. When comppiling a
kernel with COMPAT_LINUX, I het this error:

ld -N -Ttext 100000 -e __start -x -o netbsd ${SYSTEM_OBJ} vers.o
exec_conf.o(.rodata+0x68): undefined reference to `linux_elf32_probe'
exec_conf.o(.rodata+0x6c): undefined reference to `emul_linux'
exec_conf.o(.rodata+0xa4): undefined reference to
`exec_linux_aout_makecmds'
exec_conf.o(.rodata+0xac): undefined reference to `emul_linux'
exec_conf.o(.rodata+0xb8): undefined reference to `linux_aout_copyargs'
exec_conf.o(.rodata+0xbc): undefined reference to `linux_setregs'
*** Error code 1

I'd like to learn about thoses missing symbols. What are they supposed
to implement? I'm a bit surprised for most of them missing, they are
defined in sys/compat/linux/common/*, so What happened?

Thank you for any help!

-- 
Emmanuel Dreyfus
p99dreyf@criens.u-psud.fr