Commit 5e996646 authored by Philippe Gerum's avatar Philippe Gerum
Browse files

evl/thread: align trap_entry/exit on new Dovetail rules



The trap_entry handler may expect hard irqs off on entry. It may
demote the current context to the in-band stage, may return with hard
irqs on.

The trap_exit handler only runs if trap_entry was called for the same
trap occurrence. It may expect hard irqs off on entry, may switch the
current context back to the oob stage. Must return with hard irqs
off. This departs from the previous implementation which allowed the
trap_exit handler to return with hard irqs on.
Signed-off-by: default avatarPhilippe Gerum <rpm@xenomai.org>
parent fef90a69
......@@ -1510,12 +1510,14 @@ static inline void note_trap(struct evl_thread *curr,
(void *)instruction_pointer(regs));
}
/* oob stalled. */
/* hard irqs off. */
void handle_oob_trap_entry(unsigned int trapnr, struct pt_regs *regs)
{
struct evl_thread *curr;
bool is_bp = false;
trace_evl_thread_fault(trapnr, regs);
curr = evl_current();
if (curr->local_info & T_INFAULT) {
note_trap(curr, trapnr, regs, "recursive fault");
......@@ -1526,8 +1528,6 @@ void handle_oob_trap_entry(unsigned int trapnr, struct pt_regs *regs)
curr->local_info |= T_INFAULT;
trace_evl_thread_fault(trapnr, regs);
if (current->ptrace & PT_PTRACED)
is_bp = evl_is_breakpoint(trapnr);
......@@ -1541,11 +1541,13 @@ void handle_oob_trap_entry(unsigned int trapnr, struct pt_regs *regs)
evl_switch_inband(is_bp ? EVL_HMDIAG_TRAP : EVL_HMDIAG_EXDEMOTE);
}
/* hard irqs on. */
/* hard irqs off */
void handle_oob_trap_exit(unsigned int trapnr, struct pt_regs *regs)
{
struct evl_thread *curr = evl_current();
hard_local_irq_enable();
curr->local_info &= ~T_INFAULT;
/*
......@@ -1561,6 +1563,8 @@ void handle_oob_trap_exit(unsigned int trapnr, struct pt_regs *regs)
evl_switch_oob();
note_trap(curr, trapnr, regs, "resuming out-of-band");
}
hard_local_irq_disable();
}
void handle_oob_mayday(struct pt_regs *regs)
......
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