#endif
/* global mutex and condition for joining threads on exit */
-static mutex_t mutex_join;
-static pthread_cond_t cond_join;
-
-/* this is one of the STOPWORLD_FROM_ constants, telling why the world is */
-/* being stopped */
-static volatile int stopworldwhere;
+static Mutex* mutex_join;
+static Condition* cond_join;
#if defined(ENABLE_GC_CACAO)
-
/* semaphore used for acknowleding thread suspension */
static sem_t suspend_ack;
-#if defined(__IRIX__)
-static mutex_t suspend_ack_lock = MUTEX_INITIALIZER;
-static pthread_cond_t suspend_cond = PTHREAD_COND_INITIALIZER;
#endif
- /* mutexes used by the fake atomic instructions */
- #if defined(USE_FAKE_ATOMIC_INSTRUCTIONS)
- mutex_t _cas_lock = MUTEX_INITIALIZER;
- mutex_t _mb_lock = MUTEX_INITIALIZER;
- #endif
-#endif /* ENABLE_GC_CACAO */
--
/* threads_sem_init ************************************************************
#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 md_critical_section_restart(ucontext_t *_uc)
-{
- mcontext_t *_mc;
- u1 *pc;
- u1 *npc;
-
- _mc = &(_uc->uc_mcontext);
-
- pc = (u1 *) _mc->gp_regs[PT_NIP];
-
- npc = critical_find_restart_point(pc);
-
- if (npc != NULL)
- _mc->gp_regs[PT_NIP] = (ptrint) npc;
-}
-#endif
-
-
+ /* md_executionstate_read ******************************************************
+
+ Read the given context into an executionstate.
+
+ *******************************************************************************/
+
+ void md_executionstate_read(executionstate_t *es, void *context)
+ {
+ #if 0
+ ucontext_t *_uc;
+ mcontext_t *_mc;
+ unsigned long *_gregs;
+ s4 i;
+
+ _uc = (ucontext_t *) context;
+
+ _mc = _uc->uc_mcontext.uc_regs;
+ _gregs = _mc->gregs;
+
+ /* read special registers */
+ es->pc = (u1 *) _gregs[PT_NIP];
+ es->sp = (u1 *) _gregs[REG_SP];
+ es->pv = (u1 *) _gregs[REG_PV];
+ es->ra = (u1 *) _gregs[PT_LNK];
+
+ /* read integer registers */
+ for (i = 0; i < INT_REG_CNT; i++)
+ es->intregs[i] = _gregs[i];
+
+ /* read float registers */
+ /* Do not use the assignment operator '=', as the type of
+ * the _mc->fpregs[i] can cause invalid conversions. */
+
+ assert(sizeof(_mc->fpregs.fpregs) == sizeof(es->fltregs));
+ system_memcpy(&es->fltregs, &_mc->fpregs.fpregs, sizeof(_mc->fpregs.fpregs));
+ #endif
+
+ vm_abort("md_executionstate_read: IMPLEMENT ME!");
+ }
+
+
+ /* md_executionstate_write *****************************************************
+
+ Write the given executionstate back to the context.
+
+ *******************************************************************************/
+
+ void md_executionstate_write(executionstate_t *es, void *context)
+ {
+ #if 0
+ ucontext_t *_uc;
+ mcontext_t *_mc;
+ unsigned long *_gregs;
+ s4 i;
+
+ _uc = (ucontext_t *) context;
+
+ _mc = _uc->uc_mcontext.uc_regs;
+ _gregs = _mc->gregs;
+
+ /* write integer registers */
+ for (i = 0; i < INT_REG_CNT; i++)
+ _gregs[i] = es->intregs[i];
+
+ /* write float registers */
+ /* Do not use the assignment operator '=', as the type of
+ * the _mc->fpregs[i] can cause invalid conversions. */
+
+ assert(sizeof(_mc->fpregs.fpregs) == sizeof(es->fltregs));
+ system_memcpy(&_mc->fpregs.fpregs, &es->fltregs, sizeof(_mc->fpregs.fpregs));
+
+ /* write special registers */
+ _gregs[PT_NIP] = (ptrint) es->pc;
+ _gregs[REG_SP] = (ptrint) es->sp;
+ _gregs[REG_PV] = (ptrint) es->pv;
+ _gregs[PT_LNK] = (ptrint) es->ra;
+ #endif
+
+ vm_abort("md_executionstate_write: IMPLEMENT ME!");
+ }
+
+
/*
* 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