mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-22 00:41:55 +00:00
hw: replace lock-safe log variants in kernel
As far as possible remove usage of warning/error/log in the kernel, otherwise the kernel context might try to take a lock hold by a core thread, which results in a syscall to block. Fix #3277
This commit is contained in:
committed by
Christian Helmuth
parent
9e238d624e
commit
0ca199f89a
@ -63,7 +63,7 @@ void Cpu_job::_interrupt(unsigned const /* cpu_id */)
|
|||||||
/* it needs to be a user interrupt */
|
/* it needs to be a user interrupt */
|
||||||
User_irq * irq = User_irq::object(irq_id);
|
User_irq * irq = User_irq::object(irq_id);
|
||||||
if (irq) irq->occurred();
|
if (irq) irq->occurred();
|
||||||
else Genode::warning("Unknown interrupt ", irq_id);
|
else Genode::raw("Unknown interrupt ", irq_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* end interrupt request at controller */
|
/* end interrupt request at controller */
|
||||||
|
@ -174,7 +174,7 @@ void Ipc_node::send_request(Ipc_node &callee, capid_t capid, bool help,
|
|||||||
unsigned rcv_caps)
|
unsigned rcv_caps)
|
||||||
{
|
{
|
||||||
if (_state != INACTIVE) {
|
if (_state != INACTIVE) {
|
||||||
Genode::error("IPC send request: bad state");
|
Genode::raw("IPC send request: bad state");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Genode::Allocator &slab = pd().platform_pd().capability_slab();
|
Genode::Allocator &slab = pd().platform_pd().capability_slab();
|
||||||
@ -201,7 +201,7 @@ Ipc_node * Ipc_node::helping_sink() {
|
|||||||
bool Ipc_node::await_request(unsigned rcv_caps)
|
bool Ipc_node::await_request(unsigned rcv_caps)
|
||||||
{
|
{
|
||||||
if (_state != INACTIVE) {
|
if (_state != INACTIVE) {
|
||||||
Genode::error("IPC await request: bad state");
|
Genode::raw("IPC await request: bad state");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Genode::Allocator &slab = pd().platform_pd().capability_slab();
|
Genode::Allocator &slab = pd().platform_pd().capability_slab();
|
||||||
|
@ -276,7 +276,7 @@ void Thread::_call_restart_thread()
|
|||||||
Thread &thread = *thread_ptr;
|
Thread &thread = *thread_ptr;
|
||||||
|
|
||||||
if (!_core && (&pd() != &thread.pd())) {
|
if (!_core && (&pd() != &thread.pd())) {
|
||||||
warning(*this, ": failed to lookup thread ", (unsigned)user_arg_1(),
|
raw(*this, ": failed to lookup thread ", (unsigned)user_arg_1(),
|
||||||
" to restart it");
|
" to restart it");
|
||||||
_die();
|
_die();
|
||||||
return;
|
return;
|
||||||
@ -320,10 +320,10 @@ void Thread::_cancel_blocking()
|
|||||||
case ACTIVE:
|
case ACTIVE:
|
||||||
return;
|
return;
|
||||||
case DEAD:
|
case DEAD:
|
||||||
Genode::error("can't cancel blocking of dead thread");
|
Genode::raw("can't cancel blocking of dead thread");
|
||||||
return;
|
return;
|
||||||
case AWAITS_START:
|
case AWAITS_START:
|
||||||
Genode::error("can't cancel blocking of not yet started thread");
|
Genode::raw("can't cancel blocking of not yet started thread");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -394,7 +394,7 @@ void Thread::timeout_triggered()
|
|||||||
Signal_context * const c =
|
Signal_context * const c =
|
||||||
pd().cap_tree().find<Signal_context>(_timeout_sigid);
|
pd().cap_tree().find<Signal_context>(_timeout_sigid);
|
||||||
if (!c || c->submit(1))
|
if (!c || c->submit(1))
|
||||||
Genode::warning(*this, ": failed to submit timeout signal");
|
Genode::raw(*this, ": failed to submit timeout signal");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -403,7 +403,7 @@ void Thread::_call_send_request_msg()
|
|||||||
Object_identity_reference * oir = pd().cap_tree().find(user_arg_1());
|
Object_identity_reference * oir = pd().cap_tree().find(user_arg_1());
|
||||||
Thread * const dst = (oir) ? oir->object<Thread>() : nullptr;
|
Thread * const dst = (oir) ? oir->object<Thread>() : nullptr;
|
||||||
if (!dst) {
|
if (!dst) {
|
||||||
Genode::warning(*this, ": cannot send to unknown recipient ",
|
Genode::raw(*this, ": cannot send to unknown recipient ",
|
||||||
(unsigned)user_arg_1());
|
(unsigned)user_arg_1());
|
||||||
_become_inactive(AWAITS_IPC);
|
_become_inactive(AWAITS_IPC);
|
||||||
return;
|
return;
|
||||||
@ -449,14 +449,14 @@ void Thread::_call_await_signal()
|
|||||||
/* lookup receiver */
|
/* lookup receiver */
|
||||||
Signal_receiver * const r = pd().cap_tree().find<Signal_receiver>(user_arg_1());
|
Signal_receiver * const r = pd().cap_tree().find<Signal_receiver>(user_arg_1());
|
||||||
if (!r) {
|
if (!r) {
|
||||||
Genode::warning(*this, ": cannot await, unknown signal receiver ",
|
Genode::raw(*this, ": cannot await, unknown signal receiver ",
|
||||||
(unsigned)user_arg_1());
|
(unsigned)user_arg_1());
|
||||||
user_arg_0(-1);
|
user_arg_0(-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* register handler at the receiver */
|
/* register handler at the receiver */
|
||||||
if (r->add_handler(this)) {
|
if (r->add_handler(this)) {
|
||||||
Genode::warning("failed to register handler at signal receiver");
|
Genode::raw("failed to register handler at signal receiver");
|
||||||
user_arg_0(-1);
|
user_arg_0(-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -469,7 +469,7 @@ void Thread::_call_pending_signal()
|
|||||||
/* lookup receiver */
|
/* lookup receiver */
|
||||||
Signal_receiver * const r = pd().cap_tree().find<Signal_receiver>(user_arg_1());
|
Signal_receiver * const r = pd().cap_tree().find<Signal_receiver>(user_arg_1());
|
||||||
if (!r) {
|
if (!r) {
|
||||||
Genode::warning(*this, ": cannot await, unknown signal receiver ",
|
Genode::raw(*this, ": cannot await, unknown signal receiver ",
|
||||||
(unsigned)user_arg_1());
|
(unsigned)user_arg_1());
|
||||||
user_arg_0(-1);
|
user_arg_0(-1);
|
||||||
return;
|
return;
|
||||||
@ -496,7 +496,7 @@ void Thread::_call_cancel_next_await_signal()
|
|||||||
/* kill the caller if the capability of the target thread is invalid */
|
/* kill the caller if the capability of the target thread is invalid */
|
||||||
Thread * const thread = pd().cap_tree().find<Thread>(user_arg_1());
|
Thread * const thread = pd().cap_tree().find<Thread>(user_arg_1());
|
||||||
if (!thread || (&pd() != &thread->pd())) {
|
if (!thread || (&pd() != &thread->pd())) {
|
||||||
error(*this, ": failed to lookup thread ", (unsigned)user_arg_1());
|
raw(*this, ": failed to lookup thread ", (unsigned)user_arg_1());
|
||||||
_die();
|
_die();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -515,14 +515,14 @@ void Thread::_call_submit_signal()
|
|||||||
/* lookup signal context */
|
/* lookup signal context */
|
||||||
Signal_context * const c = pd().cap_tree().find<Signal_context>(user_arg_1());
|
Signal_context * const c = pd().cap_tree().find<Signal_context>(user_arg_1());
|
||||||
if(!c) {
|
if(!c) {
|
||||||
Genode::warning(*this, ": cannot submit unknown signal context");
|
Genode::raw(*this, ": cannot submit unknown signal context");
|
||||||
user_arg_0(-1);
|
user_arg_0(-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* trigger signal context */
|
/* trigger signal context */
|
||||||
if (c->submit(user_arg_2())) {
|
if (c->submit(user_arg_2())) {
|
||||||
Genode::warning("failed to submit signal context");
|
Genode::raw("failed to submit signal context");
|
||||||
user_arg_0(-1);
|
user_arg_0(-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -535,7 +535,7 @@ void Thread::_call_ack_signal()
|
|||||||
/* lookup signal context */
|
/* lookup signal context */
|
||||||
Signal_context * const c = pd().cap_tree().find<Signal_context>(user_arg_1());
|
Signal_context * const c = pd().cap_tree().find<Signal_context>(user_arg_1());
|
||||||
if (!c) {
|
if (!c) {
|
||||||
Genode::warning(*this, ": cannot ack unknown signal context");
|
Genode::raw(*this, ": cannot ack unknown signal context");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,14 +549,14 @@ void Thread::_call_kill_signal_context()
|
|||||||
/* lookup signal context */
|
/* lookup signal context */
|
||||||
Signal_context * const c = pd().cap_tree().find<Signal_context>(user_arg_1());
|
Signal_context * const c = pd().cap_tree().find<Signal_context>(user_arg_1());
|
||||||
if (!c) {
|
if (!c) {
|
||||||
Genode::warning(*this, ": cannot kill unknown signal context");
|
Genode::raw(*this, ": cannot kill unknown signal context");
|
||||||
user_arg_0(-1);
|
user_arg_0(-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* kill signal context */
|
/* kill signal context */
|
||||||
if (c->kill(this)) {
|
if (c->kill(this)) {
|
||||||
Genode::warning("failed to kill signal context");
|
Genode::raw("failed to kill signal context");
|
||||||
user_arg_0(-1);
|
user_arg_0(-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -567,7 +567,7 @@ void Thread::_call_new_irq()
|
|||||||
{
|
{
|
||||||
Signal_context * const c = pd().cap_tree().find<Signal_context>(user_arg_3());
|
Signal_context * const c = pd().cap_tree().find<Signal_context>(user_arg_3());
|
||||||
if (!c) {
|
if (!c) {
|
||||||
Genode::warning(*this, ": invalid signal context for interrupt");
|
Genode::raw(*this, ": invalid signal context for interrupt");
|
||||||
user_arg_0(-1);
|
user_arg_0(-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -589,7 +589,7 @@ void Thread::_call_new_obj()
|
|||||||
if (!thread ||
|
if (!thread ||
|
||||||
(static_cast<Core_object<Thread>*>(thread)->capid() != ref->capid())) {
|
(static_cast<Core_object<Thread>*>(thread)->capid() != ref->capid())) {
|
||||||
if (thread)
|
if (thread)
|
||||||
Genode::warning("faked thread", thread);
|
Genode::raw("faked thread", thread);
|
||||||
user_arg_0(cap_id_invalid());
|
user_arg_0(cap_id_invalid());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -670,7 +670,7 @@ void Thread::_call()
|
|||||||
default:
|
default:
|
||||||
/* check wether this is a core thread */
|
/* check wether this is a core thread */
|
||||||
if (!_core) {
|
if (!_core) {
|
||||||
Genode::warning(*this, ": not entitled to do kernel call");
|
Genode::raw(*this, ": not entitled to do kernel call");
|
||||||
_die();
|
_die();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -708,7 +708,7 @@ void Thread::_call()
|
|||||||
case call_id_new_obj(): _call_new_obj(); return;
|
case call_id_new_obj(): _call_new_obj(); return;
|
||||||
case call_id_delete_obj(): _call_delete_obj(); return;
|
case call_id_delete_obj(): _call_delete_obj(); return;
|
||||||
default:
|
default:
|
||||||
Genode::warning(*this, ": unknown kernel call");
|
Genode::raw(*this, ": unknown kernel call");
|
||||||
_die();
|
_die();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -723,12 +723,12 @@ void Thread::_mmu_exception()
|
|||||||
_fault.ip = regs->ip;
|
_fault.ip = regs->ip;
|
||||||
|
|
||||||
if (_fault.type == Thread_fault::UNKNOWN) {
|
if (_fault.type == Thread_fault::UNKNOWN) {
|
||||||
Genode::error(*this, " raised unhandled MMU fault ", _fault);
|
Genode::raw(*this, " raised unhandled MMU fault ", _fault);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_core)
|
if (_core)
|
||||||
Genode::error(*this, " raised a fault, which should never happen ",
|
Genode::raw(*this, " raised a fault, which should never happen ",
|
||||||
_fault);
|
_fault);
|
||||||
|
|
||||||
if (_pager) _pager->submit(1);
|
if (_pager) _pager->submit(1);
|
||||||
|
45
repos/base-hw/src/core/spec/arm/kernel/panic.cc
Normal file
45
repos/base-hw/src/core/spec/arm/kernel/panic.cc
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* \brief Kernel panic
|
||||||
|
* \author Stefan Kalkowski
|
||||||
|
* \date 2019-04-05
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <kernel/cpu.h>
|
||||||
|
#include <kernel/kernel.h>
|
||||||
|
|
||||||
|
|
||||||
|
void Kernel::panic(Genode::Cpu_state * state) {
|
||||||
|
|
||||||
|
Genode::raw("Kernel panic !!!");
|
||||||
|
Genode::raw("Last saved cpu context follows:");
|
||||||
|
Genode::raw("exc : ", state->cpu_exception);
|
||||||
|
Genode::raw("r0 : ", (void*)state->r0);
|
||||||
|
Genode::raw("r1 : ", (void*)state->r1);
|
||||||
|
Genode::raw("r2 : ", (void*)state->r2);
|
||||||
|
Genode::raw("r3 : ", (void*)state->r3);
|
||||||
|
Genode::raw("r4 : ", (void*)state->r4);
|
||||||
|
Genode::raw("r5 : ", (void*)state->r5);
|
||||||
|
Genode::raw("r6 : ", (void*)state->r6);
|
||||||
|
Genode::raw("r7 : ", (void*)state->r7);
|
||||||
|
Genode::raw("r8 : ", (void*)state->r8);
|
||||||
|
Genode::raw("r9 : ", (void*)state->r9);
|
||||||
|
Genode::raw("r10 : ", (void*)state->r10);
|
||||||
|
Genode::raw("r11 : ", (void*)state->r11);
|
||||||
|
Genode::raw("r12 : ", (void*)state->r12);
|
||||||
|
Genode::raw("lr : ", (void*)state->lr);
|
||||||
|
Genode::raw("sp : ", (void*)state->sp);
|
||||||
|
Genode::raw("ip : ", (void*)state->ip);
|
||||||
|
Genode::raw("cpsr : ", (void*)state->cpsr);
|
||||||
|
Genode::raw("dfar : ", Cpu::Dfar::read());
|
||||||
|
Genode::raw("dfsr : ", Cpu::Dfsr::read());
|
||||||
|
Genode::raw("ifar : ", Cpu::Ifar::read());
|
||||||
|
Genode::raw("ifsr : ", Cpu::Ifsr::read());
|
||||||
|
while (true) { ; }
|
||||||
|
}
|
@ -37,14 +37,14 @@ void Thread::exception(Cpu & cpu)
|
|||||||
_interrupt(cpu.id());
|
_interrupt(cpu.id());
|
||||||
return;
|
return;
|
||||||
case Cpu::Context::UNDEFINED_INSTRUCTION:
|
case Cpu::Context::UNDEFINED_INSTRUCTION:
|
||||||
Genode::warning(*this, ": undefined instruction at ip=",
|
Genode::raw(*this, ": undefined instruction at ip=",
|
||||||
Genode::Hex(regs->ip));
|
Genode::Hex(regs->ip));
|
||||||
_die();
|
_die();
|
||||||
return;
|
return;
|
||||||
case Cpu::Context::RESET:
|
case Cpu::Context::RESET:
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
Genode::warning(*this, ": triggered an unknown exception ",
|
Genode::raw(*this, ": triggered an unknown exception ",
|
||||||
regs->cpu_exception);
|
regs->cpu_exception);
|
||||||
_die();
|
_die();
|
||||||
return;
|
return;
|
||||||
|
@ -63,7 +63,7 @@ void Vm::proceed(Cpu & cpu)
|
|||||||
unsigned const irq = _state->irq_injection;
|
unsigned const irq = _state->irq_injection;
|
||||||
if (irq) {
|
if (irq) {
|
||||||
if (pic().secure(irq)) {
|
if (pic().secure(irq)) {
|
||||||
Genode::warning("Refuse to inject secure IRQ into VM");
|
Genode::raw("Refuse to inject secure IRQ into VM");
|
||||||
} else {
|
} else {
|
||||||
pic().trigger(irq);
|
pic().trigger(irq);
|
||||||
_state->irq_injection = 0;
|
_state->irq_injection = 0;
|
||||||
|
@ -70,7 +70,7 @@ struct Kernel::Vm_irq : Kernel::Irq
|
|||||||
Cpu_job & job = cpu_pool().executing_cpu().scheduled_job();
|
Cpu_job & job = cpu_pool().executing_cpu().scheduled_job();
|
||||||
Vm *vm = dynamic_cast<Vm*>(&job);
|
Vm *vm = dynamic_cast<Vm*>(&job);
|
||||||
if (!vm)
|
if (!vm)
|
||||||
Genode::error("VM timer interrupt while VM is not runnning!");
|
Genode::raw("VM timer interrupt while VM is not runnning!");
|
||||||
else
|
else
|
||||||
vm->inject_irq(_irq_nr);
|
vm->inject_irq(_irq_nr);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ void Thread::exception(Cpu & cpu)
|
|||||||
_mmu_exception();
|
_mmu_exception();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Genode::error(*this, ": unhandled exception ", regs->cpu_exception,
|
Genode::raw(*this, ": unhandled exception ", regs->cpu_exception,
|
||||||
" at ip=", (void*)regs->ip,
|
" at ip=", (void*)regs->ip,
|
||||||
" addr=", Genode::Hex(Genode::Cpu::Sbadaddr::read()));
|
" addr=", Genode::Hex(Genode::Cpu::Sbadaddr::read()));
|
||||||
_die();
|
_die();
|
||||||
|
@ -29,11 +29,11 @@ void Thread::exception(Cpu & cpu)
|
|||||||
return;
|
return;
|
||||||
case Cpu_state::NO_MATH_COPROC:
|
case Cpu_state::NO_MATH_COPROC:
|
||||||
if (_cpu->fpu().fault(*regs)) { return; }
|
if (_cpu->fpu().fault(*regs)) { return; }
|
||||||
Genode::warning(*this, ": FPU error");
|
Genode::raw(*this, ": FPU error");
|
||||||
_die();
|
_die();
|
||||||
return;
|
return;
|
||||||
case Cpu_state::UNDEFINED_INSTRUCTION:
|
case Cpu_state::UNDEFINED_INSTRUCTION:
|
||||||
Genode::warning(*this, ": undefined instruction at ip=", (void*)regs->ip);
|
Genode::raw(*this, ": undefined instruction at ip=", (void*)regs->ip);
|
||||||
_die();
|
_die();
|
||||||
return;
|
return;
|
||||||
case Cpu_state::SUPERVISOR_CALL:
|
case Cpu_state::SUPERVISOR_CALL:
|
||||||
@ -45,7 +45,7 @@ void Thread::exception(Cpu & cpu)
|
|||||||
_interrupt(cpu.id());
|
_interrupt(cpu.id());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Genode::warning(*this, ": triggered unknown exception ", regs->trapno,
|
Genode::raw(*this, ": triggered unknown exception ", regs->trapno,
|
||||||
" with error code ", regs->errcode, " at ip=", (void*)regs->ip, " sp=", (void*)regs->sp);
|
" with error code ", regs->errcode, " at ip=", (void*)regs->ip, " sp=", (void*)regs->sp);
|
||||||
|
|
||||||
_die();
|
_die();
|
||||||
|
@ -27,11 +27,11 @@ void Thread::exception(Cpu & cpu)
|
|||||||
return;
|
return;
|
||||||
case Cpu::Context::NO_MATH_COPROC:
|
case Cpu::Context::NO_MATH_COPROC:
|
||||||
if (_cpu->fpu().fault(*regs)) { return; }
|
if (_cpu->fpu().fault(*regs)) { return; }
|
||||||
Genode::warning(*this, ": FPU error");
|
Genode::raw(*this, ": FPU error");
|
||||||
_die();
|
_die();
|
||||||
return;
|
return;
|
||||||
case Cpu::Context::UNDEFINED_INSTRUCTION:
|
case Cpu::Context::UNDEFINED_INSTRUCTION:
|
||||||
Genode::warning(*this, ": undefined instruction at ip=", (void*)regs->ip);
|
Genode::raw(*this, ": undefined instruction at ip=", (void*)regs->ip);
|
||||||
_die();
|
_die();
|
||||||
return;
|
return;
|
||||||
case Cpu::Context::SUPERVISOR_CALL:
|
case Cpu::Context::SUPERVISOR_CALL:
|
||||||
@ -44,7 +44,7 @@ void Thread::exception(Cpu & cpu)
|
|||||||
_interrupt(cpu.id());
|
_interrupt(cpu.id());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Genode::warning(*this, ": triggered unknown exception ", regs->trapno,
|
Genode::raw(*this, ": triggered unknown exception ", regs->trapno,
|
||||||
" with error code ", regs->errcode, " at ip=", (void*)regs->ip);
|
" with error code ", regs->errcode, " at ip=", (void*)regs->ip);
|
||||||
_die();
|
_die();
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ void Kernel::Vm::exception(Cpu & cpu)
|
|||||||
_context->submit(1);
|
_context->submit(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Genode::warning("VM: triggered unknown exception ", _state->trapno,
|
Genode::raw("VM: triggered unknown exception ", _state->trapno,
|
||||||
" with error code ", _state->errcode);
|
" with error code ", _state->errcode);
|
||||||
|
|
||||||
ASSERT_NEVER_CALLED;
|
ASSERT_NEVER_CALLED;
|
||||||
|
@ -34,20 +34,20 @@ Timer_driver::Timer_driver(unsigned) : ticks_per_ms(sinfo()->get_tsc_khz()), sta
|
|||||||
const struct Sinfo::Resource_type *
|
const struct Sinfo::Resource_type *
|
||||||
region = sinfo()->get_resource("timed_event", Sinfo::RES_MEMORY);
|
region = sinfo()->get_resource("timed_event", Sinfo::RES_MEMORY);
|
||||||
if (!region) {
|
if (!region) {
|
||||||
error("muen-timer: Unable to retrieve timed event region");
|
raw("muen-timer: Unable to retrieve timed event region");
|
||||||
throw Invalid_region();
|
throw Invalid_region();
|
||||||
}
|
}
|
||||||
|
|
||||||
event_page = (Subject_timed_event *)
|
event_page = (Subject_timed_event *)
|
||||||
Platform::mmio_to_virt(region->data.mem.address);
|
Platform::mmio_to_virt(region->data.mem.address);
|
||||||
event_page->event_nr = Board::TIMER_EVENT_KERNEL;
|
event_page->event_nr = Board::TIMER_EVENT_KERNEL;
|
||||||
log("muen-timer: Page @", Hex(region->data.mem.address), ", "
|
raw("muen-timer: Page @", Hex(region->data.mem.address), ", "
|
||||||
"frequency ", ticks_per_ms, " kHz, "
|
"frequency ", ticks_per_ms, " kHz, "
|
||||||
"event ", (unsigned)event_page->event_nr);
|
"event ", (unsigned)event_page->event_nr);
|
||||||
|
|
||||||
region = sinfo()->get_resource("monitor_timed_event", Sinfo::RES_MEMORY);
|
region = sinfo()->get_resource("monitor_timed_event", Sinfo::RES_MEMORY);
|
||||||
if (region) {
|
if (region) {
|
||||||
log("muen-timer: Found guest timed event page @", Hex(region->data.mem.address),
|
raw("muen-timer: Found guest timed event page @", Hex(region->data.mem.address),
|
||||||
" -> enabling preemption");
|
" -> enabling preemption");
|
||||||
guest_event_page = (Subject_timed_event *)
|
guest_event_page = (Subject_timed_event *)
|
||||||
Platform::mmio_to_virt(region->data.mem.address);
|
Platform::mmio_to_virt(region->data.mem.address);
|
||||||
|
@ -67,7 +67,7 @@ Timer_driver::Timer_driver(unsigned)
|
|||||||
div && ticks_per_ms < TIMER_MIN_TICKS_PER_MS; div--)
|
div && ticks_per_ms < TIMER_MIN_TICKS_PER_MS; div--)
|
||||||
{
|
{
|
||||||
if (!div){
|
if (!div){
|
||||||
error("Failed to calibrate timer frequency");
|
raw("Failed to calibrate timer frequency");
|
||||||
throw Calibration_failed();
|
throw Calibration_failed();
|
||||||
}
|
}
|
||||||
write<Divide_configuration::Divide_value>(div);
|
write<Divide_configuration::Divide_value>(div);
|
||||||
|
@ -117,7 +117,7 @@ Sinfo::Sinfo(const addr_t base_addr)
|
|||||||
sched_info = ((Scheduling_info_type *)(base_addr + sinfo_page_size));
|
sched_info = ((Scheduling_info_type *)(base_addr + sinfo_page_size));
|
||||||
|
|
||||||
if (!check_magic()) {
|
if (!check_magic()) {
|
||||||
Genode::error("muen-sinfo: Subject information MAGIC mismatch");
|
Genode::warning("muen-sinfo: Subject information MAGIC mismatch");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user