Skip to content

Commit ca46ebf

Browse files
committed
openrisc: Add support for restartable sequences
Implement support for restartable sequences on OpenRISC by doing: - Select HAVE_RSEQ in Kconfig - Call rseq_syscall() on return to userspace when CONFIG_DEBUG_RSEQ is enabled. - Call rseq_signal_deliver() to fixup the pre-signal stack frame when a signal is delivered on top of a restartable sequence critical section Cc: Michael Jeanson <[email protected]> Signed-off-by: Stafford Horne <[email protected]>
1 parent 7ce8716 commit ca46ebf

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

arch/openrisc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ config OPENRISC
2828
select HAVE_UID16
2929
select HAVE_PAGE_SIZE_8KB
3030
select HAVE_REGS_AND_STACK_ACCESS_API
31+
select HAVE_RSEQ
3132
select GENERIC_ATOMIC64
3233
select GENERIC_CLOCKEVENTS_BROADCAST
3334
select GENERIC_SMP_IDLE_THREAD

arch/openrisc/kernel/entry.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,10 @@ _syscall_check_trace_leave:
714714
* interrupts that set NEED_RESCHED or SIGNALPENDING... really true? */
715715

716716
_syscall_check_work:
717+
#ifdef CONFIG_DEBUG_RSEQ
718+
l.jal rseq_syscall
719+
l.ori r3,r1,0
720+
#endif
717721
/* Here we need to disable interrupts */
718722
DISABLE_INTERRUPTS(r27,r29)
719723
TRACE_IRQS_OFF

arch/openrisc/kernel/signal.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
244244
{
245245
int ret;
246246

247+
rseq_signal_deliver(ksig, regs);
248+
247249
ret = setup_rt_frame(ksig, sigmask_to_save(), regs);
248250

249251
signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP));

0 commit comments

Comments
 (0)