Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-os.c 7683 2007-04-10 21:37:03Z twisti $
-
*/
#include <assert.h>
#include <sgidefs.h> /* required for _MIPS_SIM_ABI* defines (before signal.h) */
#include <signal.h>
+#include <stdint.h>
#include <ucontext.h>
#include "vm/types.h"
#include "mm/gc-common.h"
-#include "vm/exceptions.h"
-#include "vm/stringlocal.h"
+#include "vm/signallocal.h"
#include "vm/jit/asmpart.h"
#include "vm/jit/stacktrace.h"
void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
{
- ucontext_t *_uc;
- mcontext_t *_mc;
- greg_t *_gregs;
- u1 *pv;
- u1 *sp;
- u1 *ra;
- u1 *xpc;
- unsigned int cause;
- u4 mcode;
- s4 d;
- s4 s1;
- s4 disp;
- ptrint val;
- ptrint addr;
- s4 type;
- java_objectheader *o;
+ stackframeinfo sfi;
+ ucontext_t *_uc;
+ mcontext_t *_mc;
+ greg_t *_gregs;
+ u1 *pv;
+ u1 *sp;
+ u1 *ra;
+ u1 *xpc;
+ unsigned int cause;
+ 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;
val = 0;
}
- /* generate appropriate exception */
+ /* create stackframeinfo */
+
+ stacktrace_create_extern_stackframeinfo(&sfi, pv, sp, ra, xpc);
+
+ /* Handle the type. */
+
+ p = signal_handle(xpc, type, val);
- o = exceptions_new_hardware_exception(pv, sp, ra, xpc, type, val);
+ /* remove stackframeinfo */
- /* set registers */
+ stacktrace_remove_stackframeinfo(&sfi);
- _gregs[REG_ITMP1_XPTR] = (ptrint) o;
- _gregs[REG_ITMP2_XPC] = (ptrint) xpc;
+ /* set registers (only if exception object ready) */
+
+ if (p != NULL) {
+ _gregs[REG_ITMP1_XPTR] = (intptr_t) p;
+ _gregs[REG_ITMP2_XPC] = (intptr_t) xpc;
#if defined(__UCLIBC__)
- _gregs[CTX_EPC] = (ptrint) asm_handle_exception;
+ _gregs[CTX_EPC] = (intptr_t) asm_handle_exception;
#else
- _mc->pc = (ptrint) asm_handle_exception;
+ _mc->pc = (intptr_t) asm_handle_exception;
#endif
+ }
+ else {
+#if defined(__UCLIBC__)
+ _gregs[CTX_EPC] = (intptr_t) xpc;
+#else
+ _mc->pc = (intptr_t) xpc;
+#endif
+ }
}
}
+/* md_critical_section_restart *************************************************
+
+ Search the critical sections tree for a matching section and set
+ the PC to the restart point, if necessary.
+
+*******************************************************************************/
+
#if defined(ENABLE_THREADS)
-void thread_restartcriticalsection(ucontext_t *_uc)
+void md_critical_section_restart(ucontext_t *_uc)
{
mcontext_t *_mc;
u1 *pc;