#ifdef ENABLE_SMP
#include "history.h"
+#include "osio.h"
#include <errno.h>
/* The chain of processors, starting with processor0 -- main()'s thread: */
#endif
}
+DEFINE_PRIMITIVE ("SMP-IDLE", Prim_smp_idle, 0, 0, "(SMP-IDLE)\n\
+Wait for interrupts.")
+{
+ PRIMITIVE_HEADER (0);
+
+#ifdef ENABLE_SMP
+ assert (self->state == PROCESSOR_RUNNING || self->state == PROCESSOR_IDLE);
+
+ trace (";%d SMP-Idle.", self->id);
+ self->state = PROCESSOR_IDLE;
+
+ /* Abandon continuation. */
+ stack_pointer = STACK_BOTTOM;
+ Will_Push (CONTINUATION_SIZE);
+ SET_RC (RC_END_OF_COMPUTATION);
+ SET_EXP (SHARP_F);
+ SAVE_CONT ();
+ Pushed ();
+
+ SET_INTERRUPT_MASK (INT_Mask);
+ while (! (PENDING_INTERRUPTS_P))
+ {
+ OS_pause (1);
+ trace (";%d SMP-Idle awoke to 0x%04x.", self->id, GET_INT_CODE);
+ }
+ self->state = PROCESSOR_RUNNING;
+ signal_interrupt_from_primitive ();
+#else
+ signal_error_from_primitive (ERR_UNIMPLEMENTED_PRIMITIVE);
+#endif
+}
+
DEFINE_PRIMITIVE ("SMP-WAKE", Prim_smp_wake, 1, 1, "(SMP-WAKE id)\n\
Send a timer interrupt to processor ID.")
{