Subject: Re: libsa/loadfile.c (a.out not working)
To: Michael L. Hitch <mhitch@lightning.msu.montana.edu>
From: None <nigel@ind.tansu.com.au>
List: tech-kern
Date: 07/16/2001 14:34:19
> ...
> > 	a_entry of netbsd.aout is 0x2e00. A dump of buff reveals the
> > first 0x2e12 bytes to be zero. MARK_ENTRY points to buff + 0x2e00.
> 
>   Hmm....  How are you defining ALIGNENTRY()?

	As stolen from the news68k port's loadfile_machdep.h :

#define ALIGNENTRY(a)   ((u_long)(a))


> On the amiga, I've got it
> defined as (0) for _STANDALONE (shamelesly copied from the hp300
> loadfile_machdep.h).  I now remember that this was one of the things I had
> to figure out how it worked.

	Aah. Thanks Michael. That is very helpful.


> I still don't completely understand exactly what the ALIGNENTRY()
> is supposed to do

	From its name, I suspected that it aligned the entrypoint
so that it would be suitable as a jump address for the processor,
which might suspend or trap if asked to jump to an odd address.
(i.e. non-word-aligned)

	If it is, in fact, the LOAD ADDRESS of the kernel, then
defining it as 0 makes sense, and would definately fix the problem.


	If it is in fact the latter meaning, it may be nice if
there was a comment beside it's usage (and ideally, its definition
in each port's loadfile_machdep.h). e.g.:

loadfile.c:
-	minp = maxp = ALIGNENTRY(entry);
+	minp = ALIGNENTRY(entry);	/* Load address */
+	maxp = ~0;

loadfile_machdep.h:
+/* Contrary to its name, this is actually the load address */
-#define ALIGNENTRY(a)	((u_long)(a))
+#define ALIGNENTRY(a)	(0)

	Even better would be to rename it to LOADADDRESS(entry).

-- 
| Nigel Pearson, nigel@ind.tansu.com.au | "Reality is that which,   |
|   Telstra NW-D, Sydney, Australia.    |  when you stop believing  |
| Office: 9206 3468    Fax:  9212 6329  |  in it, doesn't go away." |
| Mobile: 0408 664435  Home: 9792 6998  | Philip K. Dick - 'Valis.' |