Commit 3d51a29c authored by Jan Kiszka's avatar Jan Kiszka
Browse files

cobalt: Move common user-return code out of pipeline diversion again



Same pattern as for previous changes: All that code it common, no need
to duplicate it. The only difference was that I-pipe needs to call
ipipe_disable_user_intret_notifier first while dovetail does this
disabling automatically.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 748ed827
......@@ -102,36 +102,9 @@ static inline int handle_taskexit_event(struct task_struct *p)
return cobalt_handle_taskexit_event(p);
}
static int handle_user_return(struct task_struct *task)
static inline int handle_user_return(struct task_struct *task)
{
struct xnthread *thread;
spl_t s;
int err;
thread = xnthread_from_task(task);
if (thread == NULL)
return KEVENT_PROPAGATE;
if (xnthread_test_info(thread, XNCONTHI)) {
xnlock_get_irqsave(&nklock, s);
xnthread_clear_info(thread, XNCONTHI);
xnlock_put_irqrestore(&nklock, s);
err = xnthread_harden();
/*
* XNCONTHI may or may not have been re-applied if
* harden bailed out due to pending signals. Make sure
* it is set in that case.
*/
if (err == -ERESTARTSYS) {
xnlock_get_irqsave(&nklock, s);
xnthread_set_info(thread, XNCONTHI);
xnlock_put_irqrestore(&nklock, s);
}
}
return KEVENT_PROPAGATE;
return cobalt_handle_user_return(task);
}
void handle_oob_mayday(struct pt_regs *regs)
......
......@@ -401,38 +401,10 @@ static inline int handle_clockfreq_event(unsigned int *p)
return KEVENT_PROPAGATE;
}
static int handle_user_return(struct task_struct *task)
static inline int handle_user_return(struct task_struct *task)
{
struct xnthread *thread;
spl_t s;
int err;
ipipe_disable_user_intret_notifier();
thread = xnthread_from_task(task);
if (thread == NULL)
return KEVENT_PROPAGATE;
if (xnthread_test_info(thread, XNCONTHI)) {
xnlock_get_irqsave(&nklock, s);
xnthread_clear_info(thread, XNCONTHI);
xnlock_put_irqrestore(&nklock, s);
err = xnthread_harden();
/*
* XNCONTHI may or may not have been re-applied if
* harden bailed out due to pending signals. Make sure
* it is set in that case.
*/
if (err == -ERESTARTSYS) {
xnlock_get_irqsave(&nklock, s);
xnthread_set_info(thread, XNCONTHI);
xnlock_put_irqrestore(&nklock, s);
}
}
return KEVENT_PROPAGATE;
return cobalt_handle_user_return(task);
}
int handle_ptrace_resume(struct ipipe_ptrace_resume_data *resume)
......
......@@ -870,6 +870,38 @@ static void __handle_taskexit_event(struct task_struct *p)
}
}
int cobalt_handle_user_return(struct task_struct *task)
{
struct xnthread *thread;
spl_t s;
int err;
thread = xnthread_from_task(task);
if (thread == NULL)
return KEVENT_PROPAGATE;
if (xnthread_test_info(thread, XNCONTHI)) {
xnlock_get_irqsave(&nklock, s);
xnthread_clear_info(thread, XNCONTHI);
xnlock_put_irqrestore(&nklock, s);
err = xnthread_harden();
/*
* XNCONTHI may or may not have been re-applied if
* harden bailed out due to pending signals. Make sure
* it is set in that case.
*/
if (err == -ERESTARTSYS) {
xnlock_get_irqsave(&nklock, s);
xnthread_set_info(thread, XNCONTHI);
xnlock_put_irqrestore(&nklock, s);
}
}
return KEVENT_PROPAGATE;
}
static void detach_current(void)
{
struct cobalt_threadinfo *p = pipeline_current();
......
......@@ -173,4 +173,6 @@ int cobalt_handle_taskexit_event(struct task_struct *task);
int cobalt_handle_cleanup_event(struct mm_struct *mm);
int cobalt_handle_user_return(struct task_struct *task);
#endif /* !_COBALT_POSIX_PROCESS_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment