[comp.os.os9] Faulting address on bus errors?

jr@oglvee.UUCP (Jim Rosenberg) (11/29/90)

We sell greenhouse control systems that use a VME-based M68000 running OS-9 in
ROM.  The systems have been out in the field for a couple of years and are
quite stable, but we would now like to back and beef up our error handling.
If we get a bus error, we would like to be able to know the address where the
exception occurred.  The normal exception handler provided by the OS-9 shell
doesn't provide this information, but the debugger does.  (We don't currently
have the debugger loaded in our ROM's.)

Reading the Motorola book, the information we want is clearly and
unambiguously saved on the Supervisor Stack when a bus error occurs.  The
problem is how to get to it.  The OS-9 manual writeup of F$STrap says that a
routine installed this way is executed in *user* state.  In giving the
interface to such a routine they don't indicate anywhere that you have access
to *system* stack.

Is there a way to get access to the exception frame pushed onto the system
stack by the hardware?  Any other workaround?  Any help would be appreciated.
Please reply by mail; we don't get a full feed of this newsgroup.
-- 
Jim Rosenberg             #include <disclaimer.h>      --cgh!amanue!oglvee!jr
Oglevee Computer Systems                                        /      /
151 Oglevee Lane, Connellsville, PA 15425                    pitt!  ditka!
INTERNET:  cgh!amanue!oglvee!jr@dsi.com                      /      /

meindert@inducom.UUCP (Meindert Kuipers) (11/29/90)

From article <623@oglvee.UUCP>, by jr@oglvee.UUCP (Jim Rosenberg):
> Reading the Motorola book, the information we want is clearly and
> unambiguously saved on the Supervisor Stack when a bus error occurs.  The
> problem is how to get to it.  The OS-9 manual writeup of F$STrap says that a
> routine installed this way is executed in *user* state.  In giving the
> interface to such a routine they don't indicate anywhere that you have access
> to *system* stack.
> 

The exception frame is processed somewhere deep in the kernel, and all the
important parameters are presented in registers on entry in the user
exception routine. You should be able to use this information to get
violation address, program counter and a few other things.
System state exceptions are probably not caught this way, and an error
exception routine must be added to the driver code. I do not know for sure
if this entry is called in the current OS-9 version (2.3).
If you can afford it (eprom space), run the system state debugger in the
"background", although it might be tricky to start it correctly in a
ROM based system.

Succes.

-------------------------------------------------------------------------------
  +-----+                  Inducom Systems B.V.
  |     <                  Raadhuislaan 27   NL - 5341 GL  Oss, Netherlands
  |  o  |                  P.O. Box 627      NL - 5340 AP  Oss, Netherlands
  |  INDUCOM SYSTEMS       Phone: (31)-(0)4120-41922
  +-----+                  Fax:   (31)-(0)4120-22640
  Specialists in OS-9, VMEbus and G-64

  Meindert Kuipers, Inducom Systems B.V.
  UUCP: meindert@inducom.UUCP        ...!uunet!mcsun!hp4nl!inducom!meindert
  -- Coming soon to a VMEbus system near you: VMEtro BusBusters --
-------------------------------------------------------------------------------