Subject: Re: MI loadfile() cannot load a.out kernel properly?
To: None <,>
From: ITOH Yasufumi <>
List: tech-kern
Date: 10/04/1999 10:01:04
In article <> writes:

> I have been working on a kernel boot loader last week,

Should we have port-news68k list?

> 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.

> 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.

Well, transferring the image seems necessary on that situation.
	read at 0,
	memmove(0, 32, size);

> 3) It seems that aout_exec() cannot load NMAGIC kernel correctly. 
> Some alignment code seems wrong:

would be....

> 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 :).
ITOH, Yasufumi