/* 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.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-os.c 7363 2007-02-15 14:57:04Z twisti $
-
*/
#include "config.h"
#include <assert.h>
+#include <stdint.h>
#include <signal.h>
#include "vm/types.h"
#include "vm/jit/sparc64/codegen.h"
#include "vm/jit/sparc64/md-abi.h"
-#include "vm/exceptions.h"
-#include "vm/signallocal.h"
-#include "vm/stringlocal.h"
+#include "vm/signallocal.hpp"
+
#include "vm/jit/asmpart.h"
-#include "vm/jit/stacktrace.h"
+#include "vm/jit/stacktrace.hpp"
+#include "vm/jit/trap.hpp"
typedef struct sigcontext sigcontext;
u1 *ra;
u1 *xpc;
u4 mcode;
- s4 d;
- s4 s1;
- s4 disp;
- ptrint val;
- ptrint addr;
- s4 type;
- java_objectheader *e;
+ int d;
+ int s1;
+ int16_t disp;
+ intptr_t val;
+ intptr_t addr;
+ int type;
+ void *p;
ctx = (sigcontext *) info;
/* flush register windows? */
- val = md_get_reg_from_context(ctx, d);
+ val = md_get_reg_from_context(ctx, d);
/* check for special-load */
/* This is a normal NPE: addr must be NULL and the NPE-type
define is 0. */
- addr = md_get_reg_from_context(ctx, s1);
- type = (s4) addr;
+ addr = md_get_reg_from_context(ctx, s1);
+ type = (int) addr;
}
+ /* Handle the trap. */
- e = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ p = trap_handle(type, val, pv, sp, ra, xpc, _p);
/* set registers */
- ctx->sigc_regs.u_regs[REG_ITMP2_XPTR] = (ptrint) e;
- ctx->sigc_regs.u_regs[REG_ITMP3_XPC] = (ptrint) xpc;
- ctx->sigc_regs.tpc = (ptrint) asm_handle_exception;
- ctx->sigc_regs.tnpc = (ptrint) 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;
}
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
-void thread_restartcriticalsection(ucontext_t *_uc)
-{
- mcontext_t *_mc;
- void *critical;
-
- _mc = &_uc->uc_mcontext;
-
- critical = thread_checkcritical((void *) _mc->sc_pc);
-
- if (critical)
- _mc->sc_pc = (ptrint) critical;
-}
-#endif
-
-
/* md_icacheflush **************************************************************
Calls the system's function to flush the instruction cache.
}
}
-
-
-
+
/*
* 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