Commit cd1d18cf authored by Stephen Rothwell's avatar Stephen Rothwell Committed by David S. Miller

[COMPAT]: compat_{old_}sigset_t sparc64.

parent 6a3354a9
......@@ -9,6 +9,9 @@
*/
#include <linux/config.h>
#ifdef CONFIG_SPARC32_COMPAT
#include <linux/compat.h> /* for compat_old_sigset_t */
#endif
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/signal.h>
......@@ -247,7 +250,7 @@ asmlinkage void _sigpause_common(old_sigset_t set, struct pt_regs *regs)
#ifdef CONFIG_SPARC32_COMPAT
if (test_thread_flag(TIF_32BIT)) {
extern asmlinkage void _sigpause32_common(old_sigset_t32,
extern asmlinkage void _sigpause32_common(compat_old_sigset_t,
struct pt_regs *);
_sigpause32_common(set, regs);
return;
......
......@@ -56,7 +56,7 @@ struct signal_sframe32 {
/* struct sigcontext32 * */ u32 sig_scptr;
int sig_address;
struct sigcontext32 sig_context;
unsigned extramask[_NSIG_WORDS32 - 1];
unsigned extramask[_COMPAT_NSIG_WORDS - 1];
};
/*
......@@ -69,7 +69,7 @@ struct new_signal_frame32 {
__siginfo32_t info;
/* __siginfo_fpu32_t * */ u32 fpu_save;
unsigned int insns [2];
unsigned extramask[_NSIG_WORDS32 - 1];
unsigned extramask[_COMPAT_NSIG_WORDS - 1];
unsigned extra_size; /* Should be sizeof(siginfo_extra_v8plus_t) */
/* Only valid if (info.si_regs.psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS */
siginfo_extra_v8plus_t v8plus;
......@@ -80,7 +80,7 @@ struct rt_signal_frame32 {
struct sparc_stackf32 ss;
siginfo_t32 info;
struct pt_regs32 regs;
sigset_t32 mask;
compat_sigset_t mask;
/* __siginfo_fpu32_t * */ u32 fpu_save;
unsigned int insns [2];
stack_t32 stack;
......@@ -139,7 +139,7 @@ int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from)
* atomically swap in the new signal mask, and wait for a signal.
* This is really tricky on the Sparc, watch out...
*/
asmlinkage void _sigpause32_common(old_sigset_t32 set, struct pt_regs *regs)
asmlinkage void _sigpause32_common(compat_old_sigset_t set, struct pt_regs *regs)
{
sigset_t saveset;
......@@ -179,7 +179,7 @@ asmlinkage void _sigpause32_common(old_sigset_t32 set, struct pt_regs *regs)
asmlinkage void do_rt_sigsuspend32(u32 uset, size_t sigsetsize, struct pt_regs *regs)
{
sigset_t oldset, set;
sigset_t32 set32;
compat_sigset_t set32;
/* XXX: Don't preclude handling different sized sigset_t's. */
if (((compat_size_t)sigsetsize) != sizeof(sigset_t)) {
......@@ -256,7 +256,7 @@ void do_new_sigreturn32(struct pt_regs *regs)
unsigned int psr;
unsigned pc, npc, fpu_save;
sigset_t set;
unsigned seta[_NSIG_WORDS32];
unsigned seta[_COMPAT_NSIG_WORDS];
int err, i;
regs->u_regs[UREG_FP] &= 0x00000000ffffffffUL;
......@@ -302,7 +302,7 @@ void do_new_sigreturn32(struct pt_regs *regs)
if (fpu_save)
err |= restore_fpu_state32(regs, &sf->fpu_state);
err |= __get_user(seta[0], &sf->info.si_mask);
err |= copy_from_user(seta+1, &sf->extramask, (_NSIG_WORDS32 - 1) * sizeof(unsigned));
err |= copy_from_user(seta+1, &sf->extramask, (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned));
if (err)
goto segv;
switch (_NSIG_WORDS) {
......@@ -327,7 +327,7 @@ asmlinkage void do_sigreturn32(struct pt_regs *regs)
struct sigcontext32 *scptr;
unsigned pc, npc, psr;
sigset_t set;
unsigned seta[_NSIG_WORDS32];
unsigned seta[_COMPAT_NSIG_WORDS];
int err;
synchronize_user_stack();
......@@ -349,7 +349,7 @@ asmlinkage void do_sigreturn32(struct pt_regs *regs)
err |= __get_user(seta[0], &scptr->sigc_mask);
/* Note that scptr + 1 points to extramask */
err |= copy_from_user(seta+1, scptr + 1, (_NSIG_WORDS32 - 1) * sizeof(unsigned));
err |= copy_from_user(seta+1, scptr + 1, (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned));
if (err)
goto segv;
switch (_NSIG_WORDS) {
......@@ -393,7 +393,7 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
unsigned pc, npc, fpu_save;
mm_segment_t old_fs;
sigset_t set;
sigset_t32 seta;
compat_sigset_t seta;
stack_t st;
int err, i;
......@@ -440,7 +440,7 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
err |= __get_user(fpu_save, &sf->fpu_save);
if (fpu_save)
err |= restore_fpu_state32(regs, &sf->fpu_state);
err |= copy_from_user(&seta, &sf->mask, sizeof(sigset_t32));
err |= copy_from_user(&seta, &sf->mask, sizeof(compat_sigset_t));
err |= __get_user((long)st.ss_sp, &sf->stack.ss_sp);
err |= __get_user(st.ss_flags, &sf->stack.ss_flags);
err |= __get_user(st.ss_size, &sf->stack.ss_size);
......@@ -498,7 +498,7 @@ setup_frame32(struct sigaction *sa, struct pt_regs *regs, int signr, sigset_t *o
{
struct signal_sframe32 *sframep;
struct sigcontext32 *sc;
unsigned seta[_NSIG_WORDS32];
unsigned seta[_COMPAT_NSIG_WORDS];
int err = 0;
void *sig_address;
int sig_code;
......@@ -544,7 +544,7 @@ setup_frame32(struct sigaction *sa, struct pt_regs *regs, int signr, sigset_t *o
}
err |= __put_user(seta[0], &sc->sigc_mask);
err |= __copy_to_user(sframep->extramask, seta + 1,
(_NSIG_WORDS32 - 1) * sizeof(unsigned));
(_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned));
err |= __put_user(regs->u_regs[UREG_FP], &sc->sigc_sp);
err |= __put_user(pc, &sc->sigc_pc);
err |= __put_user(npc, &sc->sigc_npc);
......@@ -673,7 +673,7 @@ static void new_setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
int sigframe_size;
u32 psr;
int i, err;
unsigned seta[_NSIG_WORDS32];
unsigned seta[_COMPAT_NSIG_WORDS];
/* 1. Make sure everything is clean */
synchronize_user_stack();
......@@ -729,7 +729,7 @@ static void new_setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
}
err |= __put_user(seta[0], &sf->info.si_mask);
err |= __copy_to_user(sf->extramask, seta + 1,
(_NSIG_WORDS32 - 1) * sizeof(unsigned));
(_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned));
err |= copy_in_user((u32 *)sf,
(u32 *)(regs->u_regs[UREG_FP]),
......@@ -1098,7 +1098,7 @@ static void setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
int sigframe_size;
u32 psr;
int i, err;
sigset_t32 seta;
compat_sigset_t seta;
/* 1. Make sure everything is clean */
synchronize_user_stack();
......@@ -1160,7 +1160,7 @@ static void setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
case 1: seta.sig[1] = (oldset->sig[0] >> 32);
seta.sig[0] = oldset->sig[0];
}
err |= __copy_to_user(&sf->mask, &seta, sizeof(sigset_t32));
err |= __copy_to_user(&sf->mask, &seta, sizeof(compat_sigset_t));
err |= copy_in_user((u32 *)sf,
(u32 *)(regs->u_regs[UREG_FP]),
......
......@@ -1681,7 +1681,7 @@ asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_times
extern asmlinkage int sys_sigprocmask(int how, old_sigset_t *set, old_sigset_t *oset);
asmlinkage int sys32_sigprocmask(int how, old_sigset_t32 *set, old_sigset_t32 *oset)
asmlinkage int sys32_sigprocmask(int how, compat_old_sigset_t *set, compat_old_sigset_t *oset)
{
old_sigset_t s;
int ret;
......@@ -1698,15 +1698,15 @@ asmlinkage int sys32_sigprocmask(int how, old_sigset_t32 *set, old_sigset_t32 *o
extern asmlinkage int sys_rt_sigprocmask(int how, sigset_t *set, sigset_t *oset, size_t sigsetsize);
asmlinkage int sys32_rt_sigprocmask(int how, sigset_t32 *set, sigset_t32 *oset, compat_size_t sigsetsize)
asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, compat_size_t sigsetsize)
{
sigset_t s;
sigset_t32 s32;
compat_sigset_t s32;
int ret;
mm_segment_t old_fs = get_fs();
if (set) {
if (copy_from_user (&s32, set, sizeof(sigset_t32)))
if (copy_from_user (&s32, set, sizeof(compat_sigset_t)))
return -EFAULT;
switch (_NSIG_WORDS) {
case 4: s.sig[3] = s32.sig[6] | (((long)s32.sig[7]) << 32);
......@@ -1726,7 +1726,7 @@ asmlinkage int sys32_rt_sigprocmask(int how, sigset_t32 *set, sigset_t32 *oset,
case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1];
case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0];
}
if (copy_to_user (oset, &s32, sizeof(sigset_t32)))
if (copy_to_user (oset, &s32, sizeof(compat_sigset_t)))
return -EFAULT;
}
return 0;
......@@ -1734,7 +1734,7 @@ asmlinkage int sys32_rt_sigprocmask(int how, sigset_t32 *set, sigset_t32 *oset,
extern asmlinkage int sys_sigpending(old_sigset_t *set);
asmlinkage int sys32_sigpending(old_sigset_t32 *set)
asmlinkage int sys32_sigpending(compat_old_sigset_t *set)
{
old_sigset_t s;
int ret;
......@@ -1749,10 +1749,10 @@ asmlinkage int sys32_sigpending(old_sigset_t32 *set)
extern asmlinkage int sys_rt_sigpending(sigset_t *set, size_t sigsetsize);
asmlinkage int sys32_rt_sigpending(sigset_t32 *set, compat_size_t sigsetsize)
asmlinkage int sys32_rt_sigpending(compat_sigset_t *set, compat_size_t sigsetsize)
{
sigset_t s;
sigset_t32 s32;
compat_sigset_t s32;
int ret;
mm_segment_t old_fs = get_fs();
......@@ -1766,19 +1766,19 @@ asmlinkage int sys32_rt_sigpending(sigset_t32 *set, compat_size_t sigsetsize)
case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1];
case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0];
}
if (copy_to_user (set, &s32, sizeof(sigset_t32)))
if (copy_to_user (set, &s32, sizeof(compat_sigset_t)))
return -EFAULT;
}
return ret;
}
asmlinkage int
sys32_rt_sigtimedwait(sigset_t32 *uthese, siginfo_t32 *uinfo,
sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo,
struct compat_timespec *uts, compat_size_t sigsetsize)
{
int ret, sig;
sigset_t these;
sigset_t32 these32;
compat_sigset_t these32;
struct timespec ts;
siginfo_t info;
long timeout = 0;
......@@ -1787,7 +1787,7 @@ sys32_rt_sigtimedwait(sigset_t32 *uthese, siginfo_t32 *uinfo,
if (sigsetsize != sizeof(sigset_t))
return -EINVAL;
if (copy_from_user (&these32, uthese, sizeof(sigset_t32)))
if (copy_from_user (&these32, uthese, sizeof(compat_sigset_t)))
return -EFAULT;
switch (_NSIG_WORDS) {
......@@ -2718,7 +2718,7 @@ asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 *act, struct old
}
if (act) {
old_sigset_t32 mask;
compat_old_sigset_t mask;
ret = get_user((long)new_ka.sa.sa_handler, &act->sa_handler);
ret |= __get_user((long)new_ka.sa.sa_restorer, &act->sa_restorer);
......@@ -2748,10 +2748,10 @@ sys32_rt_sigaction(int sig, struct sigaction32 *act, struct sigaction32 *oact,
{
struct k_sigaction new_ka, old_ka;
int ret;
sigset_t32 set32;
compat_sigset_t set32;
/* XXX: Don't preclude handling different sized sigset_t's. */
if (sigsetsize != sizeof(sigset_t32))
if (sigsetsize != sizeof(compat_sigset_t))
return -EINVAL;
/* All tasks which use RT signals (effectively) use
......@@ -2762,7 +2762,7 @@ sys32_rt_sigaction(int sig, struct sigaction32 *act, struct sigaction32 *oact,
if (act) {
new_ka.ka_restorer = restorer;
ret = get_user((long)new_ka.sa.sa_handler, &act->sa_handler);
ret |= __copy_from_user(&set32, &act->sa_mask, sizeof(sigset_t32));
ret |= __copy_from_user(&set32, &act->sa_mask, sizeof(compat_sigset_t));
switch (_NSIG_WORDS) {
case 4: new_ka.sa.sa_mask.sig[3] = set32.sig[6] | (((long)set32.sig[7]) << 32);
case 3: new_ka.sa.sa_mask.sig[2] = set32.sig[4] | (((long)set32.sig[5]) << 32);
......@@ -2785,7 +2785,7 @@ sys32_rt_sigaction(int sig, struct sigaction32 *act, struct sigaction32 *oact,
case 1: set32.sig[1] = (old_ka.sa.sa_mask.sig[0] >> 32); set32.sig[0] = old_ka.sa.sa_mask.sig[0];
}
ret = put_user((long)old_ka.sa.sa_handler, &oact->sa_handler);
ret |= __copy_to_user(&oact->sa_mask, &set32, sizeof(sigset_t32));
ret |= __copy_to_user(&oact->sa_mask, &set32, sizeof(compat_sigset_t));
ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
ret |= __put_user((long)old_ka.sa.sa_restorer, &oact->sa_restorer);
if (ret)
......
......@@ -1297,7 +1297,7 @@ asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact)
int ret;
if (act) {
old_sigset_t32 mask;
compat_old_sigset_t mask;
if (get_user((long)new_ka.sa.sa_handler, &((struct old_sigaction32 *)A(act))->sa_handler) ||
__get_user(new_ka.sa.sa_flags, &((struct old_sigaction32 *)A(act))->sa_flags))
......
......@@ -77,4 +77,11 @@ struct compat_statfs {
int f_spare[6];
};
typedef u32 compat_old_sigset_t;
#define _COMPAT_NSIG 64
#define _COMPAT_NSIG_BPW 32
typedef u32 compat_sigset_word;
#endif /* _ASM_SPARC64_COMPAT_H */
......@@ -88,27 +88,21 @@
#define _NSIG_BPW 64
#define _NSIG_WORDS (__NEW_NSIG / _NSIG_BPW)
#define _NSIG_BPW32 32
#define _NSIG_WORDS32 (__NEW_NSIG / _NSIG_BPW32)
#define SIGRTMIN 32
#define SIGRTMAX (__NEW_NSIG - 1)
#if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__)
#define _NSIG __NEW_NSIG
#define __new_sigset_t sigset_t
#define __new_sigset_t32 sigset_t32
#define __new_sigaction sigaction
#define __new_sigaction32 sigaction32
#define __old_sigset_t old_sigset_t
#define __old_sigset_t32 old_sigset_t32
#define __old_sigaction old_sigaction
#define __old_sigaction32 old_sigaction32
#else
#define _NSIG __OLD_NSIG
#define NSIG _NSIG
#define __old_sigset_t sigset_t
#define __old_sigset_t32 sigset_t32
#define __old_sigaction sigaction
#define __old_sigaction32 sigaction32
#endif
......@@ -116,16 +110,11 @@
#ifndef __ASSEMBLY__
typedef unsigned long __old_sigset_t; /* at least 32 bits */
typedef unsigned int __old_sigset_t32;
typedef struct {
unsigned long sig[_NSIG_WORDS];
} __new_sigset_t;
typedef struct {
unsigned int sig[_NSIG_WORDS32];
} __new_sigset_t32;
/* A SunOS sigstack */
struct sigstack {
/* XXX 32-bit pointers pinhead XXX */
......@@ -213,14 +202,14 @@ struct __new_sigaction {
__new_sigset_t sa_mask;
};
#ifdef __KERNEL__
struct __new_sigaction32 {
unsigned sa_handler;
unsigned int sa_flags;
unsigned sa_restorer; /* not used by Linux/SPARC yet */
__new_sigset_t32 sa_mask;
compat_sigset_t sa_mask;
};
#ifdef __KERNEL__
struct k_sigaction {
struct __new_sigaction sa;
void *ka_restorer;
......@@ -234,12 +223,14 @@ struct __old_sigaction {
void (*sa_restorer)(void); /* not used by Linux/SPARC yet */
};
#ifdef __KERNEL__
struct __old_sigaction32 {
unsigned sa_handler;
__old_sigset_t32 sa_mask;
compat_old_sigset_t sa_mask;
unsigned int sa_flags;
unsigned sa_restorer; /* not used by Linux/SPARC yet */
};
#endif
typedef struct sigaltstack {
void *ss_sp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment