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>
lm32: signal: Use flush_icache_range() instead of open-coding it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
lm32: signal: Reset restart_block.fn in rt_sigreturn

This is required for proper operation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
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>
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>
consolidate kernel-side struct sigaction declarations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
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>
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>
new helper: sigsp()

Normal logics for altstack handling in sigframe allocation

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
lm32: signal: switch to ksignal

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
lm32: Rework signal handling

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
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>
lm32: processor.h: More cleanups

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
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>
lm32: timex.h: Remove CLOCK_TICK_RATE

It's unused.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
lm32: prom.h: Remove #ifdef CONFIG_OF

CONFIG_OF is always defined for lm32.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
lm32: Remove r0 from pt_regs

We never use it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
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>