Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: m-labs/linux-milkymist
base: e7f8b2eb45d1
...
head fork: m-labs/linux-milkymist
compare: 4b7205897744
  • 18 commits
  • 38 files changed
  • 0 commit comments
  • 2 contributors
Commits on Mar 03, 2013
Lars-Peter Clausen larsclausen lm32: signal: Use restore_altstack()
do_sigaltstack() will be gone in the next upstream release, restore_altstack()
is it's replacement.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
1a70d26
Lars-Peter Clausen larsclausen lm32: signal: Use flush_icache_range() instead of open-coding it.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
75f7d00
Lars-Peter Clausen larsclausen lm32: signal: Reset restart_block.fn in rt_sigreturn
This is required for proper operation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
ac2205b
Lars-Peter Clausen larsclausen lm32: signals: Add proper __user annotation for setup_sigcontext()
The sigcontext struct we are working with here is on the userspace stack.

Fixes the following sparse warnings:
	arch/lm32/kernel/signal.c:114:31: warning: incorrect type in argument 1 (different address spaces)
	arch/lm32/kernel/signal.c:114:31:    expected void [noderef] <asn:1>*to
	arch/lm32/kernel/signal.c:114:31:    got struct pt_regs *<noident>
	arch/lm32/kernel/signal.c:115:16: warning: incorrect type in initializer (different address spaces)
	arch/lm32/kernel/signal.c:115:16:    expected unsigned long [noderef] <asn:1>*__pu_addr
	arch/lm32/kernel/signal.c:115:16:    got unsigned long *<noident>
	arch/lm32/kernel/signal.c:148:34: warning: incorrect type in argument 1 (different address spaces)
	arch/lm32/kernel/signal.c:148:34:    expected struct sigcontext *sc
	arch/lm32/kernel/signal.c:148:34:    got struct sigcontext [noderef] <asn:1>*<noident>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
41b08fb
Al Viro consolidate declarations of k_sigaction
Only alpha and sparc are unusual - they have ka_restorer in it.
And nobody needs that exposed to userland.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
b687889
Al Viro consolidate kernel-side struct sigaction declarations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
ca15062
Al Viro new helper: get_signal()
On success get_signal_to_deliver() fills k_sigaction and siginfo.
_All_ users pass it addresses of the local variables sitting in
the same function.  Then they proceed to pass those addresses
pretty much in tandem to a bunch of helper functions; again, all
callers of those helpers are passing them such a pair, and one that
had been through get_signal_to_deliver() at that.

The obvious cleanup: introduce a new type that would contain a
<k_sigaction,siginfo> pair (struct ksignal) and begin switching to
using it.  Turns out that it's convenient to store the signal number
in the same object.

New helper, taking that sucker is a wrapper for get_signal_to_deliver();
takes struct ksignal * and returns bool.  On success fills ksignal
with the information for signal handler to be invoked.

For now it's a macro (to avoid header ordering headache), but eventually
it'll be a function in kernel/signal.c, with get_signal_to_deliver()
folded into it.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9894936
Al Viro new helper: signal_setup_done()
usual "call force_sigsegv or signal_delivered" logics.  Takes
ksignal instead of separate siginfo/k_sigaction.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
b6df4b0
Al Viro new helper: sigsp()
Normal logics for altstack handling in sigframe allocation

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
7a5070b
Lars-Peter Clausen larsclausen lm32: signal: switch to ksignal
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
17412b4
Lars-Peter Clausen larsclausen lm32: Rework signal handling
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
11b6d4c
Lars-Peter Clausen larsclausen lm32: entry.S: Use PT_Rxx instead of magic numbers
Use the PT_Rxx defines instead of magic number for accessing the pt_regs fields.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
9df0d4b
Lars-Peter Clausen larsclausen lm32: processor.h: More cleanups
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
abac1ab
Lars-Peter Clausen larsclausen lm32: Remove gpio.h
It is unused these days. There is a generic implementation of it now.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
7b96718
Lars-Peter Clausen larsclausen lm32: timex.h: Remove CLOCK_TICK_RATE
It's unused.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
0bfdb9b
Lars-Peter Clausen larsclausen lm32: prom.h: Remove #ifdef CONFIG_OF
CONFIG_OF is always defined for lm32.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
ec06e14
Lars-Peter Clausen larsclausen lm32: Remove r0 from pt_regs
We never use it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
a24553b
Lars-Peter Clausen larsclausen lm32: process.c: Include linux/pm.h
Fixes the following sparse warning:
	arch/lm32/kernel/process.c:53:6: warning: symbol 'pm_power_off' was not declared. Should it be static?

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
4b72058
Showing with 317 additions and 447 deletions.
  1. +1 −10 arch/alpha/include/asm/signal.h
  2. +1 −10 arch/arm/include/asm/signal.h
  3. +1 −10 arch/avr32/include/asm/signal.h
  4. +1 −9 arch/cris/include/asm/signal.h
  5. +1 −10 arch/h8300/include/asm/signal.h
  6. +0 −10 arch/ia64/include/asm/signal.h
  7. +0 −1  arch/ia64/include/asm/unistd.h
  8. +0 −16 arch/lm32/include/asm/gpio.h
  9. +6 −7 arch/lm32/include/asm/processor.h
  10. +0 −2  arch/lm32/include/asm/prom.h
  11. +1 −1  arch/lm32/include/asm/ptrace.h
  12. +2 −6 arch/lm32/include/asm/thread_info.h
  13. +0 −8 arch/lm32/include/asm/timex.h
  14. +34 −32 arch/lm32/kernel/asm-offsets.c
  15. +110 −87 arch/lm32/kernel/entry.S
  16. +1 −0  arch/lm32/kernel/process.c
  17. +67 −138 arch/lm32/kernel/signal.c
  18. +1 −10 arch/m32r/include/asm/signal.h
  19. +1 −9 arch/m68k/include/asm/signal.h
  20. +2 −0  arch/mips/include/asm/signal.h
  21. +2 −4 arch/mips/include/uapi/asm/signal.h
  22. +1 −9 arch/mn10300/include/asm/signal.h
  23. +2 −4 arch/parisc/include/asm/signal.h
  24. +1 −0  arch/powerpc/include/asm/signal.h
  25. +0 −1  arch/powerpc/include/asm/syscalls.h
  26. +2 −4 arch/powerpc/include/uapi/asm/signal.h
  27. +1 −11 arch/s390/include/asm/signal.h
  28. +2 −4 arch/sparc/include/asm/signal.h
  29. +2 −0  arch/sparc/include/uapi/asm/signal.h
  30. +1 −1  arch/sparc/kernel/systbls.h
  31. +3 −12 arch/x86/include/asm/signal.h
  32. +2 −6 arch/x86/include/uapi/asm/signal.h
  33. +1 −10 arch/xtensa/include/asm/signal.h
  34. +11 −0 include/linux/sched.h
  35. +40 −0 include/linux/signal.h
  36. +1 −1  include/linux/syscalls.h
  37. +6 −4 include/uapi/asm-generic/signal.h
  38. +9 −0 kernel/signal.c
11 arch/alpha/include/asm/signal.h
View
@@ -22,15 +22,6 @@ struct osf_sigaction {
int sa_flags;
};
-struct sigaction {
- __sighandler_t sa_handler;
- unsigned long sa_flags;
- sigset_t sa_mask; /* mask last for extensibility */
-};
-
-struct k_sigaction {
- struct sigaction sa;
- __sigrestore_t ka_restorer;
-};
+#define __ARCH_HAS_KA_RESTORER
#include <asm/sigcontext.h>
#endif
11 arch/arm/include/asm/signal.h
View
@@ -23,16 +23,7 @@ struct old_sigaction {
__sigrestore_t sa_restorer;
};
-struct sigaction {
- __sighandler_t sa_handler;
- unsigned long sa_flags;
- __sigrestore_t sa_restorer;
- sigset_t sa_mask; /* mask last for extensibility */
-};
-
-struct k_sigaction {
- struct sigaction sa;
-};
+#define __ARCH_HAS_SA_RESTORER
#include <asm/sigcontext.h>
#endif
11 arch/avr32/include/asm/signal.h
View
@@ -23,16 +23,7 @@ typedef struct {
unsigned long sig[_NSIG_WORDS];
} sigset_t;
-struct sigaction {
- __sighandler_t sa_handler;
- unsigned long sa_flags;
- __sigrestore_t sa_restorer;
- sigset_t sa_mask; /* mask last for extensibility */
-};
-
-struct k_sigaction {
- struct sigaction sa;
-};
+#define __ARCH_HAS_SA_RESTORER
#include <asm/sigcontext.h>
#undef __HAVE_ARCH_SIG_BITOPS
10 arch/cris/include/asm/signal.h
View
@@ -23,16 +23,8 @@ struct old_sigaction {
void (*sa_restorer)(void);
};
-struct sigaction {
- __sighandler_t sa_handler;
- unsigned long sa_flags;
- void (*sa_restorer)(void);
- sigset_t sa_mask; /* mask last for extensibility */
-};
+#define __ARCH_HAS_SA_RESTORER
-struct k_sigaction {
- struct sigaction sa;
-};
#include <asm/sigcontext.h>
#endif
11 arch/h8300/include/asm/signal.h
View
@@ -23,16 +23,7 @@ struct old_sigaction {
void (*sa_restorer)(void);
};
-struct sigaction {
- __sighandler_t sa_handler;
- unsigned long sa_flags;
- void (*sa_restorer)(void);
- sigset_t sa_mask; /* mask last for extensibility */
-};
-
-struct k_sigaction {
- struct sigaction sa;
-};
+#define __ARCH_HAS_SA_RESTORER
#include <asm/sigcontext.h>
#undef __HAVE_ARCH_SIG_BITOPS
10 arch/ia64/include/asm/signal.h
View
@@ -26,16 +26,6 @@ typedef struct {
unsigned long sig[_NSIG_WORDS];
} sigset_t;
-struct sigaction {
- __sighandler_t sa_handler;
- unsigned long sa_flags;
- sigset_t sa_mask; /* mask last for extensibility */
-};
-
-struct k_sigaction {
- struct sigaction sa;
-};
-
# include <asm/sigcontext.h>
# endif /* !__ASSEMBLY__ */
1  arch/ia64/include/asm/unistd.h
View
@@ -47,7 +47,6 @@ asmlinkage unsigned long sys_mmap2(
int prot, int flags,
int fd, long pgoff);
struct pt_regs;
-struct sigaction;
asmlinkage long sys_ia64_pipe(void);
asmlinkage long sys_rt_sigaction(int sig,
const struct sigaction __user *act,
16 arch/lm32/include/asm/gpio.h
View
@@ -1,16 +0,0 @@
-#ifndef __ASM_GPIO_H__
-#define __ASM_GPIO_H__
-
-#include <linux/errno.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep __gpio_cansleep
-#define gpio_to_irq __gpio_to_irq
-
-static inline int irq_to_gpio(unsigned irq) { return -EINVAL; }
-
-
-#include <asm-generic/gpio.h>
-
-#endif
13 arch/lm32/include/asm/processor.h
View
@@ -42,6 +42,8 @@
#include <asm/ptrace.h>
#include <asm/current.h>
+struct task_struct;
+
/*
* User space process size: 3.75GB. This is hardcoded into a few places,
* so don't change it unless you know what you are doing.
@@ -57,20 +59,17 @@
struct thread_struct {};
#define INIT_THREAD {}
-#define KSTK_TOS(tsk) ((unsigned long)task_stack_page(tsk) + THREAD_SIZE - 32)
-#define task_pt_regs(tsk) ((struct pt_regs *)KSTK_TOS(tsk) - 1)
-#define KSTK_EIP(tsk) 0
-#define KSTK_ESP(tsk) 0
+#define task_pt_regs(tsk) \
+ ((struct pt_regs *)(task_stack_page(tsk) + THREAD_SIZE) - 1)
+#define KSTK_EIP(tsk) (task_pt_regs(tsk)->ea)
+#define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp)
/*
* Do necessary setup to start up a newly executed thread.
*/
extern void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp);
-/* Forward declaration, a strange C thing */
-struct task_struct;
-
static inline void release_thread(struct task_struct *dead_task) { }
static inline void exit_thread(void) { }
2  arch/lm32/include/asm/prom.h
View
@@ -9,9 +9,7 @@
#ifndef __ASM_LM32_PROM_H
#define __ASM_LM32_PROM_H
-#ifdef CONFIG_OF
void device_tree_init(void);
-#endif /* CONFIG_OF */
#endif /* __ASM_LM32_PROM_H */
2  arch/lm32/include/asm/ptrace.h
View
@@ -32,7 +32,6 @@
typedef unsigned long lm32_reg_t;
struct pt_regs {
- lm32_reg_t r0;
lm32_reg_t r1;
lm32_reg_t r2;
lm32_reg_t r3;
@@ -65,6 +64,7 @@ struct pt_regs {
lm32_reg_t ea;
lm32_reg_t ba;
unsigned int pt_mode;
+ lm32_reg_t orig_r1;
};
#ifdef __KERNEL__
8 arch/lm32/include/asm/thread_info.h
View
@@ -109,23 +109,19 @@ static inline struct thread_info *current_thread_info(void)
#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
#define TIF_SIGPENDING 1 /* signal pending */
#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
-#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
- TIF_NEED_RESCHED */
#define TIF_MEMDIE 4
#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
#define TIF_NOTIFY_RESUME 6 /* callback before returning to user */
-#define TIF_FREEZE 16 /* is freezing for suspend */
/* as above, but as bit values */
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
-#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
-#define _TIF_FREEZE (1<<TIF_FREEZE)
-#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
+#define _TIF_WORK_MASK \
+ (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED)
#endif /* __KERNEL__ */
8 arch/lm32/include/asm/timex.h
View
@@ -24,14 +24,6 @@
#ifndef _ASM_TIMEX_H
#define _ASM_TIMEX_H
-#ifdef __KERNEL__
-
-/* cannot use value supplied by bootloader because this value is used in an #if */
-/* 100 MHz works as default value, even for 75 MHz bitstreams */
-#define CLOCK_TICK_RATE (100*1000*1000)
-
-#endif /* __KERNEL__ */
-
typedef unsigned long cycles_t;
cycles_t get_cycles(void);
66 arch/lm32/kernel/asm-offsets.c
View
@@ -27,39 +27,41 @@ int main(void)
DEFINE(TASK_MM, offsetof(struct task_struct, mm));
DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
- DEFINE(PT_R0, offsetof(struct pt_regs, r0));
- DEFINE(PT_R1, offsetof(struct pt_regs, r1));
- DEFINE(PT_R2, offsetof(struct pt_regs, r2));
- DEFINE(PT_R3, offsetof(struct pt_regs, r3));
- DEFINE(PT_R4, offsetof(struct pt_regs, r4));
- DEFINE(PT_R5, offsetof(struct pt_regs, r5));
- DEFINE(PT_R6, offsetof(struct pt_regs, r6));
- DEFINE(PT_R7, offsetof(struct pt_regs, r7));
- DEFINE(PT_R8, offsetof(struct pt_regs, r8));
- DEFINE(PT_R9, offsetof(struct pt_regs, r9));
- DEFINE(PT_R10, offsetof(struct pt_regs, r10));
- DEFINE(PT_R11, offsetof(struct pt_regs, r11));
- DEFINE(PT_R12, offsetof(struct pt_regs, r12));
- DEFINE(PT_R13, offsetof(struct pt_regs, r13));
- DEFINE(PT_R14, offsetof(struct pt_regs, r14));
- DEFINE(PT_R15, offsetof(struct pt_regs, r15));
- DEFINE(PT_R16, offsetof(struct pt_regs, r16));
- DEFINE(PT_R17, offsetof(struct pt_regs, r17));
- DEFINE(PT_R18, offsetof(struct pt_regs, r18));
- DEFINE(PT_R19, offsetof(struct pt_regs, r19));
- DEFINE(PT_R20, offsetof(struct pt_regs, r20));
- DEFINE(PT_R21, offsetof(struct pt_regs, r21));
- DEFINE(PT_R22, offsetof(struct pt_regs, r22));
- DEFINE(PT_R23, offsetof(struct pt_regs, r23));
- DEFINE(PT_R24, offsetof(struct pt_regs, r24));
- DEFINE(PT_R25, offsetof(struct pt_regs, r25));
- DEFINE(PT_GP, offsetof(struct pt_regs, gp));
- DEFINE(PT_FP, offsetof(struct pt_regs, fp));
- DEFINE(PT_SP, offsetof(struct pt_regs, sp));
- DEFINE(PT_RA, offsetof(struct pt_regs, ra));
- DEFINE(PT_EA, offsetof(struct pt_regs, ea));
- DEFINE(PT_BA, offsetof(struct pt_regs, ba));
+ /* These are used with sp as the base address, hence the 4 byte offset */
+ DEFINE(PT_R1, offsetof(struct pt_regs, r1) + 4);
+ DEFINE(PT_R2, offsetof(struct pt_regs, r2) + 4);
+ DEFINE(PT_R3, offsetof(struct pt_regs, r3) + 4);
+ DEFINE(PT_R4, offsetof(struct pt_regs, r4) + 4);
+ DEFINE(PT_R5, offsetof(struct pt_regs, r5) + 4);
+ DEFINE(PT_R6, offsetof(struct pt_regs, r6) + 4);
+ DEFINE(PT_R7, offsetof(struct pt_regs, r7) + 4);
+ DEFINE(PT_R8, offsetof(struct pt_regs, r8) + 4);
+ DEFINE(PT_R9, offsetof(struct pt_regs, r9) + 4);
+ DEFINE(PT_R10, offsetof(struct pt_regs, r10) + 4);
+ DEFINE(PT_R11, offsetof(struct pt_regs, r11) + 4);
+ DEFINE(PT_R12, offsetof(struct pt_regs, r12) + 4);
+ DEFINE(PT_R13, offsetof(struct pt_regs, r13) + 4);
+ DEFINE(PT_R14, offsetof(struct pt_regs, r14) + 4);
+ DEFINE(PT_R15, offsetof(struct pt_regs, r15) + 4);
+ DEFINE(PT_R16, offsetof(struct pt_regs, r16) + 4);
+ DEFINE(PT_R17, offsetof(struct pt_regs, r17) + 4);
+ DEFINE(PT_R18, offsetof(struct pt_regs, r18) + 4);
+ DEFINE(PT_R19, offsetof(struct pt_regs, r19) + 4);
+ DEFINE(PT_R20, offsetof(struct pt_regs, r20) + 4);
+ DEFINE(PT_R21, offsetof(struct pt_regs, r21) + 4);
+ DEFINE(PT_R22, offsetof(struct pt_regs, r22) + 4);
+ DEFINE(PT_R23, offsetof(struct pt_regs, r23) + 4);
+ DEFINE(PT_R24, offsetof(struct pt_regs, r24) + 4);
+ DEFINE(PT_R25, offsetof(struct pt_regs, r25) + 4);
+ DEFINE(PT_GP, offsetof(struct pt_regs, gp) + 4);
+ DEFINE(PT_FP, offsetof(struct pt_regs, fp) + 4);
+ DEFINE(PT_SP, offsetof(struct pt_regs, sp) + 4);
+ DEFINE(PT_RA, offsetof(struct pt_regs, ra) + 4);
+ DEFINE(PT_EA, offsetof(struct pt_regs, ea) + 4);
+ DEFINE(PT_BA, offsetof(struct pt_regs, ba) + 4);
DEFINE(PT_MODE, offsetof(struct pt_regs, pt_mode));
+ DEFINE(PT_ORIG_R1, offsetof(struct pt_regs, orig_r1));
+ DEFINE(PT_SIZE, sizeof(struct pt_regs));
DEFINE(TI_TASK, offsetof(struct thread_info, task));
DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
197 arch/lm32/kernel/entry.S
View
@@ -15,8 +15,8 @@
/* exception vector for os-aware gdb and kernel signals */
#define KERNEL_EXCEPTION_VECTOR(offset) \
- addi sp,sp,-132; \
- sw (sp+120), ra; \
+ addi sp,sp,-PT_SIZE; \
+ sw (sp+PT_RA), ra; \
calli _save_syscall_frame; \
mvi r1, offset; \
addi r2, sp, 4; \
@@ -62,6 +62,11 @@ ENTRY(interrupt_handler)
nop
nop
+.macro current_thread_info reg
+ xnori \reg, r0, (THREAD_SIZE - 1)
+ and \reg, sp, \reg
+.endm
+
.macro switch_to_kernel_mode
/*
* Store away r9,r10,r11 so that we can use it here. The tricky part is that we
@@ -90,15 +95,15 @@ ENTRY(interrupt_handler)
bne r10, r0, 1f
lw sp, (r9+STATE_CURRENT_THREAD)
- addi sp, sp, THREAD_SIZE - 36
+ addi sp, sp, THREAD_SIZE - 4
1:/* already on kernel stack */
- addi sp, sp, -132
+ addi sp, sp, -PT_SIZE
/* save pt_mode, stack pointer and ra in current stack frame */
- sw (sp+132), r10
- sw (sp+116), r11
- sw (sp+120), ra
+ sw (sp+PT_MODE), r10
+ sw (sp+PT_SP), r11
+ sw (sp+PT_RA), ra
mvi r10, PT_MODE_KERNEL
sw (r9+STATE_KERNEL_MODE), r10
@@ -109,10 +114,33 @@ ENTRY(interrupt_handler)
.endm
.macro switch_to_user_mode
- rcsr r2, IE
- andi r3, r2, 0xfffe
- wcsr IE, r3
- lw r2, (sp+132)
+ rcsr r5, IE
+ andi r6, r5, 0xfffe
+ wcsr IE, r6
+
+ lw r5, (sp+PT_MODE)
+ bne r5, r0, 3f
+1:
+ current_thread_info r3
+ lw r3, (r3+TI_FLAGS)
+
+ andi r4, r3, _TIF_WORK_MASK
+ be r4, r0, 3f
+
+ andi r4, r3, _TIF_NEED_RESCHED
+ be r4, r0, 2f
+ calli schedule
+ bi 1b
+2:
+ addi r1, sp, 4
+ calli do_notify_resume
+ bi 1b
+3:
+ rcsr r5, IE
+ andi r6, r5, 0xfffe
+ wcsr IE, r6
+
+ lw r2, (sp+PT_MODE)
mvhi r1, hi(lm32_state)
ori r1, r1, lo(lm32_state)
sw (r1+STATE_KERNEL_MODE), r2
@@ -139,18 +167,13 @@ ENTRY(system_call)
call r9 /* execute syscall */
ENTRY(syscall_tail)
- /* store pt_regs* in r2 */
- addi r2, sp, 4
- calli manage_signals
- sw (sp+8), r1 /* store return value into pt_regs */
-
+ sw (sp+PT_R1), r1 /* store return value into pt_regs */
+ mvi r2, 1 /* In syscall */
bi _restore_and_return_exception
.badsyscall:
mvi r1, -ENOSYS
- sw (sp+8), r1 /* store return value into pt_regs */
-
- bi _restore_and_return_exception
+ bi syscall_tail
/**************************/
/* exception return paths */
@@ -162,9 +185,9 @@ label: \
/* store pt_regs* in r2 */ \
addi r2, sp, 4; \
/* store 0 into r8 (syscall no) in pt_regs */ \
- sw (sp+36), r0; \
- calli manage_signals; \
- sw (sp+8), r1; /* store return value into pt_regs */ \
+ sw (sp+PT_R8), r0; \
+ sw (sp+PT_R1), r1; /* store return value into pt_regs */ \
+ mvi r2, 0; /* Not in syscall */ \
bi branch_to
EXCEPTION_RETURN_PATH(_return_from_exception, _restore_and_return_exception)
@@ -188,35 +211,35 @@ ENTRY(ret_from_kernel_thread)
b r11
.macro save_irq_frame
- sw (sp+8), r1
- sw (sp+12), r2
- sw (sp+16), r3
- sw (sp+20), r4
- sw (sp+24), r5
- sw (sp+28), r6
- sw (sp+32), r7
- sw (sp+36), r8
- sw (sp+40), r9
- sw (sp+44), r10
- /* ra (sp + 120) has already been written */
- sw (sp+124), ea
+ sw (sp+PT_R1), r1
+ sw (sp+PT_R2), r2
+ sw (sp+PT_R3), r3
+ sw (sp+PT_R4), r4
+ sw (sp+PT_R5), r5
+ sw (sp+PT_R6), r6
+ sw (sp+PT_R7), r7
+ sw (sp+PT_R8), r8
+ sw (sp+PT_R9), r9
+ sw (sp+PT_R10), r10
+ /* ra (sp + PT_RA) has already been written */
+ sw (sp+PT_EA), ea
.endm
/* restore all caller saved registers saved in save_irq_frame */
.macro restore_irq_frame
- lw r1, (sp+8);
- lw r2, (sp+12);
- lw r3, (sp+16);
- lw r4, (sp+20);
- lw r5, (sp+24);
- lw r6, (sp+28);
- lw r7, (sp+32);
- lw r8, (sp+36);
- lw r9, (sp+40);
- lw r10, (sp+44);
- lw ra, (sp+120)
- lw ea, (sp+124)
- lw sp, (sp+116)
+ lw r1, (sp+PT_R1);
+ lw r2, (sp+PT_R2);
+ lw r3, (sp+PT_R3);
+ lw r4, (sp+PT_R4);
+ lw r5, (sp+PT_R5);
+ lw r6, (sp+PT_R6);
+ lw r7, (sp+PT_R7);
+ lw r8, (sp+PT_R8);
+ lw r9, (sp+PT_R9);
+ lw r10, (sp+PT_R10);
+ lw ra, (sp+PT_RA)
+ lw ea, (sp+PT_EA)
+ lw sp, (sp+PT_SP)
.endm
/* in IRQ we call a function between save and restore */
@@ -265,34 +288,34 @@ _long_interrupt_handler:
addi r2, sp, 4
calli asm_do_IRQ
- addi r1, sp, 4
- calli manage_signals_irq
6:
+ mvi r2, 0 /* Not in syscall */
switch_to_user_mode
restore_irq_frame
eret
_save_syscall_frame:
save_irq_frame
- sw (sp+48), r11
- sw (sp+52), r12
- sw (sp+56), r13
- sw (sp+60), r14
- sw (sp+64), r15
- sw (sp+68), r16
- sw (sp+72), r17
- sw (sp+76), r18
- sw (sp+80), r19
- sw (sp+84), r20
- sw (sp+88), r21
- sw (sp+92), r22
- sw (sp+96), r23
- sw (sp+100), r24
- sw (sp+104), r25
- sw (sp+108), r26
- sw (sp+112), r27
- /* ra (sp + 120) has already been written */
- sw (sp+128), ba
+ sw (sp+PT_R11), r11
+ sw (sp+PT_R12), r12
+ sw (sp+PT_R13), r13
+ sw (sp+PT_R14), r14
+ sw (sp+PT_R15), r15
+ sw (sp+PT_R16), r16
+ sw (sp+PT_R17), r17
+ sw (sp+PT_R18), r18
+ sw (sp+PT_R19), r19
+ sw (sp+PT_R20), r20
+ sw (sp+PT_R21), r21
+ sw (sp+PT_R22), r22
+ sw (sp+PT_R23), r23
+ sw (sp+PT_R24), r24
+ sw (sp+PT_R25), r25
+ sw (sp+PT_GP), r26
+ sw (sp+PT_FP), r27
+ /* ra (sp + PT_RA) has already been written */
+ sw (sp+PT_BA), ba
+ sw (sp+PT_ORIG_R1), r1
ret
@@ -310,25 +333,25 @@ label: \
switch_to_user_mode; \
/* restore frame from original kernel stack */ \
/* restore r1 as the return value is stored onto the stack */ \
- lw r11, (sp+48); \
- lw r12, (sp+52); \
- lw r13, (sp+56); \
- lw r14, (sp+60); \
- lw r15, (sp+64); \
- lw r16, (sp+68); \
- lw r17, (sp+72); \
- lw r18, (sp+76); \
- lw r19, (sp+80); \
- lw r20, (sp+84); \
- lw r21, (sp+88); \
- lw r22, (sp+92); \
- lw r23, (sp+96); \
- lw r24, (sp+100); \
- lw r25, (sp+104); \
- lw r26, (sp+108); \
- lw r27, (sp+112); \
- lw ra, (sp+120); \
- lw ba, (sp+128); \
+ lw r11, (sp+PT_R11); \
+ lw r12, (sp+PT_R12); \
+ lw r13, (sp+PT_R13); \
+ lw r14, (sp+PT_R14); \
+ lw r15, (sp+PT_R15); \
+ lw r16, (sp+PT_R16); \
+ lw r17, (sp+PT_R17); \
+ lw r18, (sp+PT_R18); \
+ lw r19, (sp+PT_R19); \
+ lw r20, (sp+PT_R20); \
+ lw r21, (sp+PT_R21); \
+ lw r22, (sp+PT_R22); \
+ lw r23, (sp+PT_R23); \
+ lw r24, (sp+PT_R24); \
+ lw r25, (sp+PT_R25); \
+ lw r26, (sp+PT_GP); \
+ lw r27, (sp+PT_FP); \
+ lw ra, (sp+PT_RA); \
+ lw ba, (sp+PT_BA); \
restore_irq_frame; \
/* scall stores pc into ea/ba register, not pc+4, so we have to add 4 */ \
addi addr_register, addr_register, 4; \
1  arch/lm32/kernel/process.c
View
@@ -40,6 +40,7 @@
#include <linux/reboot.h>
#include <linux/fs.h>
#include <linux/io.h>
+#include <linux/pm.h>
#include <asm/uaccess.h>
#include <asm/traps.h>
205 arch/lm32/kernel/signal.c
View
@@ -49,7 +49,7 @@
#include <linux/personality.h>
#include <linux/tty.h>
#include <linux/hardirq.h>
-#include <linux/freezer.h>
+#include <linux/tracehook.h>
#include <asm/uaccess.h>
#include <asm/ucontext.h>
@@ -60,8 +60,6 @@
#define DEBUG_SIG 0
-asmlinkage int manage_signals(int retval, struct pt_regs* regs);
-
struct rt_sigframe {
struct siginfo info;
struct ucontext uc;
@@ -79,7 +77,8 @@ asmlinkage int sys_rt_sigreturn(void)
struct pt_regs *regs = current_pt_regs();
struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(regs->sp + 4);
sigset_t set;
- stack_t st;
+
+ current_thread_info()->restart_block.fn = do_no_restart_syscall;
if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe;
@@ -92,9 +91,8 @@ asmlinkage int sys_rt_sigreturn(void)
if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
goto badframe;
- if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st)))
+ if (restore_altstack(&frame->uc.uc_stack))
goto badframe;
- do_sigaltstack(&st, NULL, regs->sp);
return regs->r1;
@@ -106,7 +104,7 @@ asmlinkage int sys_rt_sigreturn(void)
/*
* Set up a signal frame.
*/
-static int setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
+static int setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
unsigned long mask)
{
int err;
@@ -120,28 +118,23 @@ static int setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
/*
* Determine which stack to use..
*/
-static inline void __user *get_sigframe(struct k_sigaction *ka,
+static inline void __user *get_sigframe(struct ksignal *ksig,
struct pt_regs *regs, size_t frame_size)
{
- unsigned long sp = regs->sp;
-
- if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp))
- /* use stack set by sigaltstack */
- sp = current->sas_ss_sp + current->sas_ss_size;
+ unsigned long sp = sigsp(regs->sp, ksig);
return (void __user *)((sp - frame_size) & ~7UL);
}
-static int setup_rt_frame(int sig, struct k_sigaction *ka,
- sigset_t *set, struct pt_regs *regs)
+static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
{
struct rt_sigframe __user *frame;
int err = 0;
- frame = get_sigframe(ka, regs, sizeof(*frame));
+ frame = get_sigframe(ksig, regs, sizeof(*frame));
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
- goto give_sigsegv;
+ return 1;
err |= __clear_user(&frame->uc, sizeof(frame->uc));
err |= __save_altstack(&frame->uc.uc_stack, regs->sp);
@@ -157,29 +150,20 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka,
err |= __put_user(0xac000007, &frame->tramp[1]);
if (err)
- goto give_sigsegv;
-
- /* flush instruction cache */
- asm volatile("nop");
- asm volatile("nop");
- asm volatile("nop");
- asm volatile("nop");
- asm volatile("wcsr ICC, r0");
- asm volatile("nop");
- asm volatile("nop");
- asm volatile("nop");
- asm volatile("nop");
+ return err;
+
+ flush_icache_range(&frame->tramp, &frame->tramp + 2);
/* set return address for signal handler to trampoline */
regs->ra = (unsigned long)(&frame->tramp[0]);
/* Set up registers for returning to signal handler */
/* entry point */
- regs->ea = (unsigned long)ka->sa.sa_handler - 4;
+ regs->ea = (unsigned long)ksig->ka.sa.sa_handler - 4;
/* stack pointer */
regs->sp = (unsigned long)frame - 4;
/* Signal handler arguments */
- regs->r1 = sig; /* first argument = signum */
+ regs->r1 = ksig->sig; /* first argument = signum */
regs->r2 = (unsigned long)&frame->info;
regs->r3 = (unsigned long)&frame->uc;
@@ -188,21 +172,16 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka,
current->comm, current->pid, frame, regs->sp, regs->ra, regs->ea, sig);
#endif
- return regs->r1;
-
-give_sigsegv:
- force_sigsegv(sig, current);
-
- return -1;
+ return 0;
}
-static void handle_signal(unsigned long sig, siginfo_t *info,
- struct k_sigaction *ka, struct pt_regs *regs)
+static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
{
sigset_t *oldset = sigmask_to_save();
+ int ret;
- setup_rt_frame(sig, ka, oldset, regs);
- signal_delivered(sig, info, ka, regs, 0);
+ ret = setup_rt_frame(ksig, oldset, regs);
+ signal_setup_done(ret, ksig, 0);
}
/*
@@ -214,114 +193,64 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
* the kernel can handle, and then we build all the user-level signal handling
* stack-frames in one go after that.
*/
-static int do_signal(int retval, struct pt_regs *regs)
+static void do_signal(struct pt_regs *regs, unsigned int in_syscall)
{
- siginfo_t info;
- int signr;
- struct k_sigaction ka;
-
- /*
- * We want the common case to go fast, which
- * is why we may in certain cases get here from
- * kernel mode. Just return without doing anything
- * if so.
- */
- if (!user_mode(regs))
- return 0;
-
- if (try_to_freeze())
- goto no_signal;
-
- signr = get_signal_to_deliver(&info, &ka, regs, NULL);
-
- if (signr > 0) {
- /* Whee! Actually deliver the signal. */
- handle_signal(signr, &info, &ka, regs);
- return signr;
- }
+ struct ksignal ksig;
-no_signal:
/* Did we come from a system call? */
- if (regs->r8) {
- switch (retval) {
- case -ERESTART_RESTARTBLOCK:
- regs->r8 = __NR_restart_syscall;
- case -ERESTARTNOHAND:
- case -ERESTARTSYS:
- case -ERESTARTNOINTR:
- regs->ea -= 4; /* Size of scall insn. */
- break;
- default:
- break;
- }
- }
- restore_saved_sigmask();
-
- return retval;
-}
-
-asmlinkage int manage_signals(int retval, struct pt_regs *regs)
-{
- unsigned long flags;
- if (!user_mode(regs))
- return retval;
-
- /* disable interrupts for sampling current_thread_info()->flags */
- local_irq_save(flags);
- while (current_thread_info()->flags & (_TIF_NEED_RESCHED | _TIF_SIGPENDING)) {
- if (current_thread_info()->flags & _TIF_NEED_RESCHED) {
- /* schedule -> enables interrupts */
- schedule();
-
- /* disable interrupts for sampling current_thread_info()->flags */
- local_irq_disable();
- }
-
- if (current_thread_info()->flags & _TIF_SIGPENDING) {
-#if DEBUG_SIG
- /* debugging code */
- {
- register unsigned long sp asm("sp");
- printk("WILL process signal for %s with regs=%lx, ea=%lx, ba=%lx ra=%lx\n",
- current->comm, regs, regs->ea, regs->ba, *((unsigned long*)(sp+4)));
+ if (get_signal(&ksig)) {
+ if (in_syscall) {
+ switch (regs->r1) {
+ case -ERESTART_RESTARTBLOCK:
+ case -ERESTARTNOHAND:
+ regs->r1 = -EINTR;
+ break;
+ case -ERESTARTSYS:
+ if (!(ksig.ka.sa.sa_flags & SA_RESTART)) {
+ regs->r1 = -EINTR;
+ break;
+ }
+ /* fallthrough */
+ case -ERESTARTNOINTR:
+ regs->ea -= 4; /* Size of scall insn. */
+ regs->r1 = regs->orig_r1;
+ break;
+ default:
+ break;
}
-#endif
- retval = do_signal(retval, regs);
-
- /* signal handling enables interrupts */
-
- /* disable irqs for sampling current_thread_info()->flags */
- local_irq_disable();
-#if DEBUG_SIG
- /* debugging code */
- {
- register unsigned long sp asm("sp");
- printk("Processed Signal for %s with regs=%lx, ea=%lx, ba=%lx ra=%lx\n",
- current->comm, regs, regs->ea, regs->ba, *((unsigned long*)(sp+4)));
+ }
+ handle_signal(&ksig, regs);
+ } else {
+ /* If there is no handler always restart */
+ if (in_syscall) {
+ switch (regs->r1) {
+ case -ERESTART_RESTARTBLOCK:
+ regs->r8 = __NR_restart_syscall;
+ /* fallthrough */
+ case -ERESTARTNOHAND:
+ case -ERESTARTSYS:
+ case -ERESTARTNOINTR:
+ regs->ea -= 4; /* Size of scall insn. */
+ regs->r1 = regs->orig_r1;
+ break;
+ default:
+ break;
}
-#endif
}
+ restore_saved_sigmask();
}
- local_irq_restore(flags);
-
- return retval;
}
-asmlinkage void manage_signals_irq(struct pt_regs *regs)
+asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int in_syscall,
+ unsigned int thread_flags)
{
- unsigned long flags;
+ local_irq_enable();
- if (!user_mode(regs))
- return;
-
- /* disable interrupts for sampling current_thread_info()->flags */
- local_irq_save(flags);
-
- if( current_thread_info()->flags & _TIF_NEED_RESCHED ) {
- /* schedule -> enables interrupts */
- schedule();
+ if (thread_flags & _TIF_SIGPENDING) {
+ do_signal(regs, in_syscall);
+ } else {
+ clear_thread_flag(TIF_NOTIFY_RESUME);
+ tracehook_notify_resume(regs);
}
-
- local_irq_restore(flags);
}
11 arch/m32r/include/asm/signal.h
View
@@ -16,16 +16,7 @@ typedef struct {
unsigned long sig[_NSIG_WORDS];
} sigset_t;
-struct sigaction {
- __sighandler_t sa_handler;
- unsigned long sa_flags;
- __sigrestore_t sa_restorer;
- sigset_t sa_mask; /* mask last for extensibility */
-};
-
-struct k_sigaction {
- struct sigaction sa;
-};
+#define __ARCH_HAS_SA_RESTORER
#include <asm/sigcontext.h>
#undef __HAVE_ARCH_SIG_BITOPS
10 arch/m68k/include/asm/signal.h
View
@@ -23,16 +23,8 @@ struct old_sigaction {
__sigrestore_t sa_restorer;
};
-struct sigaction {
- __sighandler_t sa_handler;
- unsigned long sa_flags;
- __sigrestore_t sa_restorer;
- sigset_t sa_mask; /* mask last for extensibility */
-};
+#define __ARCH_HAS_SA_RESTORER
-struct k_sigaction {
- struct sigaction sa;
-};
#include <asm/sigcontext.h>
#ifndef CONFIG_CPU_HAS_NO_BITFIELDS
2  arch/mips/include/asm/signal.h
View
@@ -21,4 +21,6 @@
#include <asm/sigcontext.h>
#include <asm/siginfo.h>
+#define __ARCH_HAS_ODD_SIGACTION
+
#endif /* _ASM_SIGNAL_H */
6 arch/mips/include/uapi/asm/signal.h
View
@@ -96,15 +96,13 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */
#include <asm-generic/signal-defs.h>
+#ifndef __KERNEL__
struct sigaction {
unsigned int sa_flags;
__sighandler_t sa_handler;
sigset_t sa_mask;
};
-
-struct k_sigaction {
- struct sigaction sa;
-};
+#endif
/* IRIX compatible stack_t */
typedef struct sigaltstack {
10 arch/mn10300/include/asm/signal.h
View
@@ -33,16 +33,8 @@ struct old_sigaction {
__sigrestore_t sa_restorer;
};
-struct sigaction {
- __sighandler_t sa_handler;
- unsigned long sa_flags;
- __sigrestore_t sa_restorer;
- sigset_t sa_mask; /* mask last for extensibility */
-};
+#define __ARCH_HAS_SA_RESTORER
-struct k_sigaction {
- struct sigaction sa;
-};
#include <asm/sigcontext.h>
#endif /* _ASM_SIGNAL_H */
6 arch/parisc/include/asm/signal.h
View
@@ -24,15 +24,13 @@ typedef struct {
unsigned long sig[_NSIG_WORDS];
} sigset_t;
+#ifndef __KERNEL__
struct sigaction {
__sighandler_t sa_handler;
unsigned long sa_flags;
sigset_t sa_mask; /* mask last for extensibility */
};
-
-struct k_sigaction {
- struct sigaction sa;
-};
+#endif
#include <asm/sigcontext.h>
1  arch/powerpc/include/asm/signal.h
View
@@ -1,6 +1,7 @@
#ifndef _ASM_POWERPC_SIGNAL_H
#define _ASM_POWERPC_SIGNAL_H
+#define __ARCH_HAS_SA_RESTORER
#include <uapi/asm/signal.h>
#endif /* _ASM_POWERPC_SIGNAL_H */
1  arch/powerpc/include/asm/syscalls.h
View
@@ -9,7 +9,6 @@
struct pt_regs;
struct rtas_args;
-struct sigaction;
asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
unsigned long prot, unsigned long flags,
6 arch/powerpc/include/uapi/asm/signal.h
View
@@ -97,16 +97,14 @@ struct old_sigaction {
__sigrestore_t sa_restorer;
};
+#ifndef __KERNEL__
struct sigaction {
__sighandler_t sa_handler;
unsigned long sa_flags;
__sigrestore_t sa_restorer;
sigset_t sa_mask; /* mask last for extensibility */
};
-
-struct k_sigaction {
- struct sigaction sa;
-};
+#endif
typedef struct sigaltstack {
void __user *ss_sp;
12 arch/s390/include/asm/signal.h
View
@@ -28,15 +28,5 @@ struct old_sigaction {
void (*sa_restorer)(void);
};
-struct sigaction {
- __sighandler_t sa_handler;
- unsigned long sa_flags;
- void (*sa_restorer)(void);
- sigset_t sa_mask; /* mask last for extensibility */
-};
-
-struct k_sigaction {
- struct sigaction sa;
-};
-
+#define __ARCH_HAS_SA_RESTORER
#endif
6 arch/sparc/include/asm/signal.h
View
@@ -21,10 +21,8 @@
*/
#define SA_STATIC_ALLOC 0x8000
-struct k_sigaction {
- struct __new_sigaction sa;
- void __user *ka_restorer;
-};
+#define __ARCH_HAS_KA_RESTORER
+#define __ARCH_HAS_SA_RESTORER
#endif /* !(__ASSEMBLY__) */
#endif /* !(__SPARC_SIGNAL_H) */
2  arch/sparc/include/uapi/asm/signal.h
View
@@ -153,12 +153,14 @@ struct sigstack {
#include <asm-generic/signal-defs.h>
+#ifndef __KERNEL__
struct __new_sigaction {
__sighandler_t sa_handler;
unsigned long sa_flags;
__sigrestore_t sa_restorer; /* not used by Linux/SPARC yet */
__new_sigset_t sa_mask;
};
+#endif
struct __old_sigaction {
__sighandler_t sa_handler;
2  arch/sparc/kernel/systbls.h
View
@@ -3,8 +3,8 @@
#include <linux/kernel.h>
#include <linux/types.h>
+#include <linux/signal.h>
#include <asm/utrap.h>
-#include <asm/signal.h>
extern asmlinkage unsigned long sys_getpagesize(void);
extern asmlinkage long sparc_pipe(struct pt_regs *regs);
15 arch/x86/include/asm/signal.h
View
@@ -31,6 +31,9 @@ typedef sigset_t compat_sigset_t;
#include <uapi/asm/signal.h>
#ifndef __ASSEMBLY__
extern void do_notify_resume(struct pt_regs *, void *, __u32);
+
+#define __ARCH_HAS_SA_RESTORER
+
#ifdef __i386__
struct old_sigaction {
__sighandler_t sa_handler;
@@ -39,18 +42,6 @@ struct old_sigaction {
__sigrestore_t sa_restorer;
};
-struct sigaction {
- __sighandler_t sa_handler;
- unsigned long sa_flags;
- __sigrestore_t sa_restorer;
- sigset_t sa_mask; /* mask last for extensibility */
-};
-
-struct k_sigaction {
- struct sigaction sa;
-};
-
-#else /* __i386__ */
#endif /* !__i386__ */
#include <asm/sigcontext.h>
8 arch/x86/include/uapi/asm/signal.h
View
@@ -95,9 +95,9 @@ typedef unsigned long sigset_t;
#ifndef __ASSEMBLY__
-#ifdef __i386__
# ifndef __KERNEL__
/* Here we must cater to libcs that poke about in kernel headers. */
+#ifdef __i386__
struct sigaction {
union {
@@ -112,7 +112,6 @@ struct sigaction {
#define sa_handler _u._sa_handler
#define sa_sigaction _u._sa_sigaction
-# endif /* ! __KERNEL__ */
#else /* __i386__ */
struct sigaction {
@@ -122,11 +121,8 @@ struct sigaction {
sigset_t sa_mask; /* mask last for extensibility */
};
-struct k_sigaction {
- struct sigaction sa;
-};
-
#endif /* !__i386__ */
+# endif /* ! __KERNEL__ */
typedef struct sigaltstack {
void __user *ss_sp;
11 arch/xtensa/include/asm/signal.h
View
@@ -15,16 +15,7 @@
#include <uapi/asm/signal.h>
#ifndef __ASSEMBLY__
-struct sigaction {
- __sighandler_t sa_handler;
- unsigned long sa_flags;
- void (*sa_restorer)(void);
- sigset_t sa_mask; /* mask last for extensibility */
-};
-
-struct k_sigaction {
- struct sigaction sa;
-};
+#define __ARCH_HAS_SA_RESTORER
#include <asm/sigcontext.h>
11 include/linux/sched.h
View
@@ -2305,6 +2305,17 @@ static inline int sas_ss_flags(unsigned long sp)
: on_sig_stack(sp) ? SS_ONSTACK : 0);
}
+static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig)
+{
+ if (unlikely((ksig->ka.sa.sa_flags & SA_ONSTACK)) && ! sas_ss_flags(sp))
+#ifdef CONFIG_STACK_GROWSUP
+ return current->sas_ss_sp;
+#else
+ return current->sas_ss_sp + current->sas_ss_size;
+#endif
+ return sp;
+}
+
/*
* Routines for handling mm_structs
*/
40 include/linux/signal.h
View
@@ -252,10 +252,50 @@ extern void __set_current_blocked(const sigset_t *);
extern int show_unhandled_signals;
extern int sigsuspend(sigset_t *);
+struct sigaction {
+#ifndef __ARCH_HAS_ODD_SIGACTION
+ __sighandler_t sa_handler;
+ unsigned long sa_flags;
+#else
+ unsigned long sa_flags;
+ __sighandler_t sa_handler;
+#endif
+#ifdef __ARCH_HAS_SA_RESTORER
+ __sigrestore_t sa_restorer;
+#endif
+ sigset_t sa_mask; /* mask last for extensibility */
+};
+
+struct k_sigaction {
+ struct sigaction sa;
+#ifdef __ARCH_HAS_KA_RESTORER
+ __sigrestore_t ka_restorer;
+#endif
+};
+
+struct ksignal {
+ struct k_sigaction ka;
+ siginfo_t info;
+ int sig;
+};
+
extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
+extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);
extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping);
extern void exit_signals(struct task_struct *tsk);
+/*
+ * Eventually that'll replace get_signal_to_deliver(); macro for now,
+ * to avoid nastiness with include order.
+ */
+#define get_signal(ksig) \
+({ \
+ struct ksignal *p = (ksig); \
+ p->sig = get_signal_to_deliver(&p->info, &p->ka, \
+ signal_pt_regs(), NULL);\
+ p->sig > 0; \
+})
+
extern struct kmem_cache *sighand_cachep;
int unhandled_signal(struct task_struct *tsk, int sig);
2  include/linux/syscalls.h
View
@@ -68,11 +68,11 @@ struct sigaltstack;
#include <linux/types.h>
#include <linux/aio_abi.h>
#include <linux/capability.h>
+#include <linux/signal.h>
#include <linux/list.h>
#include <linux/bug.h>
#include <linux/sem.h>
#include <asm/siginfo.h>
-#include <asm/signal.h>
#include <linux/unistd.h>
#include <linux/quota.h>
#include <linux/key.h>
10 include/uapi/asm-generic/signal.h
View
@@ -93,6 +93,11 @@ typedef unsigned long old_sigset_t;
#include <asm-generic/signal-defs.h>
+#ifdef SA_RESTORER
+#define __ARCH_HAS_SA_RESTORER
+#endif
+
+#ifndef __KERNEL__
struct sigaction {
__sighandler_t sa_handler;
unsigned long sa_flags;
@@ -101,10 +106,7 @@ struct sigaction {
#endif
sigset_t sa_mask; /* mask last for extensibility */
};
-
-struct k_sigaction {
- struct sigaction sa;
-};
+#endif
typedef struct sigaltstack {
void __user *ss_sp;
9 kernel/signal.c
View
@@ -2395,6 +2395,15 @@ void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka,
tracehook_signal_handler(sig, info, ka, regs, stepping);
}
+void signal_setup_done(int failed, struct ksignal *ksig, int stepping)
+{
+ if (failed)
+ force_sigsegv(ksig->sig, current);
+ else
+ signal_delivered(ksig->sig, &ksig->info, &ksig->ka,
+ signal_pt_regs(), stepping);
+}
+
/*
* It could be that complete_signal() picked us to notify about the
* group-wide signal. Other threads should be notified now to take

No commit comments for this range

Something went wrong with that request. Please try again.