Subject: ELF, a.out & libsa loadfile()
To: None <port-mac68k@NetBSD.org>
From: None <nigel@ind.tansu.com.au>
List: port-mac68k
Date: 05/22/2001 16:07:12
Still trying to get the Booter loading kernels using libsa's
loadfile code. Can anyone enlighten me about the following (seeming)
contradiction:
* An a.out format kernel usually has a non-zero entry point.
(e.g. exec.a_entry = 0x2A00)
* The old Booter kernel loading code loads the text segment at
address 0 of the supplied buffer, which means that the Booter
jumps to an entry point a_entry bytes into both the buffer,
and the text segment
* The loadfile code loads the text segment at address MARK_START
plus a_entry:
u_long entry = x->a_entry
...
paddr_t offset = marks[MARK_START];
...
min = maxp = ALIGNENTRY(entry)
...
if (READ(fd, maxp, x->a_text - sub) != x->a_text - sub) {
which means that the Booter jumps into an entry point a_entry
bytes into the buffer, but 0 bytes into the text segment
Looking at the kernel sources, none of the other bootloaders
seem to do anything special - they just jump to marks[MARK_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.' |