TIP: Click on subject to list as thread! ANSI
echo: cis.os9.68000.osk
to: ole hansen 100016,3417 (X)
from: Chris Hann (Mass UK) 100064,1431
date: 1993-07-01 08:28:52
subject: #18320-#68k bus errors

#: 18366 S12/OS9/68000 (OSK)
    01-Jul-93  08:28:52
Sb: #18320-#68k bus errors
Fm: Chris Hann (Mass UK) 100064,1431
To: ole hansen 100016,3417 (X)

OK Ole, sorry this has taken some time, however my project ends tomorrow and I
have not been able to get on. Also the PC I used had 512k and wouldn't send
this message!

The following is the last cut of my test program:-

* This is a short 'C' program that jiggers the bus trap and spurious
* interrupt traps on a Radstone 68-41 card to make them do something a
* good deal more sensible than the standard OS-9 reaction (crash in one
* case and system reset in the other!).
* Basically the program hijacks the bus error and also installs a system
* approved bus error handler, I have less time for the spurious interrupt
* so I increment a counter and 'rte'.
* On a bus error the system calls my handler, this saves some interesting
* info and then calls the system bus error handler. The system bus error
* handler deletes all the iteresting information, replaces it with stuff
* we can get from (a5) anyway, then calls the second bus error trap
* handler (the os-9 legal one) this looks to see if a continuation address
* has been given. If it has it restores the processor from one of the
* stacks and jumps there, if not it exits with a decent error message.
*
* I don't claim this is a fantastic cure all method, however it has made my
* system considerably more reliable ( reduces unexplained crashes by 95%).
*
* Obviously this is unlikely to be a plug in and go solution for similar
* problems on other machines, the VBR is unlikely to point to the same
* address on another machine for example, (look in systype.d) and I don't
* think you will have a great deal of joy on anything less than an '020,
* however here it is for what it's worth... sorry I can't devote more time
* to explaining but I have a customer to keep happy and a bos breathing
* down my neck!
*
* Good luck one and all (and why doesn't OS-9 do something like this, it
* was hardly difficult once I had found the vector table!).
*
*               Chann
*
#include 

/* Define C function to provide user information at trap */
void bus_err_handler();

/* Define global variables to hold registers at trap */
unsigned    r_a0,r_a1,r_a2,r_a3,r_a4,r_a5,r_a6,r_a7,
            r_d0,r_d1,r_d2,r_d3,r_d4,r_d5,r_d6,r_d7,
            r_pc,r_ccr;

unsigned    program_counter,
            effective_address,
            fault_address,
            os_berr_trap;

unsigned    spurious_count = 0;
unsigned    old_spurious;
unsigned    spurious;
unsigned    cont_addr;
unsigned    test_result;

int isram();

/* Main function... installs trap then does something illegal */
int main()
{

int *i;     /* Temporary variables for illegal access */
int j;

    cont_addr=0;

    printf("going to install trap\n");


#asm
        move.l  #0,a0           use current stack
        lea     ExcpTbl(pc),a1  Point to exception programming table
        os9     F$STrap         Install trap handlers

        move.l  ($40008),(os_berr_trap,a6)  read and store bus error vector
        lea     FastBusError(pc),a0         get new bus error vector
        move.l  a0,($40008)                 overwrite vector in VBR
#endasm

    /* Print out info on trap installation */
    printf(
        "old bus error = $%08x, new=$%08x\n",
        os_berr_trap,
        *(unsigned *)0x40008
    );

    printf("installed trap\n");

/* Now kill the spurious interrupt handler!!!!! */
#asm
        move.l  #$40060,a0          can't use a constant here... crap compiler
        move.l  (a0),(old_spurious,a6)
        lea     Spurious(pc),a1
        move.l  a1,(spurious,a6)
        move.l  a1,(a0)
#endasm

    printf(
        "replaced system spurious irq, wrote $%08x to $%08x... was $%08x\n",
        spurious,
        0x4003c,
        old_spurious
    );

    /* Wait so printing is done before fault access */
    tsleep(100);

    if(isram(0x20000000)) printf("memory
agg82,b&z.620c&23d_63<6236*7zxx0
					
SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.