mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 00:24:51 +00:00
hw: split resume_local_thread from resume_thread
Kernel::resume_thread was restricted to core when the targeted thread was in another domain. Now there are two kernel calls, resume_local_thread and resume_thread, where the former is never restricted and is provided via public kernel/interface.h and the latter is always restricted to core and is provided via core-local kernel/core_interface.h. ref #1101
This commit is contained in:
parent
c72f91fefb
commit
02c16e7106
@ -36,7 +36,7 @@ namespace Kernel
|
||||
* Kernel names of the kernel calls
|
||||
*/
|
||||
constexpr Call_arg call_id_pause_current_thread() { return 0; }
|
||||
constexpr Call_arg call_id_resume_thread() { return 1; }
|
||||
constexpr Call_arg call_id_resume_local_thread() { return 1; }
|
||||
constexpr Call_arg call_id_yield_thread() { return 2; }
|
||||
constexpr Call_arg call_id_send_request_msg() { return 3; }
|
||||
constexpr Call_arg call_id_send_reply_msg() { return 4; }
|
||||
@ -95,15 +95,15 @@ namespace Kernel
|
||||
|
||||
|
||||
/**
|
||||
* Cancel blocking of a thread if possible
|
||||
* Cancel blocking of a thread of the current domain if possible
|
||||
*
|
||||
* \param thread_id kernel name of the targeted thread
|
||||
*
|
||||
* \return wether thread was in a cancelable blocking beforehand
|
||||
*/
|
||||
inline bool resume_thread(unsigned const thread_id)
|
||||
inline bool resume_local_thread(unsigned const thread_id)
|
||||
{
|
||||
return call(call_id_resume_thread(), thread_id);
|
||||
return call(call_id_resume_local_thread(), thread_id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ static inline void thread_switch_to(Genode::Thread_base * const t)
|
||||
static inline bool
|
||||
thread_check_stopped_and_restart(Genode::Thread_base * const t)
|
||||
{
|
||||
return Kernel::resume_thread(native_thread_id(t));
|
||||
return Kernel::resume_local_thread(native_thread_id(t));
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,20 +34,21 @@ namespace Kernel
|
||||
constexpr Call_arg call_id_new_thread() { return 12; }
|
||||
constexpr Call_arg call_id_bin_thread() { return 13; }
|
||||
constexpr Call_arg call_id_start_thread() { return 14; }
|
||||
constexpr Call_arg call_id_access_thread_regs() { return 15; }
|
||||
constexpr Call_arg call_id_route_thread_event() { return 16; }
|
||||
constexpr Call_arg call_id_update_pd() { return 17; }
|
||||
constexpr Call_arg call_id_update_region() { return 18; }
|
||||
constexpr Call_arg call_id_new_pd() { return 19; }
|
||||
constexpr Call_arg call_id_bin_pd() { return 20; }
|
||||
constexpr Call_arg call_id_new_signal_receiver() { return 21; }
|
||||
constexpr Call_arg call_id_new_signal_context() { return 22; }
|
||||
constexpr Call_arg call_id_bin_signal_context() { return 23; }
|
||||
constexpr Call_arg call_id_bin_signal_receiver() { return 24; }
|
||||
constexpr Call_arg call_id_new_vm() { return 25; }
|
||||
constexpr Call_arg call_id_run_vm() { return 26; }
|
||||
constexpr Call_arg call_id_pause_vm() { return 27; }
|
||||
constexpr Call_arg call_id_pause_thread() { return 28; }
|
||||
constexpr Call_arg call_id_resume_thread() { return 15; }
|
||||
constexpr Call_arg call_id_access_thread_regs() { return 16; }
|
||||
constexpr Call_arg call_id_route_thread_event() { return 17; }
|
||||
constexpr Call_arg call_id_update_pd() { return 18; }
|
||||
constexpr Call_arg call_id_update_region() { return 19; }
|
||||
constexpr Call_arg call_id_new_pd() { return 20; }
|
||||
constexpr Call_arg call_id_bin_pd() { return 21; }
|
||||
constexpr Call_arg call_id_new_signal_receiver() { return 22; }
|
||||
constexpr Call_arg call_id_new_signal_context() { return 23; }
|
||||
constexpr Call_arg call_id_bin_signal_context() { return 24; }
|
||||
constexpr Call_arg call_id_bin_signal_receiver() { return 25; }
|
||||
constexpr Call_arg call_id_new_vm() { return 26; }
|
||||
constexpr Call_arg call_id_run_vm() { return 27; }
|
||||
constexpr Call_arg call_id_pause_vm() { return 28; }
|
||||
constexpr Call_arg call_id_pause_thread() { return 29; }
|
||||
|
||||
/**
|
||||
* Create a domain
|
||||
@ -163,6 +164,19 @@ namespace Kernel
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cancel blocking of a thread if possible
|
||||
*
|
||||
* \param thread_id kernel name of the targeted thread
|
||||
*
|
||||
* \return wether thread was in a cancelable blocking beforehand
|
||||
*/
|
||||
inline bool resume_thread(unsigned const thread_id)
|
||||
{
|
||||
return call(call_id_resume_thread(), thread_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set or unset the handler of an event that can be triggered by a thread
|
||||
*
|
||||
|
@ -407,6 +407,12 @@ void Thread::_call_pause_thread()
|
||||
|
||||
void Thread::_call_resume_thread()
|
||||
{
|
||||
/* check permissions */
|
||||
if (!_core()) {
|
||||
PWRN("not entitled to resume thread");
|
||||
_stop();
|
||||
return;
|
||||
}
|
||||
/* lookup thread */
|
||||
Thread * const thread = Thread::pool()->object(user_arg_1());
|
||||
if (!thread) {
|
||||
@ -414,10 +420,18 @@ void Thread::_call_resume_thread()
|
||||
user_arg_0(false);
|
||||
return;
|
||||
}
|
||||
/* check permissions */
|
||||
if (!_core() && pd_id() != thread->pd_id()) {
|
||||
PWRN("not entitled to resume thread");
|
||||
_stop();
|
||||
/* resume thread */
|
||||
user_arg_0(thread->_resume());
|
||||
}
|
||||
|
||||
|
||||
void Thread::_call_resume_local_thread()
|
||||
{
|
||||
/* lookup thread */
|
||||
Thread * const thread = Thread::pool()->object(user_arg_1());
|
||||
if (!thread || pd_id() != thread->pd_id()) {
|
||||
PWRN("failed to lookup thread");
|
||||
user_arg_0(0);
|
||||
return;
|
||||
}
|
||||
/* resume thread */
|
||||
@ -972,6 +986,7 @@ void Thread::_call(unsigned const processor_id)
|
||||
case call_id_pause_current_thread(): _call_pause_current_thread(); return;
|
||||
case call_id_pause_thread(): _call_pause_thread(); return;
|
||||
case call_id_resume_thread(): _call_resume_thread(); return;
|
||||
case call_id_resume_local_thread(): _call_resume_local_thread(); return;
|
||||
case call_id_yield_thread(): _call_yield_thread(); return;
|
||||
case call_id_send_request_msg(): _call_send_request_msg(); return;
|
||||
case call_id_send_reply_msg(): _call_send_reply_msg(); return;
|
||||
|
@ -237,6 +237,7 @@ class Kernel::Thread
|
||||
void _call_pause_current_thread();
|
||||
void _call_pause_thread();
|
||||
void _call_resume_thread();
|
||||
void _call_resume_local_thread();
|
||||
void _call_yield_thread();
|
||||
void _call_await_request_msg();
|
||||
void _call_send_request_msg();
|
||||
|
Loading…
x
Reference in New Issue
Block a user