hw_x86_64_muen: Add support for subject name to sinfo

This commit is contained in:
Adrian-Ken Rueegsegger 2016-10-25 19:18:24 +02:00 committed by Christian Helmuth
parent 712213af24
commit 86a3e0b8b3
3 changed files with 28 additions and 0 deletions

View File

@ -86,6 +86,13 @@ class Genode::Sinfo
*/ */
bool check_magic(void); 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. * Return information for a channel given by name.
* *
@ -173,6 +180,8 @@ class Genode::Sinfo
private: private:
subject_info_type * sinfo; 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 * Fill memregion struct with memory region info from resource given by

View File

@ -72,6 +72,7 @@ struct dev_info_type {
struct subject_info_type { struct subject_info_type {
uint64_t magic; uint64_t magic;
struct name_type name;
uint8_t resource_count; uint8_t resource_count;
uint8_t memregion_count; uint8_t memregion_count;
uint8_t channel_info_count; uint8_t channel_info_count;

View File

@ -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, bool Sinfo::get_channel_info(const char * const name,
struct Channel_info *channel) struct Channel_info *channel)
{ {
@ -252,6 +268,8 @@ void Sinfo::log_status()
return; return;
} }
Genode::log("muen-sinfo: Subject name is '",
Sinfo::get_subject_name(), "'");
Genode::log("muen-sinfo: Subject information exports ", Genode::log("muen-sinfo: Subject information exports ",
sinfo->memregion_count, " memory region(s)"); sinfo->memregion_count, " memory region(s)");
for_each_memregion(log_memregion, 0); for_each_memregion(log_memregion, 0);