* src/threads/critical.c: Removed.
[cacao.git] / src / vm / jit / mips / irix / md-os.c
index d1b6f5a6919ee927838b7f20edc8d592105f276a..f2bea4b9bafc49bdc22bc5144b9b693edd4208ca 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/mips/irix/md-os.c - machine dependent MIPS IRIX functions
 
-   Copyright (C) 1996-2005, 2006, 2007 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, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
@@ -22,8 +20,6 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md-os.c 7997 2007-05-31 23:26:23Z twisti $
-
 */
 
 
@@ -31,6 +27,7 @@
 
 #include <assert.h>
 #include <signal.h>
+#include <stdint.h>
 #include <sys/fpu.h>
 
 #include "vm/types.h"
@@ -40,7 +37,6 @@
 
 #include "mm/gc-common.h"
 
-#include "vm/exceptions.h"
 #include "vm/global.h"
 #include "vm/signallocal.h"
 #include "vm/stringlocal.h"
@@ -62,7 +58,7 @@ void md_init(void)
        /* dummy allocation here to ensure that the GC is initialized.            */
 
 #if defined(ENABLE_GC_BOEHM)
-       heap_allocate(1, 0, NULL);
+       (void) GCNEW(u1);
 #endif
 
 
@@ -85,20 +81,20 @@ void md_init(void)
 
 void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
 {
-       ucontext_t        *_uc;
-       mcontext_t        *_mc;
-       u1                *pv;
-       u1                *sp;
-       u1                *ra;
-       u1                *xpc;
-       u4                 mcode;
-       s4                 d;
-       s4                 s1;
-       s4                 disp;
-       ptrint             val;
-       ptrint             addr;
-       s4                 type;
-       java_objectheader *o;
+       ucontext_t     *_uc;
+       mcontext_t     *_mc;
+       u1             *pv;
+       u1             *sp;
+       u1             *ra;
+       u1             *xpc;
+       u4              mcode;
+       int             d;
+       int             s1;
+       int16_t         disp;
+       intptr_t        val;
+       intptr_t        addr;
+       int              type;
+       void           *p;
 
        _uc = (struct ucontext *) _p;
        _mc = &_uc->uc_mcontext;
@@ -129,48 +125,22 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
                   define is 0. */
 
                addr = _mc->gregs[s1];
-               type = (s4) addr;
+               type = (int) addr;
                val  = 0;
        }
 
-       /* generate appropriate exception */
-
-       o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
-
-       /* set registers */
-
-       _mc->gregs[REG_ITMP1_XPTR] = (ptrint) o;
-       _mc->gregs[REG_ITMP2_XPC]  = (ptrint) xpc;
-       _mc->gregs[CTX_EPC]        = (ptrint) asm_handle_exception;
-}
-
+       /* Handle the type. */
 
-/* md_critical_section_restart *************************************************
+       p = signal_handle(type, val, pv, sp, ra, xpc, _p);
 
-   Search the critical sections tree for a matching section and set
-   the PC to the restart point, if necessary.
-
-*******************************************************************************/
+       /* set registers (only if exception object ready) */
 
-#if defined(ENABLE_THREADS)
-void md_critical_section_restart(ucontext_t *_uc)
-{
-       mcontext_t *_mc;
-       u1         *pc;
-       u1         *npc;
-
-       _mc = &_uc->uc_mcontext;
-
-       pc = (u1 *) _mc->gregs[CTX_EPC];
-
-       npc = critical_find_restart_point(pc);
-
-       if (npc != NULL) {
-               log_println("md_critical_section_restart: pc=%p, npc=%p", pc, npc);
-               _mc->gregs[CTX_EPC] = (ptrint) npc;
+       if (p != NULL) {
+               _mc->gregs[REG_ITMP1_XPTR] = (intptr_t) p;
+               _mc->gregs[REG_ITMP2_XPC]  = (intptr_t) xpc;
+               _mc->gregs[CTX_EPC]        = (intptr_t) asm_handle_exception;
        }
 }
-#endif
 
 
 /*