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 599c1e487..6815966fa 100644 --- a/repos/base-hw/include/spec/x86_64/muen/sinfo.h +++ b/repos/base-hw/include/spec/x86_64/muen/sinfo.h @@ -20,6 +20,7 @@ #include struct subject_info_type; +struct scheduling_info_type; namespace Genode { @@ -180,6 +181,7 @@ class Genode::Sinfo private: subject_info_type * sinfo; + scheduling_info_type * sched_info; char subject_name[MAX_NAME_LENGTH + 1]; bool subject_name_set = false; diff --git a/repos/base-hw/src/lib/muen/muschedinfo.h b/repos/base-hw/src/lib/muen/muschedinfo.h new file mode 100644 index 000000000..8824788f4 --- /dev/null +++ b/repos/base-hw/src/lib/muen/muschedinfo.h @@ -0,0 +1,24 @@ +/* + * \brief Muen scheduling group info + * \author Adrian-Ken Rueegsegger + * \date 2016-12-06 + */ + +/* + * Copyright (C) 2016 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _BASE__MUEN__MUSCHEDINFO_H_ +#define _BASE__MUEN__MUSCHEDINFO_H_ + +#include + +struct scheduling_info_type { + uint64_t tsc_schedule_start; + uint64_t tsc_schedule_end; +} __attribute__((packed, aligned (8))); + +#endif /* _BASE__MUEN_MUSCHEDINFO_H_ */ diff --git a/repos/base-hw/src/lib/muen/musinfo.h b/repos/base-hw/src/lib/muen/musinfo.h index 43af49825..558a7b3de 100644 --- a/repos/base-hw/src/lib/muen/musinfo.h +++ b/repos/base-hw/src/lib/muen/musinfo.h @@ -79,8 +79,6 @@ struct subject_info_type { uint8_t dev_info_count; char padding[4]; uint64_t tsc_khz; - uint64_t tsc_schedule_start; - uint64_t tsc_schedule_end; struct resource_type resources[MAX_RESOURCE_COUNT]; struct memregion_type memregions[MAX_RESOURCE_COUNT]; struct channel_info_type channels_info[MAX_RESOURCE_COUNT]; diff --git a/repos/base-hw/src/lib/muen/sinfo.cc b/repos/base-hw/src/lib/muen/sinfo.cc index 50dcaea22..5887195a8 100644 --- a/repos/base-hw/src/lib/muen/sinfo.cc +++ b/repos/base-hw/src/lib/muen/sinfo.cc @@ -18,6 +18,13 @@ #include #include "musinfo.h" +#include "muschedinfo.h" + +#define roundup(x, y) ( \ +{ \ + const typeof(y) __y = y; \ + (((x) + (__y - 1)) / __y) * __y; \ +}) static_assert(sizeof(subject_info_type) <= Sinfo::SIZE, "Size of subject info type larger than Sinfo::SIZE."); @@ -106,7 +113,9 @@ static bool is_channel(const struct resource_type * const resource) Sinfo::Sinfo(const addr_t base_addr) { - sinfo = ((subject_info_type *)base_addr); + const uint64_t sinfo_page_size = roundup(sizeof(subject_info_type), 0x1000); + sinfo = ((subject_info_type *)base_addr); + sched_info = ((scheduling_info_type *)(base_addr + sinfo_page_size)); if (!check_magic()) { Genode::error("muen-sinfo: Subject information MAGIC mismatch"); @@ -244,7 +253,7 @@ uint64_t Sinfo::get_sched_start(void) if (!check_magic()) return 0; - return sinfo->tsc_schedule_start; + return sched_info->tsc_schedule_start; } @@ -253,7 +262,7 @@ uint64_t Sinfo::get_sched_end(void) if (!check_magic()) return 0; - return sinfo->tsc_schedule_end; + return sched_info->tsc_schedule_end; }