Merged with tip.
[cacao.git] / src / vm / jit / sparc64 / linux / md-os.c
index aa6fa8a401dfc8f010716ad0fb36692897587eec..815308bd6b2acaf24bcb22208ac8613dd77a1201 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/sparc64/linux/md-os.c - machine dependent SPARC Linux functions
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
-   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
-   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
-   J. Wenninger, Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2005, 2006, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
 
 #include "vm/signallocal.h"
 #include "vm/stringlocal.h"
+
 #include "vm/jit/asmpart.h"
 #include "vm/jit/stacktrace.h"
+#include "vm/jit/trap.h"
 
 
 typedef struct sigcontext sigcontext;
@@ -85,7 +85,6 @@ ptrint md_get_reg_from_context(sigcontext *ctx, u4 rindex)
 
 void md_signal_handler_sigsegv(int sig, siginfo_t *info , void *_p)
 {
-       stackframeinfo     sfi;
        /*
        ucontext_t  *_uc;
        mcontext_t  *_mc;
@@ -122,7 +121,7 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *info , void *_p)
 
        /* flush register windows? */
        
-       val   = md_get_reg_from_context(ctx, d);
+       val  = md_get_reg_from_context(ctx, d);
 
        /* check for special-load */
 
@@ -139,24 +138,16 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *info , void *_p)
                type = (int) addr;
        }
 
-       /* create stackframeinfo */
-
-       stacktrace_create_extern_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
-       /* Handle the type. */
-
-       p = signal_handle(xpc, type, val);
-
-       /* remove stackframeinfo */
+       /* Handle the trap. */
 
-       stacktrace_remove_stackframeinfo(&sfi);
+       p = trap_handle(type, val, pv, sp, ra, xpc, _p);
 
        /* set registers */
 
-       ctx->sigc_regs.u_regs[REG_ITMP2_XPTR] = (intptr_t) p;
-       ctx->sigc_regs.u_regs[REG_ITMP3_XPC]  = (intptr_t) xpc;
-       ctx->sigc_regs.tpc                    = (intptr_t) asm_handle_exception;
-       ctx->sigc_regs.tnpc                   = (intptr_t) asm_handle_exception + 4;
+       ctx->sigc_regs.u_regs[REG_ITMP2_XPTR] = (uintptr_t) p;
+       ctx->sigc_regs.u_regs[REG_ITMP3_XPC]  = (uintptr_t) xpc;
+       ctx->sigc_regs.tpc                    = (uintptr_t) asm_handle_exception;
+       ctx->sigc_regs.tnpc                   = (uintptr_t) asm_handle_exception + 4;
 }
 
 
@@ -185,40 +176,6 @@ void md_icacheflush(u1 *addr, s4 nbytes)
        }
 }
 
-#if defined(ENABLE_THREADS)
-/* md_critical_section_restart ************************************************
-   Search the critical sections tree for a matching section and set
-   the NPC to the restart point, if necessary.
-
-   Reads PC and modifies NPC.
-
-******************************************************************************/
-
-void md_critical_section_restart(ucontext_t *_uc)
-{
-       /* mcontext_t *_mc; */
-       sigcontext *ctx;
-       u1         *pc;
-       u1         *npc;
-
-       printf("ignoring md_critical_section_restart\n");
-       return;
-
-       /* again, we are getting sigcontext instead of ucontext */
-       ctx = (sigcontext *) _uc;
-       
-       pc = (u1 *) ctx->sigc_regs.tpc;
-
-       npc = critical_find_restart_point(pc);
-
-       if (npc != NULL) {
-               log_println("md_critical_section_restart: pc=%p, npc=%p", pc, npc);
-               ctx->sigc_regs.tnpc = (ptrint) npc;
-       }
-
-}
-#endif
        
 /*
  * These are local overrides for various environment variables in Emacs.