/* 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.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-os.c 7997 2007-05-31 23:26:23Z twisti $
-
*/
#include <assert.h>
#include <signal.h>
+#include <stdint.h>
#include <sys/fpu.h>
#include "vm/types.h"
#include "mm/gc-common.h"
-#include "vm/exceptions.h"
#include "vm/global.h"
#include "vm/signallocal.h"
#include "vm/stringlocal.h"
/* dummy allocation here to ensure that the GC is initialized. */
#if defined(ENABLE_GC_BOEHM)
- heap_allocate(1, 0, NULL);
+ (void) GCNEW(u1);
#endif
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;
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
/*