diff --git a/CHANGELOG.md b/CHANGELOG.md
index dc2069f..97e3d24 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Changed
+
+- Add support for `nosv_attach` and `nosv_detach` events VA{aAeE}.
+- Ignore old nOS-V attach events VH{aA}.
+- The nOS-V model version is bumped to 1.1.0.
+
## [1.6.0] - 2024-02-14
### Changed
diff --git a/cfg/cpu/nosv/subsystem.cfg b/cfg/cpu/nosv/subsystem.cfg
index 25ca788..5dc6fc5 100644
--- a/cfg/cpu/nosv/subsystem.cfg
+++ b/cfg/cpu/nosv/subsystem.cfg
@@ -17,7 +17,7 @@ window_comm_lines_enabled true
window_flags_enabled false
window_noncolor_mode true
window_custom_color_enabled true
-window_custom_color_palette {6.000000000000:94,0,0},{7.000000000000:153,114,0},{9.000000000000:124,213,228},{10.000000000000:242,239,141},{11.000000000000:0,70,0}
+window_custom_color_palette {6.000000000000:94,0,0},{7.000000000000:153,114,0},{9.000000000000:124,213,228},{10.000000000000:242,239,141},{11.000000000000:0,70,0},{19.000000000000:195,96,151},{20.000000000000:255,162,255},{21.000000000000:0,99,162}
window_logical_filtered true
window_physical_filtered false
window_comm_fromto true
diff --git a/cfg/thread/nosv/subsystem.cfg b/cfg/thread/nosv/subsystem.cfg
index 40b1aa6..427dc7c 100644
--- a/cfg/thread/nosv/subsystem.cfg
+++ b/cfg/thread/nosv/subsystem.cfg
@@ -17,7 +17,7 @@ window_comm_lines_enabled true
window_flags_enabled false
window_noncolor_mode true
window_custom_color_enabled true
-window_custom_color_palette {6.000000000000:94,0,0},{7.000000000000:153,114,0},{9.000000000000:124,213,228},{10.000000000000:242,239,141},{11.000000000000:0,70,0}
+window_custom_color_palette {6.000000000000:94,0,0},{7.000000000000:153,114,0},{9.000000000000:124,213,228},{10.000000000000:242,239,141},{11.000000000000:0,70,0},{19.000000000000:195,96,151},{20.000000000000:255,162,255},{21.000000000000:0,99,162}
window_logical_filtered true
window_physical_filtered false
window_comm_fromto true
diff --git a/doc/user/emulation/events.md b/doc/user/emulation/events.md
index 0a95bdd..45b5a13 100644
--- a/doc/user/emulation/events.md
+++ b/doc/user/emulation/events.md
@@ -1,7 +1,7 @@
# Emulator events
This is a exhaustive list of the events recognized by the emulator.
-Built on Jan 29 2024.
+Built on Feb 15 2024.
## Model nanos6
@@ -485,7 +485,7 @@ List of events for the model *tampi* with identifier **`T`** at version `1.0.0`:
## Model nosv
-List of events for the model *nosv* with identifier **`V`** at version `1.0.0`:
+List of events for the model *nosv* with identifier **`V`** at version `1.1.0`:
VTc(u32 taskid, u32 typeid)
- creates task %{taskid} with type %{typeid}
@@ -553,6 +553,14 @@ List of events for the model *nosv* with identifier **`V`** at version `1.0.0`:
- enters nosv_schedpoint()
VAC
- leaves nosv_schedpoint()
+VAa
+- enters nosv_attach()
+VAA
+- leaves nosv_attach()
+VAe
+- enters nosv_detach()
+VAE
+- leaves nosv_detach()
VHa
- enters nosv_attach()
VHA
diff --git a/src/emu/nosv/event.c b/src/emu/nosv/event.c
index 3f596ed..bfe5051 100644
--- a/src/emu/nosv/event.c
+++ b/src/emu/nosv/event.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
+/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#include "nosv_priv.h"
@@ -55,11 +55,15 @@ static const int ss_table[256][256][3] = {
['W'] = { CHSS, POP, ST_API_WAITFOR },
['c'] = { CHSS, PUSH, ST_API_SCHEDPOINT },
['C'] = { CHSS, POP, ST_API_SCHEDPOINT },
+ ['a'] = { CHSS, PUSH, ST_API_ATTACH },
+ ['A'] = { CHSS, POP, ST_API_ATTACH },
+ ['e'] = { CHSS, PUSH, ST_API_DETACH },
+ ['E'] = { CHSS, POP, ST_API_DETACH },
},
/* FIXME: Move thread type to another channel, like nanos6 */
['H'] = {
- ['a'] = { CHSS, PUSH, ST_ATTACH },
- ['A'] = { CHSS, POP, ST_ATTACH },
+ ['a'] = { CHSS, IGN, 0 },
+ ['A'] = { CHSS, IGN, 0 },
['w'] = { CHSS, PUSH, ST_WORKER },
['W'] = { CHSS, POP, ST_WORKER },
['d'] = { CHSS, PUSH, ST_DELEGATE },
diff --git a/src/emu/nosv/nosv_priv.h b/src/emu/nosv/nosv_priv.h
index 16b7330..cef68e7 100644
--- a/src/emu/nosv/nosv_priv.h
+++ b/src/emu/nosv/nosv_priv.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
+/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#ifndef NOSV_PRIV_H
@@ -34,7 +34,8 @@ enum nosv_ss_values {
ST_API_YIELD,
ST_API_WAITFOR,
ST_API_SCHEDPOINT,
- ST_ATTACH,
+ ST_API_ATTACH,
+ ST_API_DETACH,
ST_WORKER,
ST_DELEGATE,
diff --git a/src/emu/nosv/setup.c b/src/emu/nosv/setup.c
index 9dc2069..fd4bfeb 100644
--- a/src/emu/nosv/setup.c
+++ b/src/emu/nosv/setup.c
@@ -57,6 +57,8 @@ static struct ev_decl model_evlist[] = {
PAIR_E("VAy", "VAY", "nosv_yield()")
PAIR_E("VAw", "VAW", "nosv_waitfor()")
PAIR_E("VAc", "VAC", "nosv_schedpoint()")
+ PAIR_E("VAa", "VAA", "nosv_attach()")
+ PAIR_E("VAe", "VAE", "nosv_detach()")
/* FIXME: VHA and VHa are not subsystems */
{ "VHa", "enters nosv_attach()" },
@@ -70,7 +72,7 @@ static struct ev_decl model_evlist[] = {
struct model_spec model_nosv = {
.name = model_name,
- .version = "1.0.0",
+ .version = "1.1.0",
.evlist = model_evlist,
.model = model_id,
.create = model_nosv_create,
@@ -135,7 +137,8 @@ static const struct pcf_value_label nosv_ss_values[] = {
{ ST_API_YIELD, "API: Yield" },
{ ST_API_WAITFOR, "API: Waitfor" },
{ ST_API_SCHEDPOINT, "API: Scheduling point" },
- { ST_ATTACH, "Thread: Attached" },
+ { ST_API_ATTACH, "API: Attach" },
+ { ST_API_DETACH, "API: Detach" },
{ ST_WORKER, "Thread: Worker" },
{ ST_DELEGATE, "Thread: Delegate" },
{ EV_SCHED_SEND, "EV Scheduler: Send task" },
diff --git a/test/emu/nosv/CMakeLists.txt b/test/emu/nosv/CMakeLists.txt
index f65bb8b..9e11a54 100644
--- a/test/emu/nosv/CMakeLists.txt
+++ b/test/emu/nosv/CMakeLists.txt
@@ -1,6 +1,8 @@
-# Copyright (c) 2022-2023 Barcelona Supercomputing Center (BSC)
+# Copyright (c) 2022-2024 Barcelona Supercomputing Center (BSC)
# SPDX-License-Identifier: GPL-3.0-or-later
+test_emu(attach.c)
+test_emu(attach-old.c)
test_emu(nested-tasks.c)
test_emu(nested-tasks-bad.c SHOULD_FAIL
REGEX "cannot execute task 1: state is not created")
diff --git a/test/emu/nosv/attach-old.c b/test/emu/nosv/attach-old.c
new file mode 100644
index 0000000..626ce6b
--- /dev/null
+++ b/test/emu/nosv/attach-old.c
@@ -0,0 +1,25 @@
+/* Copyright (c) 2024 Barcelona Supercomputing Center (BSC)
+ * SPDX-License-Identifier: GPL-3.0-or-later */
+
+#include "compat.h"
+#include "ovni.h"
+#include "instr.h"
+#include "instr_nosv.h"
+
+/* Checks that we can still process a trace which contains the VH{aA} attach
+ * events, by simply ignoring them */
+
+int
+main(void)
+{
+ instr_start(0, 1);
+ ovni_thread_require("nosv", "1.0.0");
+
+ instr_nosv_attached();
+ sleep_us(100);
+ instr_nosv_detached();
+
+ instr_end();
+
+ return 0;
+}
diff --git a/test/emu/nosv/attach.c b/test/emu/nosv/attach.c
new file mode 100644
index 0000000..db6505e
--- /dev/null
+++ b/test/emu/nosv/attach.c
@@ -0,0 +1,28 @@
+/* Copyright (c) 2024 Barcelona Supercomputing Center (BSC)
+ * SPDX-License-Identifier: GPL-3.0-or-later */
+
+#include "compat.h"
+#include "instr.h"
+#include "instr_nosv.h"
+
+/* Test the nosv_attach() and nosv_detach() API events, introduced in the nOS-V
+ * model 1.1.0 */
+
+int
+main(void)
+{
+ instr_start(0, 1);
+ instr_nosv_init();
+
+ instr_nosv_attach_enter();
+ sleep_us(100);
+ instr_nosv_attach_exit();
+
+ instr_nosv_detach_enter();
+ sleep_us(100);
+ instr_nosv_detach_exit();
+
+ instr_end();
+
+ return 0;
+}
diff --git a/test/emu/nosv/instr_nosv.h b/test/emu/nosv/instr_nosv.h
index e21ee52..307f6cc 100644
--- a/test/emu/nosv/instr_nosv.h
+++ b/test/emu/nosv/instr_nosv.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
+/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#ifndef INSTR_NOSV_H
@@ -45,6 +45,12 @@ INSTR_1ARG(instr_nosv_task_end, "VTe", int32_t, id)
INSTR_0ARG(instr_nosv_submit_enter, "VAs")
INSTR_0ARG(instr_nosv_submit_exit, "VAS")
+INSTR_0ARG(instr_nosv_attach_enter, "VAa")
+INSTR_0ARG(instr_nosv_attach_exit, "VAA")
+INSTR_0ARG(instr_nosv_detach_enter, "VAe")
+INSTR_0ARG(instr_nosv_detach_exit, "VAE")
+INSTR_0ARG(instr_nosv_attached, "VHa") /* deprecated */
+INSTR_0ARG(instr_nosv_detached, "VHA") /* deprecated */
#endif /* INSTR_NOSV_H */
diff --git a/test/rt/nosv/attach.c b/test/rt/nosv/attach.c
index 2731247..71e9978 100644
--- a/test/rt/nosv/attach.c
+++ b/test/rt/nosv/attach.c
@@ -13,7 +13,7 @@ main(void)
nosv_init();
nosv_task_t task;
- if (nosv_attach(&task, NULL, NULL, 0) != 0)
+ if (nosv_attach(&task, NULL, "attached-task", 0) != 0)
die("nosv_attach failed");
sleep_us(100);