james@uw-atm.UUCP (James M Synge) (11/09/86)
In article <971@cbmvax.cbmvax.commodore.COM>, higgin@cbmvax.commodore.COM (Paul Higginbottom) writes: > In article <46@uw-atm.UUCP> james@uw-atm.UUCP (James M Synge) writes: > > >I've tried writing an exception handler and had some problems. One thing > >I notice you're not dealing with in your assembly section is the fact that > >you don't know what state your registers are in, except D0 and A0, which > >contain the signal mask and address of your ExceptData. SO, when your > >code is adding 1 to hadIntr, you don't know where that 1 is being > >added. It is some offset from (A4), but, since A4 is in an unknown state, > >we don't know where that is. > > > > This is not really true. The "rules" of the OS dictate that routines > leave registers untouched except d0/d1/a0/a1 which are used for passing > args and results and cannot be guaranteed to be munged during some call. > Thus, a4 should always be in a healthy state for a program's assembler > sections to access any variables in the C or assembler parts. Lets get this clear: The rules do indicate what the state of your registers will be after a call you make returns. The rules DO NOT define the state of any registers other than D0 and A1 on entry to an exception handler. (when I said D0 and A0 in my previous posting I didn't have my manuals with me). All the registers which defined the state of your task previously are pushed onto the stack before your exception handler is called. -- --------------------------------------------------------------------------- James M Synge, Department of Atmospheric Sciences, University of Washington VOX: 1 206 543 0308 (Work) 1 206 455 2025 (Home) UUCP: uw-beaver!geops!uw-atm!james ARPA: geops!uw-atm!james@beaver.cs.washington.edu