Subject: netbsd32 emulation
To: matthew green <firstname.lastname@example.org>
From: Eduardo E. Horvath <email@example.com>
Date: 04/04/1999 12:40:44
I think I figured out how to fix some of our 32-bit emulation issues.
First of all, I presume we will want to have multiple 32-bit emulations
such as netbsd32, svr4_32 (for 32-bit Solaris and Irix binaries), ultrix,
and sunos4, the last two never having supported any 64-bit machines in
the past. Some of the emulation issues can be handled with an -emul
front-end, but other parts really need to be handled in the guts of the
system call itself, otherwise we need to completely reimplement the entire
system call (see compat_netbsd32_recvmsg(), system V IPC and sysctl in
compat_netbsd32), which creates a maintenence nightmare since all the
changes to the normal system call need to be done to the 32-bit version as
well. Also for something like emul_svr4 you would need to either maintain
two versions, one for 32-bit binaries and another for 64-bit binaries, or
play strange pre-processor tricks to generate both interfaces.
What we do is add a flag, either in the proc structure, or in the emul
structure (unfortunately there is no current flag field in struct emul)
indicating that the process is currently running a 32-bit emulation.
Then, if need be, a system call can find out if it needs to do 32/64-bit
conversion by checking that flag.
Of course, all that code is made `#ifdef EMUL32' or something to prevent
it from being used on machines that don't need 32-bit emulation (or are
Eduardo Horvath firstname.lastname@example.org
"I need to find a pithy new quote." -- me