Changes: Edwin Steiner
- $Id: md.c 4908 2006-05-12 16:49:50Z edwin $
+ $Id: md.c 5051 2006-06-28 15:39:22Z twisti $
*/
#include "vm/jit/x86_64/md-abi.h"
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
+#endif
+
#include "vm/exceptions.h"
#include "vm/signallocal.h"
#include "vm/jit/asmpart.h"
}
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
-void thread_restartcriticalsection(ucontext_t *uc)
+/* md_signal_handler_sigusr2 ***************************************************
+
+ NullPointerException signal handler for hardware null pointer
+ check.
+
+*******************************************************************************/
+
+void md_signal_handler_sigusr2(int sig, siginfo_t *siginfo, void *_p)
{
- void *critical;
+ threadobject *t;
+ ucontext_t *_uc;
+ mcontext_t *_mc;
+ u1 *pc;
+
+ t = THREADOBJECT;
+
+ _uc = (ucontext_t *) _p;
+ _mc = &_uc->uc_mcontext;
+
+ /* ATTENTION: Don't use CACAO's internal REG_* defines as they are
+ different to the ones in <ucontext.h>. */
+
+ pc = (u1 *) _mc->gregs[REG_RIP];
+
+ t->pc = pc;
+}
+
+
+#if defined(ENABLE_THREADS)
+void thread_restartcriticalsection(ucontext_t *_uc)
+{
+ mcontext_t *_mc;
+ void *pc;
+
+ _mc = &_uc->uc_mcontext;
- critical = critical_find_restart_point((void *) uc->uc_mcontext.gregs[REG_RIP]);
+ pc = critical_find_restart_point((void *) _mc->gregs[REG_RIP]);
- if (critical)
- uc->uc_mcontext.gregs[REG_RIP] = (ptrint) critical;
+ if (pc != NULL)
+ _mc->gregs[REG_RIP] = (ptrint) pc;
}
#endif