diff --git a/src/emu/cpu.c b/src/emu/cpu.c index bd3edf0..155240b 100644 --- a/src/emu/cpu.c +++ b/src/emu/cpu.c @@ -8,20 +8,21 @@ #include "value.h" #include "utlist.h" #include "pv/pvt.h" +#include "emu_prv.h" static const char chan_fmt[] = "cpu%ld.%s"; static const char *chan_name[] = { - [CPU_CHAN_NRUN] = "nrunning", - [CPU_CHAN_PID] = "pid_running", - [CPU_CHAN_TID] = "tid_running", + [CPU_CHAN_NRUN] = "nrunning", + [CPU_CHAN_PID] = "pid_running", + [CPU_CHAN_TID] = "tid_running", [CPU_CHAN_THRUN] = "th_running", [CPU_CHAN_THACT] = "th_active", }; static int chan_type[] = { - [CPU_CHAN_PID] = 1, - [CPU_CHAN_TID] = 2, - [CPU_CHAN_NRUN] = 3, + [CPU_CHAN_PID] = PRV_CPU_PID, + [CPU_CHAN_TID] = PRV_CPU_TID, + [CPU_CHAN_NRUN] = PRV_CPU_NRUN, [CPU_CHAN_THRUN] = -1, [CPU_CHAN_THACT] = -1, }; diff --git a/src/emu/emu_prv.h b/src/emu/emu_prv.h new file mode 100644 index 0000000..ba25b41 --- /dev/null +++ b/src/emu/emu_prv.h @@ -0,0 +1,31 @@ +/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) + * SPDX-License-Identifier: GPL-3.0-or-later */ + +#ifndef EMU_PRV_H +#define EMU_PRV_H + +/* Global table of static PRV types */ +enum emu_prv_types { + PRV_CPU_PID = 1, + PRV_CPU_TID = 2, + PRV_CPU_NRUN = 3, + PRV_THREAD_TID = PRV_CPU_TID, + PRV_THREAD_STATE = 4, + PRV_THREAD_CPU = 6, + PRV_OVNI_FLUSH = 7, + PRV_NOSV_TASKID = 10, + PRV_NOSV_TYPE = 11, + PRV_NOSV_APPID = 12, + PRV_NOSV_SUBSYSTEM = 13, + PRV_NOSV_RANK = 14, + PRV_NODES_SUBSYSTEM = 30, + PRV_NANOS6_TASKID = 35, + PRV_NANOS6_TYPE = 36, + PRV_NANOS6_SUBSYSTEM = 37, + PRV_NANOS6_RANK = 38, + PRV_NANOS6_THREAD = 39, + PRV_KERNEL_CS = 45, + PRV_RESERVED = 100, +}; + +#endif /* EMU_PRV_H */ diff --git a/src/emu/kernel/setup.c b/src/emu/kernel/setup.c index 02a723a..8b3a333 100644 --- a/src/emu/kernel/setup.c +++ b/src/emu/kernel/setup.c @@ -1,5 +1,7 @@ #include "kernel_priv.h" +#include "emu_prv.h" + static const char model_name[] = "kernel"; enum { model_id = 'K' }; @@ -25,7 +27,7 @@ static const int chan_stack[CH_MAX] = { /* ----------------- pvt ------------------ */ static const int pvt_type[] = { - [CH_CS] = 45, + [CH_CS] = PRV_KERNEL_CS, }; static const char *pcf_prefix[CH_MAX] = { diff --git a/src/emu/nanos6/setup.c b/src/emu/nanos6/setup.c index 1193dc2..f639a56 100644 --- a/src/emu/nanos6/setup.c +++ b/src/emu/nanos6/setup.c @@ -1,5 +1,7 @@ #include "nanos6_priv.h" +#include "emu_prv.h" + static const char model_name[] = "nanos6"; enum { model_id = '6' }; @@ -31,11 +33,11 @@ static const int chan_stack[CH_MAX] = { /* ----------------- pvt ------------------ */ static const int pvt_type[] = { - [CH_TASKID] = 35, - [CH_TYPE] = 36, - [CH_SUBSYSTEM] = 37, - [CH_RANK] = 38, - [CH_THREAD] = 39, + [CH_TASKID] = PRV_NANOS6_TASKID, + [CH_TYPE] = PRV_NANOS6_TYPE, + [CH_SUBSYSTEM] = PRV_NANOS6_SUBSYSTEM, + [CH_RANK] = PRV_NANOS6_RANK, + [CH_THREAD] = PRV_NANOS6_THREAD, }; static const char *pcf_prefix[CH_MAX] = { diff --git a/src/emu/nodes/setup.c b/src/emu/nodes/setup.c index 8f5b337..ae46d6a 100644 --- a/src/emu/nodes/setup.c +++ b/src/emu/nodes/setup.c @@ -1,5 +1,7 @@ #include "nodes_priv.h" +#include "emu_prv.h" + static const char model_name[] = "nodes"; enum { model_id = 'D' }; @@ -26,7 +28,7 @@ static const int chan_stack[CH_MAX] = { /* ----------------- pvt ------------------ */ static const int pvt_type[] = { - [CH_SUBSYSTEM] = 30, + [CH_SUBSYSTEM] = PRV_NODES_SUBSYSTEM, }; static const char *pcf_prefix[CH_MAX] = { diff --git a/src/emu/nosv/setup.c b/src/emu/nosv/setup.c index 6f53447..d57ba83 100644 --- a/src/emu/nosv/setup.c +++ b/src/emu/nosv/setup.c @@ -1,5 +1,7 @@ #include "nosv_priv.h" +#include "emu_prv.h" + static const char model_name[] = "nosv"; enum { model_id = 'V' }; @@ -35,11 +37,11 @@ static const int chan_dup[CH_MAX] = { /* ----------------- pvt ------------------ */ static const int pvt_type[] = { - [CH_TASKID] = 10, - [CH_TYPE] = 11, - [CH_APPID] = 12, - [CH_SUBSYSTEM] = 13, - [CH_RANK] = 14, + [CH_TASKID] = PRV_NOSV_TASKID, + [CH_TYPE] = PRV_NOSV_TYPE, + [CH_APPID] = PRV_NOSV_APPID, + [CH_SUBSYSTEM] = PRV_NOSV_SUBSYSTEM, + [CH_RANK] = PRV_NOSV_RANK, }; static const char *pcf_prefix[CH_MAX] = { diff --git a/src/emu/ovni/setup.c b/src/emu/ovni/setup.c index 36a335c..3a2ade6 100644 --- a/src/emu/ovni/setup.c +++ b/src/emu/ovni/setup.c @@ -1,5 +1,7 @@ #include "ovni_priv.h" +#include "emu_prv.h" + static const char model_name[] = "ovni"; enum { model_id = 'O' }; @@ -24,7 +26,7 @@ static const int chan_stack[CH_MAX] = { 0 }; /* ----------------- pvt ------------------ */ static const int pvt_type[] = { - [CH_FLUSH] = 7, + [CH_FLUSH] = PRV_OVNI_FLUSH, }; static const char *pcf_prefix[CH_MAX] = { diff --git a/src/emu/thread.c b/src/emu/thread.c index 3b320fd..f85f141 100644 --- a/src/emu/thread.c +++ b/src/emu/thread.c @@ -3,6 +3,7 @@ #include "thread.h" +#include "emu_prv.h" #include "path.h" #include "bay.h" #include @@ -15,9 +16,9 @@ static const char *chan_name[] = { }; static const int chan_type[] = { - [TH_CHAN_CPU] = 6, - [TH_CHAN_TID] = 2, - [TH_CHAN_STATE] = 4, + [TH_CHAN_CPU] = PRV_THREAD_CPU, + [TH_CHAN_TID] = PRV_THREAD_TID, + [TH_CHAN_STATE] = PRV_THREAD_STATE, }; static const long prv_flags[] = {