a.out formats, exec and amiga.

From: Tim Newsham <newsham_at_nospam.org>
Date: Mon Nov 28 1994 - 16:06:57 PST

Ok. I finally figured out what is going wrong with exec() on my
system and need some advice.

Up till now I have been using NMAGIC format a.out files. The reason
is that I have example code that uses NMAGIC (loadbsd for amiga) so
I stuck with it. The format of my files are:

   a.out header (32 bytes)
   text section, starting at address 0x1000
   data section, starting at address 0x40000
   more stuff I dont use

This differs in the format the i386 port uses in that the a.out header
isnt part of the text section. (The boot process expects that
the a.out header is included in the text segment, so for the
crt0srv.o I included 32 null bytes which get copied over by the
boot program).

My problem is this: exec() gets passed a list of regions to map
into the address space. These areas are characterized by starting
address, port used to reference file and the offset of that segment
into the file (in pages). There is no way I can get offset 32bytes
into the file mapped to page 1. (Even worse, the data section of
the file is not a multiple of pages in length).
Basically I have to switch to another file format. I noticed that
execv() expects a ZMAGIC file. I assume this is what everyone is
using. When I compiled a file with ZMAGIC format I got the first
32 bytes as the a.out header, followed by padding to a page, and
then text starting at 1024. Is this the format file that is being
used? If so I suppose I'll be switching over to this format.

(Btw. I noticed that the libraries handle all the details of file
format and the kernel knows only about sending messages to ports
to get pages of data. This is very nice in that it allows the
system to be adapted to run other format files, but it doesn't
seem the kernel itself is flexible enough to support other file
formats if it cant handle byte-offsets.)

                                Tim N.
Received on Mon Nov 28 16:37:10 1994

This archive was generated by hypermail 2.1.8 : Thu Sep 22 2005 - 15:12:10 PDT