[comp.os.os9] loading executable modules

LUSIANI@CERNVM.BITNET (08/04/88)

I want to load in os9 memory some executable modules using DMA with FASTBUS.
I' d like to know how works internally the 'load' command when he gets
an executable file from disk and puts it in the list of executable modules.
Can anybody help me? Alternatively has anybody a good disassembler, or
the source of the load command ?
Thanks in advance,
                                 Alberto Lusiani

jejones@mcrware.UUCP (James Jones) (08/04/88)

In article <8808031814.AA27853@jade.berkeley.edu>, LUSIANI@CERNVM.BITNET writes:
> I' d like to know how works internally the 'load' command when he gets
> an executable file from disk and puts it in the list of executable modules.

The core of the load command is just invoking the F$Load system call!  The
rest is just determining the access mode and pathname to give F$Load.  If
the modules you want are in a file, however it's accessed, then you need
only give the pathname (and -d if it's not in your current execution direc-
tory).  Give an absolute pathname if you don't want the path to be taken
as relative to the current data or execution directory.

If there's some other factor that makes it more complicated, please do give
more details.

		James Jones

pasche@ethz.UUCP (Stephan Pasche) (08/06/88)

Hi,
The OS-9 utility 'load' just executes the system call F$Load to get the
module to memory. F$Load has the following function :

  1. open the file
  2. check permissions
  3. allocate memory for the module
  4. load modules from file to memory
  5. add a new entry to the module directory

If the file contains more than one module, all modules are loaded into memory.
The file must belong to the user or must have public read permission, if
the file is located in the execution directory it must have execution
permission.
The module you want to load must belong to you or its module permissions
be set for legal access for you.
The memory is allocated at the highest possible physical address.
The module directory entry contains the following informations :

MD$MPtr    do.l 1  module pointer
MD$Group   do.l 1  Grp.Usr of owner
MD$Static  do.l 1  module group memory size
MD$Link    do.w 1  module link count
MD$MChk    do.w 1  module header checksum

If the header checksum in module directory and in the module do not
match, the module can not be linked/executed !
If you have a protected system, you can't write to the module directory
from user state, only from supervisor state !
The first module in the file has a link count of 1.
If the file contained more than one module, the modules can not be removed
from memory and module directory, because they are not loaded to memory
each at 16byte boundary (minimum memory allocation size).

==============================================================================
OS/2 & PS/2 : half an operating system for half a computer

Stephan Paschedag             paschedag@strati.ethz.ch or pasche@ifi.ethz.ch
Federal Institute Of Technology Zurich
______________________________________________________________________________