Skip to content
Snippets Groups Projects
Commit d232e13e authored by wlott's avatar wlott
Browse files

Added sparc support for internal errors. Changed the trap signal handler

to check the trap kind and to either call INTERNAL_ERROR or signal the
interrupt as approporate.
parent 4af7e7a4
No related branches found
No related tags found
No related merge requests found
/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/ldb/Attic/interrupt.c,v 1.14 1990/11/24 07:45:50 wlott Exp $ */ /* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/ldb/Attic/interrupt.c,v 1.15 1990/11/26 19:44:32 wlott Exp $ */
/* Interrupt handing magic. */ /* Interrupt handing magic. */
...@@ -32,7 +32,7 @@ static void fake_foreign_function_call(context) ...@@ -32,7 +32,7 @@ static void fake_foreign_function_call(context)
/* Get current LISP state from context */ /* Get current LISP state from context */
current_dynamic_space_free_pointer = (lispobj *) context->sc_regs[ALLOC]; current_dynamic_space_free_pointer = (lispobj *) context->sc_regs[ALLOC];
current_binding_stack_pointer = (lispobj *) context->sc_regs[BSP]; current_binding_stack_pointer = (lispobj *) context->sc_regs[BSP];
#ifdef MIPS #ifdef mips
current_flags_register = context->sc_regs[FLAGS]|(1<<flag_Atomic); current_flags_register = context->sc_regs[FLAGS]|(1<<flag_Atomic);
#endif #endif
...@@ -195,11 +195,28 @@ static void skip_instruction(context) ...@@ -195,11 +195,28 @@ static void skip_instruction(context)
call_into_lisp(MAYBE_GC, SymbolFunction(MAYBE_GC), \ call_into_lisp(MAYBE_GC, SymbolFunction(MAYBE_GC), \
current_control_stack_pointer, 0) current_control_stack_pointer, 0)
static trap_handler(signal, code, context) static break_handler(signal, code, context)
int signal, code; int signal, code;
struct sigcontext *context; struct sigcontext *context;
{ {
if (code == trap_PendingInterrupt) { int trap;
lispobj *args;
#ifdef mips
trap = code;
#endif
#ifdef sparc
int badinst;
badinst = *(unsigned long *)(context->sc_pc);
if ((badinst & 0xc1c00000) == 0)
trap = 0x3fffff & badinst;
else
trap = 0;
#endif
switch (trap) {
case trap_PendingInterrupt:
if (foreign_function_call_active) if (foreign_function_call_active)
crap_out("Oh no, got a PendingInterrupt while foreign function call was active.\n"); crap_out("Oh no, got a PendingInterrupt while foreign function call was active.\n");
...@@ -223,9 +240,36 @@ struct sigcontext *context; ...@@ -223,9 +240,36 @@ struct sigcontext *context;
context->sc_mask = pending_mask; context->sc_mask = pending_mask;
pending_mask = 0; pending_mask = 0;
skip_instruction(context); skip_instruction(context);
} break;
else
case trap_Halt:
crap_out("%primitive halt called; the party is over.\n");
case trap_Error:
fake_foreign_function_call(context);
args = current_control_stack_pointer;
current_control_stack_pointer += 2;
args[0] = alloc_sap(context);
args[1] = NIL;
call_into_lisp(INTERNAL_ERROR,SymbolFunction(INTERNAL_ERROR),args,2);
undo_fake_foreign_function_call(context);
break;
case trap_Cerror:
fake_foreign_function_call(context);
args = current_control_stack_pointer;
current_control_stack_pointer += 2;
args[0] = alloc_sap(context);
args[1] = T;
call_into_lisp(INTERNAL_ERROR,SymbolFunction(INTERNAL_ERROR),args,2);
undo_fake_foreign_function_call(context);
skip_instruction(context);
break;
default:
handle_now(signal, code, context); handle_now(signal, code, context);
break;
}
} }
#ifdef mips #ifdef mips
...@@ -339,13 +383,17 @@ int (*handler)(); ...@@ -339,13 +383,17 @@ int (*handler)();
int oldmask; int oldmask;
union interrupt_handler oldhandler; union interrupt_handler oldhandler;
if (signal == SIGTRAP)
sv.sv_handler = trap_handler;
#ifdef mips #ifdef mips
if (signal == SIGTRAP)
sv.sv_handler = break_handler;
else if (signal == SIGFPE) else if (signal == SIGFPE)
sv.sv_handler = sigfpe_handler; sv.sv_handler = sigfpe_handler;
else if (signal == SIGBUS) else if (signal == SIGBUS)
sv.sv_handler = sigbus_handler; sv.sv_handler = sigbus_handler;
#endif
#ifdef sparc
if (signal == SIGILL)
sv.sv_handler = break_handler;
#endif #endif
else if (handler == SIG_DFL || handler == SIG_IGN) else if (handler == SIG_DFL || handler == SIG_IGN)
sv.sv_handler = handler; sv.sv_handler = handler;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment