Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!sri-spam!sri-unix!hplabs!tektronix!uw-beaver!uw-june!geops!uw-atm!james From: james@uw-atm.UUCP (James M Synge) Newsgroups: comp.sys.amiga Subject: Re: Register state in an Exception Handler Message-ID: <48@uw-atm.UUCP> Date: Sat, 8-Nov-86 23:19:29 EST Article-I.D.: uw-atm.48 Posted: Sat Nov 8 23:19:29 1986 Date-Received: Mon, 10-Nov-86 00:55:17 EST References: <2210@mtuxo.UUCP> <46@uw-atm.UUCP> <971@cbmvax.cbmvax.commodore.COM> Distribution: net Organization: Dept. of Atmospheric Sciences, U. of Washington Lines: 32 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