Subject: COMPAT_IRIX and /dev/kmem emulation
To: None <tech-kern@netbsd.org>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: tech-kern
Date: 03/13/2002 22:24:25
Hi!

On IRIX, kmem diggers first ask politely to the kernel for the address
of the well known structures they are interested in. There is a system
call used for this. For instance, to get the load average, xload uses
sysmp() to get the struct loadavg offset in /dev/kmem. Then it reads
/dev/kmem and get the value.

I thought about emulating /dev/kmem itself for IRIX binaries. Our
sysmp() emulation can return the address of a dedicated structure, and
when the IRIX process digs /dev/kmem at that address, we could give it
the IRIX struct load_avg instead of the NetBSD one, thus making xload
working.

Is it a good idea? If it is, how to implement it? I thought about adding
a new device driver to sys/arch/sgimips/sgimips/conf.c. The device
driver would return translated structures when asked for well known
structures, and would return real kmem memory for other (or maybe
nothing, after all, there is no reason for which an IRIX binary could be
interested by our native kernel memory). The device node would fit in
/emul/irix/dev/kmem, of course.

Opinions?

-- 
Emmanuel Dreyfus.
Sryvpvgngvbaf!
Ibhf irarm qr creqer ibger grzcf n qrpbqre har fvtangher fnaf vagrerg.
manu@netbsd.org