Run Nanos6 connect hook at init for breakdown

This commit is contained in:
Rodrigo Arias 2023-03-24 19:30:49 +01:00 committed by Rodrigo Arias Mallo
parent 1c82470bfc
commit 999a79b074
3 changed files with 18 additions and 1 deletions

View File

@ -565,6 +565,9 @@ model_nanos6_event(struct emu *emu)
static int enabled = 0;
if (!enabled) {
struct nanos6_emu *memu = EXT(emu, '6');
memu->event = 1;
if (model_nanos6_connect(emu) != 0) {
err("nanos6_connect failed");
return -1;

View File

@ -87,6 +87,8 @@ struct nanos6_proc {
};
struct nanos6_emu {
int connected;
int event;
struct breakdown_emu brk;
};

View File

@ -35,7 +35,7 @@ struct model_spec model_nanos6 = {
.name = model_name,
.model = model_id,
.create = model_nanos6_create,
// .connect = model_nanos6_connect,
.connect = model_nanos6_connect,
.event = model_nanos6_event,
.probe = model_nanos6_probe,
.finish = model_nanos6_finish,
@ -282,6 +282,16 @@ model_nanos6_create(struct emu *emu)
int
model_nanos6_connect(struct emu *emu)
{
struct nanos6_emu *memu = EXT(emu, model_id);
if (memu->connected)
return 0;
/* Only skip connection if event not reached and
* breakdown not enabled */
if (!memu->event && !emu->args.breakdown)
return 0;
if (model_thread_connect(emu, &th_spec) != 0) {
err("model_thread_connect failed");
return -1;
@ -314,6 +324,8 @@ model_nanos6_connect(struct emu *emu)
mux_set_default(mux, value_int64(ST_WORKER_IDLE));
}
memu->connected = 1;
return 0;
}