mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 15:18:20 +00:00
core: Introduce default CPU exception handler
The CPU session interfaces comes with the ability to install an exception handler per thread. This patch enhances the feature with the provision of a default signal handler that is used if no thread-specific handler is installed. The default signal handler can be set by specifying an invalid thread capability and a valid signal context capability. Furthermore, this patch relaxes the requirement of the order of the calls of 'exception_handler' and 'set_pager'. Originally, the exception handler could be installed not before setting a pager. Now, we remember the installed exception handler in the 'Cpu_thread' and propagate to to the platform thread at a later time.
This commit is contained in:
@ -47,15 +47,19 @@ namespace Genode {
|
||||
{
|
||||
private:
|
||||
|
||||
Platform_thread _platform_thread;
|
||||
|
||||
bool _bound; /* pd binding flag */
|
||||
Platform_thread _platform_thread;
|
||||
bool _bound; /* pd binding flag */
|
||||
Signal_context_capability _sigh; /* exception handler */
|
||||
|
||||
public:
|
||||
|
||||
Cpu_thread_component(const char *name, unsigned priority,
|
||||
addr_t utcb)
|
||||
: _platform_thread(name, priority, utcb), _bound(false) { }
|
||||
Cpu_thread_component(const char *name, unsigned priority, addr_t utcb,
|
||||
Signal_context_capability sigh)
|
||||
:
|
||||
_platform_thread(name, priority, utcb), _bound(false), _sigh(sigh)
|
||||
{
|
||||
update_exception_sigh();
|
||||
}
|
||||
|
||||
|
||||
/************************
|
||||
@ -65,6 +69,17 @@ namespace Genode {
|
||||
inline Platform_thread * platform_thread() { return &_platform_thread; }
|
||||
inline bool bound() const { return _bound; }
|
||||
inline void bound(bool b) { _bound = b; }
|
||||
|
||||
void sigh(Signal_context_capability sigh)
|
||||
{
|
||||
sigh = sigh;
|
||||
update_exception_sigh();
|
||||
}
|
||||
|
||||
/**
|
||||
* Propagate exception handler to platform thread
|
||||
*/
|
||||
void update_exception_sigh();
|
||||
};
|
||||
|
||||
|
||||
@ -83,6 +98,12 @@ namespace Genode {
|
||||
created with this
|
||||
session */
|
||||
|
||||
/**
|
||||
* Exception handler that will be invoked unless overridden by a
|
||||
* call of 'Cpu_session::exception_handler'.
|
||||
*/
|
||||
Signal_context_capability _default_exception_handler;
|
||||
|
||||
/**
|
||||
* Lookup thread in CPU session by its capability
|
||||
*
|
||||
@ -127,11 +148,9 @@ namespace Genode {
|
||||
** CPU session interface **
|
||||
***************************/
|
||||
|
||||
Thread_capability create_thread(Name const &, addr_t utcb);
|
||||
Thread_capability create_thread(Name const &, addr_t);
|
||||
Ram_dataspace_capability utcb(Thread_capability thread);
|
||||
void kill_thread(Thread_capability);
|
||||
Thread_capability first();
|
||||
Thread_capability next(Thread_capability);
|
||||
int set_pager(Thread_capability, Pager_capability);
|
||||
int start(Thread_capability, addr_t, addr_t);
|
||||
void pause(Thread_capability thread_cap);
|
||||
|
Reference in New Issue
Block a user