summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i960/rxgen960/startup/fault.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/i960/rxgen960/startup/fault.c')
-rw-r--r--c/src/lib/libbsp/i960/rxgen960/startup/fault.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/c/src/lib/libbsp/i960/rxgen960/startup/fault.c b/c/src/lib/libbsp/i960/rxgen960/startup/fault.c
index 67b2420345..80fb551a8f 100644
--- a/c/src/lib/libbsp/i960/rxgen960/startup/fault.c
+++ b/c/src/lib/libbsp/i960/rxgen960/startup/fault.c
@@ -1,7 +1,7 @@
/*-------------------------------------*/
/* fault.c */
/* Last change : 13. 7.95 */
-/*-------------------------------------*/
+/*-------------------------------------*/
/*
* $Id$
*/
@@ -21,11 +21,11 @@ extern void romFaultStart(void);
*/
typedef struct {
UserFaultHandler hndl; /* Handler itself. */
- int cnt; /* Handler is valid for cnt times. */
-} UserFaultEntry;
+ int cnt; /* Handler is valid for cnt times. */
+} UserFaultEntry;
/* Table itself.
*/
-static UserFaultEntry userFaultTable[] = {
+static UserFaultEntry userFaultTable[] = {
{0, 0}, /* Parallel */
{0, 0}, /* Trace */
{0, 0}, /* Operation */
@@ -73,7 +73,7 @@ int faultOk(int fault)
#if 0
faultCheckSum = faultNewCheckSum();
#endif
- faultCheckSum ++;
+ faultCheckSum ++;
rsl = 1;
}
return rsl;
@@ -90,18 +90,18 @@ void faultBad(int invokedFromRom,
*/
/* memChnlI960Fault();*/
/* Give some panic message.
- */
+ */
faultInfo(invokedFromRom, inst, faultBuffer, type, sbtp);
/* At this point RAM is repaired. Do
* whatever you want.
*/
#if 0
- if (OsfIsUp) {
+ if (OsfIsUp) {
asm_exit(romFaultStart, & ram_prcb);
}
else {
asm_exit(romStart, & ram_prcb);
- }
+ }
# endif
asm_exit(romFaultStart, & ram_prcb);
}
@@ -109,7 +109,7 @@ void faultGood(unsigned int inst, unsigned int * faultBuffer,
unsigned int type, unsigned int sbtp)
{
static unsigned int faultNewCheckSum(void);
-
+
if (userFaultTable[type].hndl != 0 && userFaultTable[type].cnt > 0) {
/* This is done to avoid the situation when
* handler causes a fault and, thus, infinite recursion.
@@ -122,19 +122,19 @@ void faultGood(unsigned int inst, unsigned int * faultBuffer,
#endif
faultCheckSum --;
/* Invoke handler.
- */
+ */
(* userFaultTable[type].hndl)(inst, faultBuffer, type, sbtp);
/* If this returns => fault is bad.
- */
+ */
}
faultBad(0, inst, faultBuffer, type, sbtp);
}
static unsigned int faultNewCheckSum(void)
{
unsigned int * f = faultStart;
- unsigned int * l = faultEnd;
+ unsigned int * l = faultEnd;
unsigned int sum;
-
+
for (sum = 0; f < l; f ++) {
sum += * f;
}
@@ -191,7 +191,7 @@ static void faultInfo(int invokedFromRom,
faultBuffer[G0_REGNUM+6], faultBuffer[G0_REGNUM+7]);
printf("g8=0x%08x g9=0x%08x gA=0x%08x gB=0x%08x\n",
faultBuffer[G0_REGNUM+8], faultBuffer[G0_REGNUM+9],
- faultBuffer[G0_REGNUM+10], faultBuffer[G0_REGNUM+11]);
+ faultBuffer[G0_REGNUM+10], faultBuffer[G0_REGNUM+11]);
printf("gC=0x%08x gD=0x%08x gE=0x%08x gF=0x%08x\n",
faultBuffer[G0_REGNUM+12], faultBuffer[G0_REGNUM+13],
faultBuffer[G0_REGNUM+14], faultBuffer[G0_REGNUM+15]);
@@ -203,21 +203,21 @@ static void faultInfo(int invokedFromRom,
faultBuffer[R0_REGNUM+6], faultBuffer[R0_REGNUM+7]);
printf("r8=0x%08x r9=0x%08x rA=0x%08x rB=0x%08x\n",
faultBuffer[R0_REGNUM+8], faultBuffer[R0_REGNUM+9],
- faultBuffer[R0_REGNUM+10], faultBuffer[R0_REGNUM+11]);
+ faultBuffer[R0_REGNUM+10], faultBuffer[R0_REGNUM+11]);
printf("rC=0x%08x rD=0x%08x rE=0x%08x rF=0x%08x\n",
faultBuffer[R0_REGNUM+12], faultBuffer[R0_REGNUM+13],
- faultBuffer[R0_REGNUM+14], faultBuffer[R0_REGNUM+15]);
+ faultBuffer[R0_REGNUM+14], faultBuffer[R0_REGNUM+15]);
if (invokedFromRom) {
printf("RAM image damaged. No chance to recover\n");
- }
+ }
else {
- printf("RAM image not damaged. Still no recovery\n");
+ printf("RAM image not damaged. Still no recovery\n");
}
-}
+}
static char * faultParallelSbtpStr(unsigned int sbtp)
{
static char buf[10];
-
+
sprintf(buf, "%d", sbtp);
return buf;
}
@@ -231,46 +231,46 @@ static char * faultTraceSbtpStr(unsigned int sbtp)
if (sbtp & 0x2) {
strcat(buf, "Instruction");
notEmpty = 1;
- }
+ }
if (sbtp & 0x4) {
if (notEmpty) strcat(buf, ":");
strcat(buf, "Branch");
notEmpty = 1;
- }
+ }
if (sbtp & 0x8) {
if (notEmpty) strcat(buf, ":");
strcat(buf, "Call");
notEmpty = 1;
- }
+ }
if (sbtp & 0x10) {
if (notEmpty) strcat(buf, ":");
strcat(buf, "Return");
notEmpty = 1;
- }
+ }
if (sbtp & 0x20) {
if (notEmpty) strcat(buf, ":");
strcat(buf, "Prereturn");
notEmpty = 1;
- }
+ }
if (sbtp & 0x40) {
if (notEmpty) strcat(buf, ":");
strcat(buf, "Supervisor");
notEmpty = 1;
- }
+ }
if (sbtp & 0x80) {
if (notEmpty) strcat(buf, ":");
strcat(buf, "Breakpoint");
notEmpty = 1;
- }
+ }
if (! notEmpty) {
strcat(buf, "Unknown");
- }
+ }
return buf;
}
static char * faultOperationSbtpStr(unsigned int sbtp)
{
char * rsl;
-
+
if (sbtp == 0x1) rsl = "Invalid Opcode";
else if (sbtp == 0x2) rsl = "Unimplemented";
else if (sbtp == 0x3) rsl = "Unaligned";
@@ -281,39 +281,39 @@ static char * faultOperationSbtpStr(unsigned int sbtp)
static char * faultArithmeticSbtpStr(unsigned int sbtp)
{
char * rsl;
-
+
if (sbtp == 0x1) rsl = "Integer Overflow";
else if (sbtp == 0x2) rsl = "Arithmetic Zero-Divide";
- else rsl = "Unknown";
+ else rsl = "Unknown";
return rsl;
}
static char * faultReservedSbtpStr(unsigned int sbtp)
{
- return "Unknown";
+ return "Unknown";
}
static char * faultConstraintSbtpStr(unsigned int sbtp)
{
char * rsl;
-
+
if (sbtp == 0x1) rsl = "Constraint Range";
else if (sbtp == 0x2) rsl = "Priveleged";
- else rsl = "Unknown";
+ else rsl = "Unknown";
return rsl;
}
static char * faultProtectionSbtpStr(unsigned int sbtp)
{
char * rsl;
-
+
if (sbtp == 0x1) rsl = "Length";
- else rsl = "Unknown";
+ else rsl = "Unknown";
return rsl;
}
static char * faultTypeSbtpStr(unsigned int sbtp)
{
char * rsl;
-
+
if (sbtp == 0x1) rsl = "Type Mismatch";
- else rsl = "Unknown";
+ else rsl = "Unknown";
return rsl;
}
static char * faultUnknownSbtpStr(unsigned int sbtp)