Subject: Re: where is cpu_exec_ecoff_probe()? (Re: CVS commit: syssrc)
To: Izumi Tsutsui <>
From: Jaromír Dolecek <>
List: tech-kern
Date: 11/23/2000 08:30:57
This is moved off private discussion about best solution to mips
ecoff issue caused by latest execsw[]/emul changes (mips doesn't
have cpu_exec_ecoff_probe(), the previous version was ultrix-centric and
moved to compat/ultrix/ultrix_misc.c).

I'm including the old text for reference.

Izumi Tsutsui wrote:
> > Izumi Tsutsui wrote:
> > > cpu_exec_ecoff_probe() was removed from mips/mips/cpu_exec.c
> > > but still refered from sys/kern/exec_conf.c. On the other hand,
> > > alpha/alpha/machdep.c still has cpu_exec_ecoff_probe() and
> > > compat/ultrix/ultrix_misc.c only has ultrix_exec_ecoff_probe().
> > > 
> > > What is the right solution?
> > I think the right solution is to provide something like
> > ECOFF_WANT_NATIVE_ENTRY define to <machdep/ecoff_machdep.h>
> > (i.e. arch/alpha/include/ecoff_machdep.h and
> > arch/mips/include/ecoff_machdep.h, other mips platforms just include
> > <mips/ecoff_machdep.h) and only add the
> > 
> > 	{ ECOFF_HDR_SIZE, exec_ecoff_makecmds,
> > 	  { ecoff_probe_func: cpu_exec_ecoff_probe },
> > 	  &emul_netbsd, 0,
> > 	  0, copyargs, cpu_exec_ecoff_setregs },	/* ecoff binaries */
> > 
> > entry if it's defined,
> > alpha ecoff_machdep.h would have the define, whereas mips one would not.
> I'm not familiar with execsw[] and emul, but I have a feeling
> that we should always provide native entry for ecoff binary
> if we support EXEC_ECOFF format. It does not look
> machine dependent feature at all.
> I guess that NetBSD/mips have not used native ecoff binaries
> in its history (NetBSD/alpha did, BTW) and the only ecoff
> binaries for mips are Ultrix one, so (old) cpu_exec_ecoff_hook etc.
> in mips/cpu_exec.c are wrapped with COMPAT_ULTRIX,
> but I think it should not. We can generate native ecoff binaries
> by "objcopy -O ecoff-{big,little}mips" command.
> (Native ecoff binaries have not worked anyway even before
>  the changes, though.)

alpha differentiates between osf1 and NetBSD ecoff binary by checking magic
number (see arch/alpha/alpha/machdep.c:cpu_exec_ecoff_probe() and
compat/osf1/osf1_exec.c:osf1_exec_ecoff_probe()). Some similar
mechanism would need to be added for mips if it should support
NetBSD native ecoff binaries. Note that current ultrix_exec_ecoff_probe()
function just uncoditionally causes the binary to be executed
under ultrix emulation, there is no check at all of it's really
an Ultrix executable (this has not changed, the previous code
in arch/mips/mips/cpu_exec.c did no check too). Doing the same
for NetBSD would make it impossible to execute either NetBSD
or Ultrix ecoff binaries, since the first matching execsw entry
is used for binary.

Probably, <machine/ecoff_machdep.h> should provide define
ECOFF_MAGIC_NETBSD_MACHDEP, and generic cpu_exec_ecoff_probe()
would be implemented in kern/exec_ecoff.c which would check
the binary's magic number against that (probably using code
from alpha's cpu_exec_ecoff_probe).

BTW, does alpha still need to uncoditionally include the
ecoff stuff in arch/alpha/alpha/machdep.c ? It could probably
only include it ifdef EXEC_ECOFF.

> Comments? Should move to teck-kern?

Yes, I think so, moved it there.

Jaromir Dolecek <>
@@@@  Wanna a real operating system ? Go and get NetBSD, damn!  @@@@