diff --git a/src/emu/CMakeLists.txt b/src/emu/CMakeLists.txt index c65c99f..5cdbdf8 100644 --- a/src/emu/CMakeLists.txt +++ b/src/emu/CMakeLists.txt @@ -45,6 +45,7 @@ add_library(emu STATIC ovni/probe.c ovni/create.c ovni/event.c + ovni/finish.c nanos6/setup.c nanos6/event.c nosv/setup.c diff --git a/src/emu/ovni/finish.c b/src/emu/ovni/finish.c new file mode 100644 index 0000000..9cc6bb7 --- /dev/null +++ b/src/emu/ovni/finish.c @@ -0,0 +1,21 @@ +/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) + * SPDX-License-Identifier: GPL-3.0-or-later */ + +#include "ovni_priv.h" + +int +ovni_finish(struct emu *emu) +{ + struct system *sys = &emu->system; + int ret = 0; + + /* Ensure that all threads are in the Dead state */ + for (struct thread *t = sys->threads; t; t = t->gnext) { + if (t->state != TH_ST_DEAD) { + err("thread %d is not dead (%s)", t->tid, t->id); + ret = -1; + } + } + + return ret; +} diff --git a/src/emu/ovni/ovni_priv.h b/src/emu/ovni/ovni_priv.h index 2d473f9..cbc0148 100644 --- a/src/emu/ovni/ovni_priv.h +++ b/src/emu/ovni/ovni_priv.h @@ -38,5 +38,6 @@ struct ovni_cpu { int ovni_probe(struct emu *emu); int ovni_create(struct emu *emu); int ovni_event(struct emu *emu); +int ovni_finish(struct emu *emu); #endif /* OVNI_PRIV_H */ diff --git a/src/emu/ovni/probe.c b/src/emu/ovni/probe.c index 566901b..dcd072a 100644 --- a/src/emu/ovni/probe.c +++ b/src/emu/ovni/probe.c @@ -10,6 +10,7 @@ struct model_spec model_ovni = { .connect = NULL, .event = ovni_event, .probe = ovni_probe, + .finish = ovni_finish, }; int