// all start at offset 0
virtual ~Context_base() = 0;
-protected:
- Mword _state;
-};
-
-//---------------------------------------------------------------------------
-INTERFACE [mp]:
-
-EXTENSION class Context_base
-{
protected:
friend unsigned &__cpu_of(const void *);
+ Mword _state;
unsigned _cpu;
};
-//---------------------------------------------------------------------------
-IMPLEMENTATION [!mp]:
-
-inline
-void set_cpu_of(const void *ptr, unsigned cpu)
-{ (void)ptr; (void)cpu; }
-
-inline
-unsigned cpu_of(const void *)
-{ return 0; }
-
-inline
-unsigned current_cpu()
-{ return 0; }
//---------------------------------------------------------------------------
IMPLEMENTATION:
Context *current()
{ return context_of((void *)Proc::stack_pointer()); }
-//---------------------------------------------------------------------------
-IMPLEMENTATION [mp]:
-
-#include "config.h"
-
inline NEEDS ["config.h"]
unsigned &__cpu_of(const void *ptr)
{ return reinterpret_cast<Context_base*>(context_of(ptr))->_cpu; }
unsigned cpu_of(const void *ptr)
{ return __cpu_of(ptr); }
+//---------------------------------------------------------------------------
+IMPLEMENTATION [!mp]:
+
+inline
+unsigned current_cpu()
+{ return 0; }
+
+//---------------------------------------------------------------------------
+IMPLEMENTATION [mp]:
+
inline NEEDS [current, cpu_of]
unsigned current_cpu()
{ return cpu_of(current()); }