Merged revisions 7797-7917 via svnmerge from
[cacao.git] / src / vm / jit / m68k / linux / md-os.c
index 2f5267ee23ed5c863b569e77d4f7949a767de2b7..8787105cda1c985d4b65bba0ac8b09fd8047e9af 100644 (file)
@@ -115,7 +115,9 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, actual_ucontext_t *_
                val = (opc >> 9) & 0x0007;
                off = *(uint16_t*)(xpc+1);
        } else {
-               fprintf(stderr, "SEGV: short instructions %x\n", opc);
+               
+               /*fprintf(stderr, "SEGV: short instructions %x\n", opc);
+               */
                /* now check the 32 bit sized instructions */
                if ((opc & (2<<3)) == (2<<3))   {
                        if (opc & (1<<6)) adrreg = true;                /* M_L*X */
@@ -136,7 +138,8 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, actual_ucontext_t *_
        }*/
 
 
-       fprintf(stderr, "SEGV: sp=%x, xpc=%x, regval=%x\n", sp, xpc, regval);
+       /*fprintf(stderr, "SEGV: sp=%x, xpc=%x, regval=%x\n", sp, xpc, regval);
+       */
        e = exceptions_new_hardware_exception(0, sp, xpc, xpc, EXCEPTION_HARDWARE_NULLPOINTER, regval);
 
        _mc->gregs[GREGS_ADRREG_OFF + REG_ATMP1]     = (ptrint) e;
@@ -181,6 +184,7 @@ void md_signal_handler_sigill(int sig, siginfo_t *siginfo, actual_ucontext_t *_u
        /* Figure out in which register the object causing the exception resides for appropiate exceptions
         */
        switch (type)   {
+               case EXCEPTION_HARDWARE_ARITHMETIC:
                case EXCEPTION_HARDWARE_EXCEPTION:
                        /* nothing */
                        break;
@@ -191,7 +195,10 @@ void md_signal_handler_sigill(int sig, siginfo_t *siginfo, actual_ucontext_t *_u
                        regval = _mc->gregs[ GREGS_ADRREG_OFF + (regval & 0x7) ];
                        break;
                case EXCEPTION_HARDWARE_ARRAYINDEXOUTOFBOUNDS:
-                       regval = 0; /* FIXME */
+                       regval = *(uint16_t*)(xpc-4);
+                       assert( (regval&0xfff0) == 0x4a00 );
+                       /* was a data register */
+                       regval = _mc->gregs[regval & 0x7];
                        break;
                case M68K_EXCEPTION_HARDWARE_NULLPOINTER:
                        type = EXCEPTION_HARDWARE_NULLPOINTER;
@@ -200,10 +207,26 @@ void md_signal_handler_sigill(int sig, siginfo_t *siginfo, actual_ucontext_t *_u
                default: assert(0);
        }
 
-       /*fprintf(stderr, "NEW HWE: sp=%x, xpc=%x, tpye=%x, regval=%x\n", sp, xpc, type, regval);*/
+       /*fprintf(stderr, "NEW HWE: sp=%x, xpc=%x, tpye=%x, regval=%x\n", sp, xpc, type, regval);
+       */
        e = exceptions_new_hardware_exception(0, sp, xpc, xpc, type, regval);
 
        _mc->gregs[GREGS_ADRREG_OFF + REG_ATMP1]     = (ptrint) e;
        _mc->gregs[GREGS_ADRREG_OFF + REG_ATMP2_XPC] = (ptrint) xpc;
        _mc->gregs[R_PC]          = (ptrint) asm_handle_exception;
 }
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */