Skip to content

Commit

Permalink
[MIPS] signal: clean up sigframe structure
Browse files Browse the repository at this point in the history
This patch makes 'struct sigframe' declaration avalaible for all signals
code. It allows signal32 to not have its own declaration.

This patch also removes all ICACHE_REFILLS_WORKAROUND_WAR tests in
structure declaration and hopefully make them more readable.

Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Franck Bui-Huu authored and Ralf Baechle committed Feb 10, 2007
1 parent c3fc4ab commit c0b9bae
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 69 deletions.
26 changes: 26 additions & 0 deletions arch/mips/kernel/signal-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,32 @@
#ifndef __SIGNAL_COMMON_H
#define __SIGNAL_COMMON_H

/*
* Horribly complicated - with the bloody RM9000 workarounds enabled
* the signal trampolines is moving to the end of the structure so we can
* increase the alignment without breaking software compatibility.
*/
#if ICACHE_REFILLS_WORKAROUND_WAR == 0

struct sigframe {
u32 sf_ass[4]; /* argument save space for o32 */
u32 sf_code[2]; /* signal trampoline */
struct sigcontext sf_sc;
sigset_t sf_mask;
};

#else /* ICACHE_REFILLS_WORKAROUND_WAR */

struct sigframe {
u32 sf_ass[4]; /* argument save space for o32 */
u32 sf_pad[2];
struct sigcontext sf_sc; /* hw context */
sigset_t sf_mask;
u32 sf_code[8] ____cacheline_aligned; /* signal trampoline */
};

#endif /* !ICACHE_REFILLS_WORKAROUND_WAR */

/*
* handle hardware context
*/
Expand Down
56 changes: 21 additions & 35 deletions arch/mips/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,27 @@

#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))

#if ICACHE_REFILLS_WORKAROUND_WAR == 0

struct rt_sigframe {
u32 rs_ass[4]; /* argument save space for o32 */
u32 rs_code[2]; /* signal trampoline */
struct siginfo rs_info;
struct ucontext rs_uc;
};

#else

struct rt_sigframe {
u32 rs_ass[4]; /* argument save space for o32 */
u32 rs_pad[2];
struct siginfo rs_info;
struct ucontext rs_uc;
u32 rs_code[8] ____cacheline_aligned; /* signal trampoline */
};

#endif

/*
* Helper routines
*/
Expand Down Expand Up @@ -287,41 +308,6 @@ asmlinkage int sys_sigaltstack(nabi_no_regargs struct pt_regs regs)
return do_sigaltstack(uss, uoss, usp);
}

/*
* Horribly complicated - with the bloody RM9000 workarounds enabled
* the signal trampolines is moving to the end of the structure so we can
* increase the alignment without breaking software compatibility.
*/
#ifdef CONFIG_TRAD_SIGNALS
struct sigframe {
u32 sf_ass[4]; /* argument save space for o32 */
#if ICACHE_REFILLS_WORKAROUND_WAR
u32 sf_pad[2];
#else
u32 sf_code[2]; /* signal trampoline */
#endif
struct sigcontext sf_sc;
sigset_t sf_mask;
#if ICACHE_REFILLS_WORKAROUND_WAR
u32 sf_code[8] ____cacheline_aligned; /* signal trampoline */
#endif
};
#endif

struct rt_sigframe {
u32 rs_ass[4]; /* argument save space for o32 */
#if ICACHE_REFILLS_WORKAROUND_WAR
u32 rs_pad[2];
#else
u32 rs_code[2]; /* signal trampoline */
#endif
struct siginfo rs_info;
struct ucontext rs_uc;
#if ICACHE_REFILLS_WORKAROUND_WAR
u32 rs_code[8] ____cacheline_aligned; /* signal trampoline */
#endif
};

#ifdef CONFIG_TRAD_SIGNALS
save_static_function(sys_sigreturn);
__attribute_used__ noinline static void
Expand Down
49 changes: 21 additions & 28 deletions arch/mips/kernel/signal32.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,27 @@ struct ucontext32 {
sigset_t32 uc_sigmask; /* mask last for extensibility */
};

#if ICACHE_REFILLS_WORKAROUND_WAR == 0

struct rt_sigframe32 {
u32 rs_ass[4]; /* argument save space for o32 */
u32 rs_code[2]; /* signal trampoline */
compat_siginfo_t rs_info;
struct ucontext32 rs_uc;
};

#else /* ICACHE_REFILLS_WORKAROUND_WAR */

struct rt_sigframe32 {
u32 rs_ass[4]; /* argument save space for o32 */
u32 rs_pad[2];
compat_siginfo_t rs_info;
struct ucontext32 rs_uc;
u32 rs_code[8] __attribute__((aligned(32))); /* signal trampoline */
};

#endif /* !ICACHE_REFILLS_WORKAROUND_WAR */

extern void __put_sigset_unknown_nsig(void);
extern void __get_sigset_unknown_nsig(void);

Expand Down Expand Up @@ -383,34 +404,6 @@ static int restore_sigcontext32(struct pt_regs *regs, struct sigcontext32 __user
return err;
}

struct sigframe {
u32 sf_ass[4]; /* argument save space for o32 */
#if ICACHE_REFILLS_WORKAROUND_WAR
u32 sf_pad[2];
#else
u32 sf_code[2]; /* signal trampoline */
#endif
struct sigcontext32 sf_sc;
sigset_t sf_mask;
#if ICACHE_REFILLS_WORKAROUND_WAR
u32 sf_code[8] ____cacheline_aligned; /* signal trampoline */
#endif
};

struct rt_sigframe32 {
u32 rs_ass[4]; /* argument save space for o32 */
#if ICACHE_REFILLS_WORKAROUND_WAR
u32 rs_pad[2];
#else
u32 rs_code[2]; /* signal trampoline */
#endif
compat_siginfo_t rs_info;
struct ucontext32 rs_uc;
#if ICACHE_REFILLS_WORKAROUND_WAR
u32 rs_code[8] __attribute__((aligned(32))); /* signal trampoline */
#endif
};

int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
{
int err;
Expand Down
19 changes: 13 additions & 6 deletions arch/mips/kernel/signal_n32.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,27 @@ struct ucontextn32 {
sigset_t uc_sigmask; /* mask last for extensibility */
};

#if ICACHE_REFILLS_WORKAROUND_WAR == 0

struct rt_sigframe_n32 {
u32 rs_ass[4]; /* argument save space for o32 */
#if ICACHE_REFILLS_WORKAROUND_WAR
u32 rs_pad[2];
#else
u32 rs_code[2]; /* signal trampoline */
#endif
struct siginfo rs_info;
struct ucontextn32 rs_uc;
#if ICACHE_REFILLS_WORKAROUND_WAR
};

#else /* ICACHE_REFILLS_WORKAROUND_WAR */

struct rt_sigframe_n32 {
u32 rs_ass[4]; /* argument save space for o32 */
u32 rs_pad[2];
struct siginfo rs_info;
struct ucontextn32 rs_uc;
u32 rs_code[8] ____cacheline_aligned; /* signal trampoline */
#endif
};

#endif /* !ICACHE_REFILLS_WORKAROUND_WAR */

extern void sigset_from_compat (sigset_t *set, compat_sigset_t *compat);

save_static_function(sysn32_rt_sigsuspend);
Expand Down

0 comments on commit c0b9bae

Please sign in to comment.