Subject: Re: macbsd for 040
To: macbsd-general mailing list <macbsd-general@sun-lamp.cs.berkeley.edu>
From: Monroe Williams <monroe@cs.pdx.edu>
List: macbsd-general
Date: 11/18/1993 16:08:02
> 
> > So, I have had the wrong idea that all rom calls are documented in the
> > "Inside Macintosh" - so they have not?
> 
> The "internal" ones are not, as far as I know.  The _ShutDown is, but
> the entry point that actually reboots the machine or powers it down
> is not.  At least, I think that's why Chris had to go digging for it.
> 
> -allen

In an attempt to clarify things: (someone correct me if I'm wrong)

The TRAPS you call to use the routines are documented in Inside Mac.
The ADDRESS that the trap call jumps to can be determined at runtime by
calling GetTrapAddress.  This, however, returns the CURRENT address of
the trap, which may or may not be the address of the ROM code.  If the
trap has been patched, the address of the patch will be returned, not
the address of the ROM code.  If the patch calls the original routine,
it will have to store the original address somewhere.  Each patch does
this part differently.

Shutdown is a trap that is probably patched by system 7, at least on
machines as old as these, so it would indeed be somewhat tough to find
the ROM routine's entry point.

When MacBSD boots, any patches to the ROM routines are summarily
clobbered, so it would be necessary to know the real ROM address of a
trap to use it.  I suppose it would be theoretically possible to use
the bootstrap code in the ROM (which sets up the trap addresses when
the machine does a cold boot) to find the trap addresses dynamically,
but this may be impractical.  I don't know.

I have done trap patching, but I haven't actually gone looking for ROM
routines myself.  To anyone who has:  is this description at least
moderately accurate?

- monroe

------------------------------------------------------------------------------