aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips/compat-signal.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-13 19:12:23 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-13 19:12:23 -0500
commit463020ce428e2f00d4f33a383d6f39c7453a6854 (patch)
treec82d90c19e83c32b01c9748b4671640a670324e6 /include/asm-mips/compat-signal.h
parent58a3bb59973e33a428d72fa530a3d1d81feb0e8f (diff)
parent431dc8040354db65e4f8d4d4e21ae4fab41f5bc3 (diff)
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus: [MIPS] Fix sigset_t endianess swapping issues in 32-bit compat code. [MIPS] Fix uniprocessor Sibyte builds. [MIPS] Make entry.S a little more readable. [MIPS] Remove stray instruction from __get_user_asm_ll32. [MIPS] 32-bit: Fix warning about cast for fetching pointer from userspace. [MIPS] DECstation: Fix irq handling [MIPS] signals: make common _BLOCKABLE macro [MIPS] signal: Move sigframe definition for native O32/N64 into signal.c [MIPS] signal: Move {restore,setup}_sigcontext prototypes to their user [MIPS] signal: Fix warnings in o32 compat code. [MIPS] IP27: Enable N32 support in defconfig. Revert "[MIPS] Fix warning in get_user when fetching pointer object from userspace." [MIPS] Don't claim we support dma_declare_coherent_memory - we don't. [MIPS] Unify dma-{coherent,noncoherent.ip27,ip32} [MIPS] Improve branch prediction in ll/sc atomic operations.
Diffstat (limited to 'include/asm-mips/compat-signal.h')
-rw-r--r--include/asm-mips/compat-signal.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/include/asm-mips/compat-signal.h b/include/asm-mips/compat-signal.h
new file mode 100644
index 000000000000..672077084aa1
--- /dev/null
+++ b/include/asm-mips/compat-signal.h
@@ -0,0 +1,55 @@
1#ifndef __ASM_COMPAT_SIGNAL_H
2#define __ASM_COMPAT_SIGNAL_H
3
4#include <linux/bug.h>
5#include <linux/compat.h>
6#include <linux/compiler.h>
7
8static inline int __copy_conv_sigset_to_user(compat_sigset_t __user *d,
9 const sigset_t *s)
10{
11 int err;
12
13 BUG_ON(sizeof(*d) != sizeof(*s));
14 BUG_ON(_NSIG_WORDS != 2);
15
16 err = __put_user(s->sig[0], &d->sig[0]);
17 err |= __put_user(s->sig[0] >> 32, &d->sig[1]);
18 err |= __put_user(s->sig[1], &d->sig[2]);
19 err |= __put_user(s->sig[1] >> 32, &d->sig[3]);
20
21 return err;
22}
23
24static inline int __copy_conv_sigset_from_user(sigset_t *d,
25 const compat_sigset_t __user *s)
26{
27 int err;
28 union sigset_u {
29 sigset_t s;
30 compat_sigset_t c;
31 } *u = (union sigset_u *) d;
32
33 BUG_ON(sizeof(*d) != sizeof(*s));
34 BUG_ON(_NSIG_WORDS != 2);
35
36 if (unlikely(!access_ok(VERIFY_READ, d, sizeof(*d))))
37 return -EFAULT;
38
39#ifdef CONFIG_CPU_BIG_ENDIAN
40 err = __get_user(u->c.sig[1], &s->sig[0]);
41 err |= __get_user(u->c.sig[0], &s->sig[1]);
42 err |= __get_user(u->c.sig[3], &s->sig[2]);
43 err |= __get_user(u->c.sig[2], &s->sig[3]);
44#endif
45#ifdef CONFIG_CPU_LITTLE_ENDIAN
46 err = __get_user(u->c.sig[0], &s->sig[0]);
47 err |= __get_user(u->c.sig[1], &s->sig[1]);
48 err |= __get_user(u->c.sig[2], &s->sig[2]);
49 err |= __get_user(u->c.sig[3], &s->sig[3]);
50#endif
51
52 return err;
53}
54
55#endif /* __ASM_COMPAT_SIGNAL_H */