Subject: Re: ROM Maps
To: Daniel R. Killoran,Ph.D. <drk@shore.net>
From: Paul Goyette <paul@whooppee.com>
List: port-mac68k
Date: 02/28/1999 12:56:01
It's not impossible, it's a fact!  Check out the machine-dependant data
structures in mac68k/macrom.c for examples.

There's a single routine somewhere in the ROMs that loads up a transfer
vector which points to all the other routines.  Then, the A-trap
dispatcher simply takes the trap word, masks off the appropriate bits,
and looks up the routine address in the table and does an indirect jump.

What they _did not_ do was change the trap codes (ie, the index values
into the transfer vector), so no matter where the code ended up in the
ROMs, it's entry point was always the same offset from the beginning of
the vector.

The moral here is clear:  Please DO NOT hard code any addresses pointing
into the Mac's ROM!  If you must find a routine, find the A-trap
dispatch code, find it's transfer vector table, and do the indirect
jump.

On Sun, 28 Feb 1999, Daniel R. Killoran,Ph.D. wrote:

> >Of course, you gotta remember that the trap routines will move around
> >between different Mac models, so it will most likely not be at the same
> >address in other Macs.
> 
> That's impossible! Apple could have ADDED traps (and did), but if they
> moved them it would break most existing programs!
> 
> Dan Killoran
> 
> ______________________________________________________________________________
> Got a device you would like to have run on the Mac? Call:
>                  Daniel-the-Driver-Maker
>       Fast service - accurate work - responsive support
> 
>          (Offer void wherever taxed or prohibited!)
> 
> 
> 

-----------------------------------------------------------------------------
| Paul Goyette      | PGP DSS Key fingerprint:   | E-mail addresses:        |
| Network Engineer  |   BCD7 5301 9513 58A6 0DBC |  paul@whooppee.com       |
| and kernel hacker |   91EB ADB1 A280 3B79 9221 |  paul.goyette@ascend.com |
-----------------------------------------------------------------------------