Subject: Re: MI loadfile() cannot load a.out kernel properly?
To: None <email@example.com>
From: Izumi Tsutsui <firstname.lastname@example.org>
Date: 10/05/1999 01:02:51
> Should we have port-news68k list?
Well... I'm not sure... ;-p
> > 1) aout_exec() seems to load the kernel into its entry address,
> > not text start address. So if kernel entry is not at text start,
> > the kernel would be loaded on wrong address.
> The a.out format doesn't have information about load address.
> Loading at the entry address is a hack.
Ok, now I see.
BTW, can "marks[MARKS_START]" be used to specify load address?
Currently it does not used at all. In sun3/stand/libsa/exec_sun.c,
load address is passed to load_sun() function.
> > 2) If the kernel has OMAGIC header, aout_exec() would try to load
> > the header before the text, but this would cause problem if text
> > starts at 0x0.
> The a.out header does not belongs to any segment on OMAGIC and NMAGIC
> binaries, but is included in the text segment on ZMAGIC.
I remove LOAD_HDR from flags (and fix the below alignment code),
then NMAGIC kernel is loaded properly.
Anyway, "if (magic == OMAGIC)" in aout_exec() should be fixed as
"if (magic == OMAGIC || magic == NMAGIC)", I think.
It seems that only the sun3 kernel (which is OMAGIC) uses
a.out header, though. (sun3 should switch ZMAGIC kernel?)
> > I guess the size should be like this:
> > int size = ((int)maxp & (__LDPGSZ - 1)) ?
> > __LDPGSZ - ((int)maxp & (__LDPGSZ - 1)) : 0;
> size = -(unsigned)maxp & (__LDPGSIZE - 1);
> is a little simpler :).
I agree, but it seems a bit hard to read for me ;-)