Subject: Re: 4.3-reno binaries on NetBSD
To: Mirian Crzig Lennox <mirian@cosmic.com>
From: Johnny Billquist <bqt@Update.UU.SE>
List: port-vax
Date: 12/26/2000 21:37:05
On 26 Dec 2000, Mirian Crzig Lennox wrote:

[...]
> The problem is essentially this: in the 4.3 days, the first field of 
> the a.out format header (exec) was a longword, a_magic.  This usually
> contained one of OMAGIC, NMAGIC or ZMAGIC (0407, 0410, 0413).  OMAGIC
> was the old format from the PDP-11 days and not really used.  NMAGIC
> was the new format that used read-only text segments which could be
> shared, and ZMAGIC was like NMAGIC, but demand-paged.

Here is a bit of silly knowledge for you all.

OMAGIC, NMAGIC and ZMAGIC are all from the PDP-11. If you look in
/usr/share/misc/magic, you'll find a few more. The full list is:
0407, 0401, 0405, 0410, 0411, 0437, 0413, 0430, 0431.

Note that these are *not* longwords, but are actually just 16 bit
quantities. There is a reason for this. If someone have the PDP-11 opcodes
in their heads, they'll trigger on the fact that these are all in the form
0004xx, which is an unconditional branch on the pdp-11. What this means is
that if you try to run these programs from the first byte onwards, you
start with a small jump that skips over the header information.

This is where my knowledge ends. Exactly what happens then I don't know.
If the start of the actual codes comes exactly behind the header, it would
start executing as if the program had been correctly started, but I
haven't really bothered that much with this arcane knowledge. :-)

Just thought you'd all like to know...

	Johnny

Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt@update.uu.se           ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol