From 86a3e0b8b30f22a29153948ad2657cf4e7da2bb2 Mon Sep 17 00:00:00 2001 From: Adrian-Ken Rueegsegger Date: Tue, 25 Oct 2016 19:18:24 +0200 Subject: [PATCH] hw_x86_64_muen: Add support for subject name to sinfo --- repos/base-hw/include/spec/x86_64/muen/sinfo.h | 9 +++++++++ repos/base-hw/src/lib/muen/musinfo.h | 1 + repos/base-hw/src/lib/muen/sinfo.cc | 18 ++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/repos/base-hw/include/spec/x86_64/muen/sinfo.h b/repos/base-hw/include/spec/x86_64/muen/sinfo.h index 64ec02972f..599c1e4879 100644 --- a/repos/base-hw/include/spec/x86_64/muen/sinfo.h +++ b/repos/base-hw/include/spec/x86_64/muen/sinfo.h @@ -86,6 +86,13 @@ class Genode::Sinfo */ bool check_magic(void); + /* + * Return subject name. + * + * The function returns NULL if the subject name cannot be retrieved. + */ + const char * const get_subject_name(void); + /* * Return information for a channel given by name. * @@ -173,6 +180,8 @@ class Genode::Sinfo private: subject_info_type * sinfo; + char subject_name[MAX_NAME_LENGTH + 1]; + bool subject_name_set = false; /* * Fill memregion struct with memory region info from resource given by diff --git a/repos/base-hw/src/lib/muen/musinfo.h b/repos/base-hw/src/lib/muen/musinfo.h index f0c4b761a4..43af498259 100644 --- a/repos/base-hw/src/lib/muen/musinfo.h +++ b/repos/base-hw/src/lib/muen/musinfo.h @@ -72,6 +72,7 @@ struct dev_info_type { struct subject_info_type { uint64_t magic; + struct name_type name; uint8_t resource_count; uint8_t memregion_count; uint8_t channel_info_count; diff --git a/repos/base-hw/src/lib/muen/sinfo.cc b/repos/base-hw/src/lib/muen/sinfo.cc index 95ad00301b..50dcaea229 100644 --- a/repos/base-hw/src/lib/muen/sinfo.cc +++ b/repos/base-hw/src/lib/muen/sinfo.cc @@ -121,6 +121,22 @@ bool Sinfo::check_magic(void) } +const char * const Sinfo::get_subject_name(void) +{ + if (!check_magic()) + return nullptr; + + if (!subject_name_set) + { + memset(subject_name, 0, MAX_NAME_LENGTH + 1); + memcpy(subject_name, &sinfo->name.data, sinfo->name.length); + subject_name_set = true; + } + + return subject_name; +} + + bool Sinfo::get_channel_info(const char * const name, struct Channel_info *channel) { @@ -252,6 +268,8 @@ void Sinfo::log_status() return; } + Genode::log("muen-sinfo: Subject name is '", + Sinfo::get_subject_name(), "'"); Genode::log("muen-sinfo: Subject information exports ", sinfo->memregion_count, " memory region(s)"); for_each_memregion(log_memregion, 0);