{
DBG();
Thread *old = thread_current();
+ scheduler->set_current_thread(NULL);
ASSERT(!old->get_pending());
old->set_pending(act);
if (Thread::swap(old, &system_context) < 0) {
#include "mymemory.h"
#include "snapshot.h"
#include "common.h"
+#include "threads-model.h"
+#include "model.h"
#define REQUESTS_BEFORE_ALLOC 1024
*/
void *malloc(size_t size)
{
- if (user_snapshot_space)
+ if (user_snapshot_space) {
+ /* Only perform user allocations from user context */
+ ASSERT(!model || thread_current());
return user_malloc(size);
- else
+ } else
return HandleEarlyAllocationRequest(size);
}
*/
void Scheduler::set_current_thread(Thread *t)
{
- ASSERT(t && !t->is_model_thread());
+ ASSERT(!t || !t->is_model_thread());
current = t;
if (DBG_ENABLED())