#define M5OP_SE_PAGE_FAULT 0x61
#define M5OP_DIST_TOGGLE_SYNC 0x62
+#define M5OP_WORKLOAD 0x70
+
#define M5OP_FOREACH \
M5OP(m5_arm, M5OP_ARM) \
M5OP(m5_work_end, M5OP_WORK_END) \
M5OP(m5_se_syscall, M5OP_SE_SYSCALL) \
M5OP(m5_se_page_fault, M5OP_SE_PAGE_FAULT) \
- M5OP(m5_dist_toggle_sync, M5OP_DIST_TOGGLE_SYNC)
+ M5OP(m5_dist_toggle_sync, M5OP_DIST_TOGGLE_SYNC) \
+ M5OP(m5_workload, M5OP_WORKLOAD) \
#define M5OP_MERGE_TOKENS_I(a, b) a##b
#define M5OP_MERGE_TOKENS(a, b) M5OP_MERGE_TOKENS_I(a, b)
void m5_se_syscall();
void m5_se_page_fault();
+/*
+ * Send a very generic poke to the workload so it can do something. It's up to
+ * the workload to know what information to look for to interpret an event,
+ * such as what PC it came from, what register values are, or the context of
+ * the workload itself (is this SE mode? which OS is running?).
+ */
+void m5_workload();
+
#ifdef __cplusplus
}
#endif
DistIface::toggleSync(tc);
}
+void
+triggerWorkloadEvent(ThreadContext *tc)
+{
+ DPRINTF(PseudoInst, "PseudoInst::triggerWorkloadEvent()\n");
+ tc->getSystemPtr()->workload->event(tc);
+}
+
//
// This function is executed when annotated work items begin. Depending on
// what the user specified at the command line, the simulation may exit and/or
void workend(ThreadContext *tc, uint64_t workid, uint64_t threadid);
void m5Syscall(ThreadContext *tc);
void togglesync(ThreadContext *tc);
+void triggerWorkloadEvent(ThreadContext *tc);
/**
* Execute a decoded M5 pseudo instruction
invokeSimcall<ABI>(tc, togglesync);
return true;
+ case M5OP_WORKLOAD:
+ invokeSimcall<ABI>(tc, triggerWorkloadEvent);
+ return true;
+
default:
warn("Unhandled m5 op: %#x\n", func);
return false;
}
void syscall(ThreadContext *tc) override;
+
+ // For now, assume the only type of events are system calls.
+ void event(ThreadContext *tc) override { syscall(tc); }
};
#endif // __SIM_SE_WORKLOAD_HH__
panic("syscall() not implemented.");
}
+ virtual void
+ event(ThreadContext *tc)
+ {
+ warn("Unhandled workload event.");
+ }
+
/** @{ */
/**
* Add a function-based event to the given function, to be looked