mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-19 15:43:56 +00:00
hw_x86_64: use 'muen' SPEC to implement aspect
This commit is contained in:
committed by
Christian Helmuth
parent
750c4ad81d
commit
9f1beaa036
@ -68,7 +68,7 @@ class Genode::Timer
|
||||
_timer_page = (Subject_timer *)region.address;
|
||||
_timer_page->vector = Board::TIMER_VECTOR_KERNEL;
|
||||
PINF("muen-timer: page @0x%llx, frequency %llu kHz, vector %u",
|
||||
region.address, _tics_per_ms, _timer_page->vector);
|
||||
region.address, _tics_per_ms, _timer_page->vector);
|
||||
}
|
||||
|
||||
static unsigned interrupt_id(int)
|
||||
@ -90,7 +90,7 @@ class Genode::Timer
|
||||
{
|
||||
const uint64_t now = rdtsc();
|
||||
if (_timer_page->value != TIMER_DISABLED
|
||||
&& _timer_page->value > now) {
|
||||
&& _timer_page->value > now) {
|
||||
return _timer_page->value - now;
|
||||
}
|
||||
return 0;
|
@ -30,13 +30,14 @@ Cpu_idle::Cpu_idle(Cpu * const cpu) : Cpu_job(Cpu_priority::MIN, 0)
|
||||
|
||||
void Cpu_idle::exception(unsigned const cpu)
|
||||
{
|
||||
if (trapno == RESET) {
|
||||
return;
|
||||
} else if (trapno >= INTERRUPTS_START && trapno <= INTERRUPTS_END) {
|
||||
if (trapno == RESET) return;
|
||||
|
||||
if (trapno >= INTERRUPTS_START && trapno <= INTERRUPTS_END) {
|
||||
pic()->irq_occurred(trapno);
|
||||
_interrupt(cpu);
|
||||
return;
|
||||
}
|
||||
|
||||
PWRN("Unknown exception %lu with error code %lu at ip=%p", trapno,
|
||||
errcode, (void *)ip);
|
||||
assert(0);
|
@ -24,6 +24,7 @@ enum {
|
||||
static const subject_info_type *
|
||||
const sinfo = ((subject_info_type *)SINFO_BASE_ADDR);
|
||||
|
||||
|
||||
/* Log channel information */
|
||||
static bool log_channel(
|
||||
const struct Genode::Sinfo::Channel_info * const channel,
|
||||
@ -31,36 +32,37 @@ static bool log_channel(
|
||||
{
|
||||
if (channel->has_event || channel->has_vector) {
|
||||
PDBG("muen-sinfo: [%s with %s %03d] %s\n",
|
||||
channel->writable ? "writer" : "reader",
|
||||
channel->has_event ? "event " : "vector",
|
||||
channel->has_event ? channel->event_number : channel->vector,
|
||||
channel->name);
|
||||
channel->writable ? "writer" : "reader",
|
||||
channel->has_event ? "event " : "vector",
|
||||
channel->has_event ? channel->event_number : channel->vector,
|
||||
channel->name);
|
||||
} else {
|
||||
PDBG("muen-sinfo: [%s with no %s ] %s\n",
|
||||
channel->writable ? "writer" : "reader",
|
||||
channel->writable ? "event " : "vector",
|
||||
channel->name);
|
||||
channel->writable ? "writer" : "reader",
|
||||
channel->writable ? "event " : "vector",
|
||||
channel->name);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Log memory region information */
|
||||
static bool log_memregion(
|
||||
const struct Genode::Sinfo::Memregion_info * const region,
|
||||
void *data)
|
||||
{
|
||||
PDBG("muen-sinfo: [addr 0x%016llx size 0x%016llx %s%s] %s\n",
|
||||
region->address, region->size,
|
||||
region->writable ? "rw" : "ro",
|
||||
region->executable ? "x" : "-", region->name);
|
||||
region->address, region->size,
|
||||
region->writable ? "rw" : "ro",
|
||||
region->executable ? "x" : "-", region->name);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Fill channel struct with channel information from resource given by index */
|
||||
static void fill_channel_data(
|
||||
uint8_t idx,
|
||||
struct Genode::Sinfo::Channel_info *channel)
|
||||
static void fill_channel_data(uint8_t idx,
|
||||
struct Genode::Sinfo::Channel_info *channel)
|
||||
{
|
||||
const struct resource_type resource = sinfo->resources[idx];
|
||||
const struct memregion_type memregion =
|
||||
@ -81,10 +83,10 @@ static void fill_channel_data(
|
||||
channel->vector = channel_info.vector;
|
||||
}
|
||||
|
||||
|
||||
/* Fill memregion struct with memory region info from resource given by index */
|
||||
static void fill_memregion_data(
|
||||
uint8_t idx,
|
||||
struct Genode::Sinfo::Memregion_info *region)
|
||||
static void fill_memregion_data(uint8_t idx,
|
||||
struct Genode::Sinfo::Memregion_info *region)
|
||||
{
|
||||
const struct resource_type resource = sinfo->resources[idx];
|
||||
const struct memregion_type memregion =
|
||||
@ -99,18 +101,21 @@ static void fill_memregion_data(
|
||||
region->executable = memregion.flags & MEM_EXECUTABLE_FLAG;
|
||||
}
|
||||
|
||||
|
||||
/* Returns true if the given resource is a memory region */
|
||||
static bool is_memregion(const struct resource_type * const resource)
|
||||
{
|
||||
return resource->memregion_idx != NO_RESOURCE;
|
||||
}
|
||||
|
||||
|
||||
/* Returns true if the given resource is a channel */
|
||||
static bool is_channel(const struct resource_type * const resource)
|
||||
{
|
||||
return is_memregion(resource) && resource->channel_info_idx != NO_RESOURCE;
|
||||
}
|
||||
|
||||
|
||||
Sinfo::Sinfo()
|
||||
{
|
||||
if (!check_magic()) {
|
||||
@ -119,20 +124,22 @@ Sinfo::Sinfo()
|
||||
}
|
||||
|
||||
PINF("muen-sinfo: Subject information exports %d memory region(s)\n",
|
||||
sinfo->memregion_count);
|
||||
sinfo->memregion_count);
|
||||
for_each_memregion(log_memregion, 0);
|
||||
PINF("muen-sinfo: Subject information exports %d channel(s)\n",
|
||||
sinfo->channel_info_count);
|
||||
sinfo->channel_info_count);
|
||||
for_each_channel(log_channel, 0);
|
||||
}
|
||||
|
||||
|
||||
bool Sinfo::check_magic(void)
|
||||
{
|
||||
return sinfo != 0 && sinfo->magic == MUEN_SUBJECT_INFO_MAGIC;
|
||||
}
|
||||
|
||||
|
||||
bool Sinfo::get_channel_info(const char * const name,
|
||||
struct Channel_info *channel)
|
||||
struct Channel_info *channel)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -149,8 +156,9 @@ bool Sinfo::get_channel_info(const char * const name,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Sinfo::get_memregion_info(const char * const name,
|
||||
struct Memregion_info *memregion)
|
||||
struct Memregion_info *memregion)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -167,6 +175,7 @@ bool Sinfo::get_memregion_info(const char * const name,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Sinfo::for_each_channel(Channel_cb func, void *data)
|
||||
{
|
||||
int i;
|
||||
@ -185,6 +194,7 @@ bool Sinfo::for_each_channel(Channel_cb func, void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Sinfo::for_each_memregion(Memregion_cb func, void *data)
|
||||
{
|
||||
int i;
|
||||
@ -203,6 +213,7 @@ bool Sinfo::for_each_memregion(Memregion_cb func, void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
uint64_t Sinfo::get_tsc_khz(void)
|
||||
{
|
||||
if (!check_magic())
|
||||
@ -211,6 +222,7 @@ uint64_t Sinfo::get_tsc_khz(void)
|
||||
return sinfo->tsc_khz;
|
||||
}
|
||||
|
||||
|
||||
uint64_t Sinfo::get_sched_start(void)
|
||||
{
|
||||
if (!check_magic())
|
||||
@ -219,6 +231,7 @@ uint64_t Sinfo::get_sched_start(void)
|
||||
return sinfo->tsc_schedule_start;
|
||||
}
|
||||
|
||||
|
||||
uint64_t Sinfo::get_sched_end(void)
|
||||
{
|
||||
if (!check_magic())
|
Reference in New Issue
Block a user