[comp.sys.mac.programmer] Strange Address Problem on Plus but not on SE/30. WHY?

lagana@sparky.eecs.umich.edu (Antonio A Lagana) (06/24/91)

Hi,

I have written an INIT that among other things does a head patch to some toolbox
routines.  I have tested it on my SE/30 and things seem to work fine with or
without other INITs loaded (under 7.0, by the way).  However, when I test it
on a Plus, with the same setup (with/without INITs, 7.0), the INIT causes the 
system to crash with an address error.  First of all, does anybody know what
exactly does an "address error" mean?  Is it something to do with the accessed
address not being aligned properly (I am not sure if the 68000 is word or byte
addressable)?  Or is it the result of trying to access a memory location which
does not exist?  Finally, are there any differences between the way that the
system works on an SE/30 versus the Plus, which could cause something to work
fine on the SE/30 but not on the Plus (I am not generating 68020/30 code BTW)?
Any help will be greatly appreciated.   

Thanks in advance,      

Antonio A. Lagana
lagana@sparky.eecs.umich.edu

stevec@Apple.COM (Steve Christensen) (06/24/91)

lagana@sparky.eecs.umich.edu (Antonio A Lagana) writes:
>I have written an INIT that among other things does a head patch to some
>toolbox routines.  I have tested it on my SE/30 and things seem to work
>fine with or without other INITs loaded (under 7.0, by the way).  However,
>when I test it on a Plus, with the same setup (with/without INITs, 7.0),
>the INIT causes the system to crash with an address error.  First of all,
>does anybody know what exactly does an "address error" mean?  Is it
>something to do with the accessed address not being aligned properly (I
>am not sure if the 68000 is word or byte addressable)?  Or is it the result
>of trying to access a memory location which does not exist?

An "address error" means that you did an unaligned access.  The 68000 won't
let you do unaligned word- or longword accesses, so you probably have a word
or longword variable that's not at least word-aligned.  The 68020 and 68030
don't care if the access is aligned or not--it could just take longer if the
processor has to read an extra long word to get the leftover piece of the
access...

steve
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Steve Christensen			Never hit a man with glasses.
  stevec@apple.com			Hit him with a baseball bat.

lagana@sparky.eecs.umich.edu (Antonio A Lagana) (06/25/91)

Thanks a million to everybody who has replied (and whose replies may be on
the way :) ).  As most people have pointed out, the problem was in a word
mis-alignment brought about by some of the inline assembly code that I had
in the INIT.  There was also a problem with a pointer not being "initialized"
through NewPtr(), though I don't know how that created an alignment problem.
In any case, my INIT is merrily running without a hitch on a Plus (at least
for the time being :) ).  Thanks again to everyone.

Antonio A. Lagana
lagana@sparky.eecs.umich.edu