X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fmips-arch.c;h=72ac15afb7120b7a04eaaff05e70a610f6e1c545;hb=7c75cd363da90afe334e936aad2b63437ea5905d;hp=0ecc8fa97c00a15eba73ee119675673825a1faec;hpb=6c605fa4b46d3fee9304c4e40e0e605aa5a24f28;p=sbcl.git diff --git a/src/runtime/mips-arch.c b/src/runtime/mips-arch.c index 0ecc8fa..72ac15a 100644 --- a/src/runtime/mips-arch.c +++ b/src/runtime/mips-arch.c @@ -25,7 +25,7 @@ #define INSN_LEN sizeof(unsigned int) void -arch_init() +arch_init(void) { return; } @@ -386,27 +386,36 @@ arch_handle_after_breakpoint(os_context_t *context) *os_context_sigmask_addr(context) = orig_sigmask; } +void +arch_handle_single_step_trap(os_context_t *context, int trap) +{ + unsigned int code = *((u32 *)(os_context_pc(context))); + int register_offset = code >> 11 & 0x1f; + handle_single_step_trap(context, trap, register_offset); + arch_skip_instruction(context); +} + static void -sigtrap_handler(int signal, siginfo_t *info, void *void_context) +sigtrap_handler(int signal, siginfo_t *info, os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); unsigned int code = (os_context_insn(context) >> 6) & 0xfffff; - /* FIXME: WTF is this magic number? Needs to become a #define - * and go into maybe_handle_trap. */ + /* FIXME: This magic number is pseudo-atomic-trap from parms.lisp. + * Genesis should provide the proper #define, but it specialcases + * pseudo-atomic-trap to work around some oddity on SPARC. + * Eventually this should go into handle_trap. */ if (code==0x10) { arch_clear_pseudo_atomic_interrupted(context); arch_skip_instruction(context); interrupt_handle_pending(context); - } else if (!maybe_handle_trap(context,code)) - interrupt_handle_now(signal, info, void_context); + } else + handle_trap(context,code & 0x1f); } #define FIXNUM_VALUE(lispobj) (((int)lispobj) >> N_FIXNUM_TAG_BITS) static void -sigfpe_handler(int signal, siginfo_t *info, void *void_context) +sigfpe_handler(int signal, siginfo_t *info, os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); unsigned int bad_inst = os_context_insn(context); unsigned int op, rs, rt, rd, funct, dest = 32; int immed; @@ -462,57 +471,27 @@ sigfpe_handler(int signal, siginfo_t *info, void *void_context) arch_skip_instruction(context); } -void -arch_install_interrupt_handlers() -{ - undoably_install_low_level_interrupt_handler(SIGTRAP,sigtrap_handler); - undoably_install_low_level_interrupt_handler(SIGFPE,sigfpe_handler); -} - -extern lispobj call_into_lisp(lispobj fun, lispobj *args, int nargs); - -lispobj -funcall0(lispobj function) -{ - lispobj *args = current_control_stack_pointer; - - return call_into_lisp(function, args, 0); -} - -lispobj -funcall1(lispobj function, lispobj arg0) +unsigned int +arch_get_fp_control(void) { - lispobj *args = current_control_stack_pointer; + register unsigned int ret asm("$2"); - current_control_stack_pointer += 1; - args[0] = arg0; + __asm__ __volatile__ ("cfc1 %0, $31" : "=r" (ret)); - return call_into_lisp(function, args, 1); + return ret; } -lispobj -funcall2(lispobj function, lispobj arg0, lispobj arg1) +void +arch_set_fp_control(unsigned int fp) { - lispobj *args = current_control_stack_pointer; - - current_control_stack_pointer += 2; - args[0] = arg0; - args[1] = arg1; - - return call_into_lisp(function, args, 2); + __asm__ __volatile__ ("ctc1 %0, $31" :: "r" (fp)); } -lispobj -funcall3(lispobj function, lispobj arg0, lispobj arg1, lispobj arg2) +void +arch_install_interrupt_handlers(void) { - lispobj *args = current_control_stack_pointer; - - current_control_stack_pointer += 3; - args[0] = arg0; - args[1] = arg1; - args[2] = arg2; - - return call_into_lisp(function, args, 3); + undoably_install_low_level_interrupt_handler(SIGTRAP,sigtrap_handler); + undoably_install_low_level_interrupt_handler(SIGFPE,sigfpe_handler); } #ifdef LISP_FEATURE_LINKAGE_TABLE