|
|
Power 6/32 Unix version 1.21
#include "fpp_defs.h"
/*************************************************************************
*
* FLOATING POINT PROCESSOR EXCEPTION HANDLER
*
* This routine will be called after any trap or exception. It will
* compare the actual event type to any expected event type ( in
* _EXP_EVENT ). If no event was expected _EXP_EVENT will be = 0.
*
* If a previous error has set the FORCE_LOOP flag, then the test will exit
* through the loop address pointer without any event type checking.
* current subtest through _EVENT_RETURN.
*
* If the event was NOT it expected:
* if _PRT_ERROR is set, an error message will be printed.
* if _HALT_FLG is set, the program will halt.
* if _UNEXP_EVENT_RET is non-zero, it will contain the return address,
* or the program will return to the monitor via RETURN.
*
* The error message will be of the form:
* ** cycle: xx. test: xx. unexpected event type: xx
* ** Par0 : xxxxxxxx
* ** Par1 : xxxxxxxx
* ** PC : xxxxxxxx
* ** PSL : xxxxxxxx
*
*
* 30-Apr-85 combined 'fpp_event.s' and 'trap.c' into 'fpp_event.c'.
*
*************************************************************************/
XTrap( code )
long code; /* event type code */
{
register long r12, r11, r10, r9, r8;
long tpc, tpsl;
if( force_loop ) /* check for continual looping */
asm("jmp *_event_return");;
asm("movl 8(fp),r12"); /* get par 0 */
asm("movl 12(fp),r11"); /* get par 1 */
asm("movl 16(fp),r10"); /* get par 2 */
asm("movl 20(fp),r9"); /* get par 3 */
asm("movl 24(fp),r8"); /* get par 4 */
if( code == ARITH_CODE ) {
event_code = r12; /* set the arith fault type seen */
event_psl = r10; /* take the PSL off the stack */
} else
event_psl = r11;; /* take the PSL off the stack */
if( code == exp_event ) { /* was the event expected? */
if( (exp_event != ARITH_CODE) || (exp_code == r12) )
asm("jmp *_event_return");; /* exit -the evt was expected */
}
/*
* If we get here then the event was not expected
*/
errcnt++; /* bump the error count */
if( prt_error ) {
if( !error ) {
error = TRUE; /* set current-error flag */
writec('\n');
}
writes("\n** cycle: ");
writed( cycle );
writes(". test: ");
writeh( test_no );
writes(". unexpected event -type: ");
writeh( code );
writec('\n');
if( code==0x37 ) { /* FPP Emulation trap */
writes("** Par 0 : "); write32h(r12); writec('\n');
writes("** Par 1 : "); write32h(r11); writec('\n');
writes("** Par 2 : "); write32h(r10); writec('\n');
tpc = r9;
tpsl = r8;
} else
if( (code==0x20) || /* bus error */
(code==0x2f) || /* access control violation */
(code==0x30) ) { /* page fault */
writes("** Par 0 : "); write32h(r12); writec('\n');
writes("** Par 1 : "); write32h(r11); writec('\n');
tpc = r10;
tpsl = r9;
} else
if( (code==0x34) || /* arithmetic acception */
(code==0x2b) ) { /* Kcall */
writes("** Par. : ");
writeh(r12); writec('\n');
tpc = r11;
tpsl = r10;
} else {
tpc = r12;
tpsl = r11;
}
writes("** PC : "); write32h(tpc); writec('\n');
writes("** PSL : "); write32h(tpsl); writec('\n');
}
if( halt_flg ) { /* halt on the error? */
asm("movl _test_no,r0"); /* r0 = test number */
asm("clrl r1"); /* r1 = 0 (subtest #) */
asm("movl _event_type,r2"); /* r2 = event code */
asm("movl _cycle,r3"); /* r3 = cycle count */
asm("movl r12,r4"); /* r4 = parameter 1 */
asm("movl r11,r5"); /* r5 = parameter 2 */
asm("movl r10,r6"); /* r6 = parameter 3 */
asm("movl r9,r7"); /* r7 = parameter 4 */
asm("movl _index,r8"); /* r8 = data index */
asm("halt"); /* halt */
}
if( unexp_event_ret )
asm("jmp *_unexp_event_ret"); /* return to the test */
else
asm("jmp *return");
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.