Fix race condition in page fault notification

When a page fault cannot be resolved, the GDB monitor can get a hint about
which thread faulted by evaluating the thread state object returned by
'Cpu_session::state()'. Unfortunately, with the current implementation,
the signal which informs GDB monitor about the page fault is sent before
the thread state object of the faulted thread has been updated, so it
can happen that the faulted thread cannot be determined immediately
after receiving the signal.

With this commit, the thread state gets updated before the signal is sent.

At least on base-nova it can also happen that the thread state is not
accessible yet after receiving the page fault notification. For this
reason, GDB monitor needs to retry its query until the state is
accessible.

Fixes #1206.
This commit is contained in:
Christian Prochaska
2014-07-15 19:05:26 +02:00
committed by Norman Feske
parent 2a5fd44d7d
commit a46de84f89
9 changed files with 72 additions and 15 deletions

View File

@ -220,6 +220,15 @@ namespace Genode {
Thread_capability thread_cap() { return _thread_cap; } const
void thread_cap(Thread_capability cap) { _thread_cap = cap; }
/*
* Note in the thread state that an unresolved page
* fault occurred.
*/
void unresolved_page_fault_occurred()
{
_state.thread.unresolved_page_fault = true;
}
/**
* Make sure nobody is in the handler anymore by doing an IPC to a
* local cap pointing to same serving thread (if not running in the