home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.atari.st.tech
- Path: sparky!uunet!mnemosyne.cs.du.edu!nyx!ilepore
- From: ilepore@nyx.cs.du.edu (Ian Lepore)
- Subject: Re: Help with prog. Execption handlers on ST
- Message-ID: <1992Aug21.185809.6263@mnemosyne.cs.du.edu>
- Sender: usenet@mnemosyne.cs.du.edu (netnews admin account)
- Organization: University of Denver, Dept. of Math & Comp. Sci.
- References: <18373.2a951810@levels.unisa.edu.au>
- Date: Fri, 21 Aug 92 18:58:09 GMT
- Lines: 47
-
- Organization: Nyx, Public Access Unix at U. of Denver Math/CS dept.
- X-Disclaimer: Nyx is a public access Unix system run by the University
- of Denver for the Denver community. The University has neither
- control over nor responsibility for the opinions of users.
-
-
-
- > * this is the exception processing routine
- > BusErrHandler move.b #$FF,BusErrFlag * set flag for Bus error
- > rte
- >*** this is where i get "address errors" when I try to execute a
- > RTE from the exeception handler.
-
- For exceptions 2 & 3, there's an extra 8 bytes of info on the stack on
- entry to the exception handler. The extra bytes provide info on what type
- of memory access was happening (instruction/data fetch, etc). You have to
- clean them off the stack before you can RTE. Another issue, one I'm not
- as familiar with, is that the return address on the stack may point into
- the middle of the instruction that failed, depending on what type of
- failure occurred. Logic for returning to the next instruction after the
- failure would be complex for a general solution, but I think you can cheat,
- since you know the exact place you're expecting the failure, and the exact
- instruction that you expect to fail.
-
- Try something like this:
-
- BusErrHandler: move.b #$FF,BusErrFlag ; set local flag
- addq.l #8,sp ; clean extra info off stack
- addq.l #nnnn,2(sp) ; adjust return address
- rte ; return from exception
-
- You'll need to do a little trial-and-error to get the right value for
- #nnnn for adjusting the return address. (Or, get better info from someone
- who knows this stuff better than I do. My exception-handling experience
- has never included returning to the fail code in this way.)
-
- One other issue is processor type: I have this vague notion that chips
- upwards in the 68k family may put even more than 8 bytes of extra info
- on the stack -- you may need a couple different exception handlers, and
- install the right one for the chip type you're running on.
-
-
-
- --
- - Ian
- (void *) where prohibited by law
-
-