Skip to content

Commit e4f2006

Browse files
committed
parisc: Reduce sigreturn trampoline to 3 instructions
We can move the INSN_LDI_R20 instruction into the branch delay slot. Signed-off-by: Helge Deller <[email protected]>
1 parent 3e4a1af commit e4f2006

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

arch/parisc/include/asm/rt_sigframe.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#ifndef _ASM_PARISC_RT_SIGFRAME_H
33
#define _ASM_PARISC_RT_SIGFRAME_H
44

5-
#define SIGRETURN_TRAMP 4
5+
#define SIGRETURN_TRAMP 3
66
#define SIGRESTARTBLOCK_TRAMP 5
77
#define TRAMP_SIZE (SIGRETURN_TRAMP + SIGRESTARTBLOCK_TRAMP)
88

arch/parisc/kernel/signal.c

+6-7
Original file line numberDiff line numberDiff line change
@@ -288,22 +288,21 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs,
288288
already in userspace. The first words of tramp are used to
289289
save the previous sigrestartblock trampoline that might be
290290
on the stack. We start the sigreturn trampoline at
291-
SIGRESTARTBLOCK_TRAMP+X. */
291+
SIGRESTARTBLOCK_TRAMP. */
292292
err |= __put_user(in_syscall ? INSN_LDI_R25_1 : INSN_LDI_R25_0,
293293
&frame->tramp[SIGRESTARTBLOCK_TRAMP+0]);
294-
err |= __put_user(INSN_LDI_R20,
295-
&frame->tramp[SIGRESTARTBLOCK_TRAMP+1]);
296294
err |= __put_user(INSN_BLE_SR2_R0,
295+
&frame->tramp[SIGRESTARTBLOCK_TRAMP+1]);
296+
err |= __put_user(INSN_LDI_R20,
297297
&frame->tramp[SIGRESTARTBLOCK_TRAMP+2]);
298-
err |= __put_user(INSN_NOP, &frame->tramp[SIGRESTARTBLOCK_TRAMP+3]);
299298

300-
start = (unsigned long) &frame->tramp[0];
301-
end = (unsigned long) &frame->tramp[TRAMP_SIZE];
299+
start = (unsigned long) &frame->tramp[SIGRESTARTBLOCK_TRAMP+0];
300+
end = (unsigned long) &frame->tramp[SIGRESTARTBLOCK_TRAMP+3];
302301
flush_user_dcache_range_asm(start, end);
303302
flush_user_icache_range_asm(start, end);
304303

305304
/* TRAMP Words 0-4, Length 5 = SIGRESTARTBLOCK_TRAMP
306-
* TRAMP Words 5-9, Length 4 = SIGRETURN_TRAMP
305+
* TRAMP Words 5-7, Length 3 = SIGRETURN_TRAMP
307306
* So the SIGRETURN_TRAMP is at the end of SIGRESTARTBLOCK_TRAMP
308307
*/
309308
rp = (unsigned long) &frame->tramp[SIGRESTARTBLOCK_TRAMP];

arch/parisc/kernel/signal32.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct compat_regfile {
3636
compat_int_t rf_sar;
3737
};
3838

39-
#define COMPAT_SIGRETURN_TRAMP 4
39+
#define COMPAT_SIGRETURN_TRAMP 3
4040
#define COMPAT_SIGRESTARTBLOCK_TRAMP 5
4141
#define COMPAT_TRAMP_SIZE (COMPAT_SIGRETURN_TRAMP + \
4242
COMPAT_SIGRESTARTBLOCK_TRAMP)

0 commit comments

Comments
 (0)