Commit 28f17428 authored by David S. Miller's avatar David S. Miller

Merge davem@nuts.ninka.net:/home/davem/src/BK/sparc-2.5

into kernel.bkbits.net:/home/davem/sparc-2.5
parents 5edf8b9a c9b6254d
......@@ -30,6 +30,7 @@ ifneq ($(IS_EGCS),y)
CFLAGS := $(CFLAGS) -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
else
CFLAGS := $(CFLAGS) -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
AFLAGS := $(AFLAGS) -m32
endif
#LDFLAGS_vmlinux = -N -Ttext 0xf0004000
......
This diff is collapsed.
......@@ -113,7 +113,7 @@ asmlinkage int sparc_pipe(struct pt_regs *regs)
* This is really horribly ugly.
*/
asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user *ptr, long fifth)
{
int version, err;
......@@ -123,7 +123,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
if (call <= SEMCTL)
switch (call) {
case SEMOP:
err = sys_semop (first, (struct sembuf *)ptr, second);
err = sys_semop (first, (struct sembuf __user *)ptr, second);
goto out;
case SEMGET:
err = sys_semget (first, second, third);
......@@ -134,7 +134,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
if (!ptr)
goto out;
err = -EFAULT;
if(get_user(fourth.__pad, (void **)ptr))
if(get_user(fourth.__pad, (void __user **)ptr))
goto out;
err = sys_semctl (first, second, third, fourth);
goto out;
......@@ -146,7 +146,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
if (call <= MSGCTL)
switch (call) {
case MSGSND:
err = sys_msgsnd (first, (struct msgbuf *) ptr,
err = sys_msgsnd (first, (struct msgbuf __user *) ptr,
second, third);
goto out;
case MSGRCV:
......@@ -157,7 +157,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
if (!ptr)
goto out;
err = -EFAULT;
if(copy_from_user(&tmp,(struct ipc_kludge *) ptr, sizeof (tmp)))
if (copy_from_user(&tmp, (struct ipc_kludge __user *) ptr, sizeof (tmp)))
goto out;
err = sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third);
goto out;
......@@ -170,7 +170,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
err = sys_msgget ((key_t) first, second);
goto out;
case MSGCTL:
err = sys_msgctl (first, second, (struct msqid_ds *) ptr);
err = sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
goto out;
default:
err = -ENOSYS;
......@@ -182,27 +182,27 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
switch (version) {
case 0: default: {
ulong raddr;
err = sys_shmat (first, (char *) ptr, second, &raddr);
err = sys_shmat (first, (char __user *) ptr, second, &raddr);
if (err)
goto out;
err = -EFAULT;
if(put_user (raddr, (ulong *) third))
if (put_user (raddr, (ulong __user *) third))
goto out;
err = 0;
goto out;
}
case 1: /* iBCS2 emulator entry point */
err = sys_shmat (first, (char *) ptr, second, (ulong *) third);
err = sys_shmat (first, (char __user *) ptr, second, (ulong __user *) third);
goto out;
}
case SHMDT:
err = sys_shmdt ((char *)ptr);
err = sys_shmdt ((char __user *)ptr);
goto out;
case SHMGET:
err = sys_shmget (first, second, third);
goto out;
case SHMCTL:
err = sys_shmctl (first, second, (struct shmid_ds *) ptr);
err = sys_shmctl (first, second, (struct shmid_ds __user *) ptr);
goto out;
default:
err = -ENOSYS;
......@@ -344,9 +344,11 @@ asmlinkage unsigned long
c_sys_nis_syscall (struct pt_regs *regs)
{
static int count = 0;
if (count++ > 5) return -ENOSYS;
printk ("%s[%d]: Unimplemented SPARC system call %d\n", current->comm, current->pid, (int)regs->u_regs[1]);
if (count++ > 5)
return -ENOSYS;
printk ("%s[%d]: Unimplemented SPARC system call %d\n",
current->comm, current->pid, (int)regs->u_regs[1]);
#ifdef DEBUG_UNIMP_SYSCALL
show_regs (regs);
#endif
......@@ -378,8 +380,8 @@ sparc_breakpoint (struct pt_regs *regs)
}
asmlinkage int
sparc_sigaction (int sig, const struct old_sigaction *act,
struct old_sigaction *oact)
sparc_sigaction (int sig, const struct old_sigaction __user *act,
struct old_sigaction __user *oact)
{
struct k_sigaction new_ka, old_ka;
int ret;
......@@ -422,8 +424,11 @@ sparc_sigaction (int sig, const struct old_sigaction *act,
}
asmlinkage int
sys_rt_sigaction(int sig, const struct sigaction *act, struct sigaction *oact,
void *restorer, size_t sigsetsize)
sys_rt_sigaction(int sig,
const struct sigaction __user *act,
struct sigaction __user *oact,
void __user *restorer,
size_t sigsetsize)
{
struct k_sigaction new_ka, old_ka;
int ret;
......@@ -453,7 +458,7 @@ sys_rt_sigaction(int sig, const struct sigaction *act, struct sigaction *oact,
return ret;
}
asmlinkage int sys_getdomainname(char *name, int len)
asmlinkage int sys_getdomainname(char __user *name, int len)
{
int nlen;
int err = -EFAULT;
......@@ -464,9 +469,9 @@ asmlinkage int sys_getdomainname(char *name, int len)
if (nlen < len)
len = nlen;
if(len > __NEW_UTS_LEN)
if (len > __NEW_UTS_LEN)
goto done;
if(copy_to_user(name, system_utsname.domainname, len))
if (copy_to_user(name, system_utsname.domainname, len))
goto done;
err = 0;
done:
......
This diff is collapsed.
......@@ -473,7 +473,7 @@ static unsigned long clone_stackframe(unsigned long csp, unsigned long psp)
distance = fp - psp;
rval = (csp - distance);
if (copy_in_user(rval, psp, distance))
if (copy_in_user((void __user *) rval, (void __user *) psp, distance))
rval = 0;
else if (test_thread_flag(TIF_32BIT)) {
if (put_user(((u32)csp), &(((struct reg_window32 *)rval)->ins[6])))
......
......@@ -42,8 +42,8 @@ static int do_signal(sigset_t *oldset, struct pt_regs * regs,
/* {set, get}context() needed for 64-bit SparcLinux userland. */
asmlinkage void sparc64_set_context(struct pt_regs *regs)
{
struct ucontext *ucp = (struct ucontext *) regs->u_regs[UREG_I0];
mc_gregset_t *grp;
struct ucontext *ucp = (struct ucontext __user *) regs->u_regs[UREG_I0];
mc_gregset_t __user *grp;
unsigned long pc, npc, tstate;
unsigned long fp, i7;
unsigned char fenab;
......@@ -104,9 +104,9 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs)
err |= __get_user(fp, &(ucp->uc_mcontext.mc_fp));
err |= __get_user(i7, &(ucp->uc_mcontext.mc_i7));
err |= __put_user(fp,
(&(((struct reg_window *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[6])));
(&(((struct reg_window __user *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[6])));
err |= __put_user(i7,
(&(((struct reg_window *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[7])));
(&(((struct reg_window __user *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[7])));
err |= __get_user(fenab, &(ucp->uc_mcontext.mc_fpregs.mcfpu_enab));
if (fenab) {
......@@ -121,7 +121,7 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs)
(sizeof(unsigned int) * 32));
if (fprs & FPRS_DU)
err |= copy_from_user(fpregs+16,
((unsigned long *)&(ucp->uc_mcontext.mc_fpregs.mcfpu_fregs))+16,
((unsigned long __user *)&(ucp->uc_mcontext.mc_fpregs.mcfpu_fregs))+16,
(sizeof(unsigned int) * 32));
err |= __get_user(current_thread_info()->xfsr[0],
&(ucp->uc_mcontext.mc_fpregs.mcfpu_fsr));
......@@ -139,9 +139,9 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs)
asmlinkage void sparc64_get_context(struct pt_regs *regs)
{
struct ucontext *ucp = (struct ucontext *) regs->u_regs[UREG_I0];
mc_gregset_t *grp;
mcontext_t *mcp;
struct ucontext *ucp = (struct ucontext __user *) regs->u_regs[UREG_I0];
mc_gregset_t __user *grp;
mcontext_t __user *mcp;
unsigned long fp, i7;
unsigned char fenab;
int err;
......@@ -170,7 +170,7 @@ asmlinkage void sparc64_get_context(struct pt_regs *regs)
err = 0;
if (_NSIG_WORDS == 1)
err |= __put_user(current->blocked.sig[0],
(unsigned long *)&ucp->uc_sigmask);
(unsigned long __user *)&ucp->uc_sigmask);
else
err |= __copy_to_user(&ucp->uc_sigmask, &current->blocked,
sizeof(sigset_t));
......@@ -196,9 +196,9 @@ asmlinkage void sparc64_get_context(struct pt_regs *regs)
err |= __put_user(regs->u_regs[UREG_I7], &((*grp)[MC_O7]));
err |= __get_user(fp,
(&(((struct reg_window *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[6])));
(&(((struct reg_window __user *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[6])));
err |= __get_user(i7,
(&(((struct reg_window *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[7])));
(&(((struct reg_window __user *)(STACK_BIAS+regs->u_regs[UREG_I6]))->ins[7])));
err |= __put_user(fp, &(mcp->mc_fp));
err |= __put_user(i7, &(mcp->mc_i7));
......@@ -213,7 +213,7 @@ asmlinkage void sparc64_get_context(struct pt_regs *regs)
(sizeof(unsigned int) * 32));
if (fprs & FPRS_DU)
err |= copy_to_user(
((unsigned long *)&(mcp->mc_fpregs.mcfpu_fregs))+16, fpregs+16,
((unsigned long __user *)&(mcp->mc_fpregs.mcfpu_fregs))+16, fpregs+16,
(sizeof(unsigned int) * 32));
err |= __put_user(current_thread_info()->xfsr[0], &(mcp->mc_fpregs.mcfpu_fsr));
err |= __put_user(current_thread_info()->gsr[0], &(mcp->mc_fpregs.mcfpu_gsr));
......@@ -231,7 +231,7 @@ struct rt_signal_frame {
struct sparc_stackf ss;
siginfo_t info;
struct pt_regs regs;
__siginfo_fpu_t * fpu_save;
__siginfo_fpu_t __user *fpu_save;
stack_t stack;
sigset_t mask;
__siginfo_fpu_t fpu_state;
......@@ -300,7 +300,7 @@ asmlinkage void do_sigsuspend(struct pt_regs *regs)
_sigpause_common(regs->u_regs[UREG_I0], regs);
}
asmlinkage void do_rt_sigsuspend(sigset_t *uset, size_t sigsetsize, struct pt_regs *regs)
asmlinkage void do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize, struct pt_regs *regs)
{
sigset_t oldset, set;
......@@ -351,7 +351,7 @@ asmlinkage void do_rt_sigsuspend(sigset_t *uset, size_t sigsetsize, struct pt_re
}
static inline int
restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t *fpu)
restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
{
unsigned long *fpregs = current_thread_info()->fpregs;
unsigned long fprs;
......@@ -374,16 +374,16 @@ restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t *fpu)
void do_rt_sigreturn(struct pt_regs *regs)
{
struct rt_signal_frame *sf;
struct rt_signal_frame __user *sf;
unsigned long tpc, tnpc, tstate;
__siginfo_fpu_t *fpu_save;
__siginfo_fpu_t __user *fpu_save;
mm_segment_t old_fs;
sigset_t set;
stack_t st;
int err;
synchronize_user_stack ();
sf = (struct rt_signal_frame *)
sf = (struct rt_signal_frame __user *)
(regs->u_regs [UREG_FP] + STACK_BIAS);
/* 1. Make sure we are not getting garbage from the user */
......@@ -438,7 +438,7 @@ void do_rt_sigreturn(struct pt_regs *regs)
}
/* Checks if the fp is valid */
static int invalid_frame_pointer(void *fp, int fplen)
static int invalid_frame_pointer(void __user *fp, int fplen)
{
if (((unsigned long) fp) & 7)
return 1;
......@@ -446,7 +446,7 @@ static int invalid_frame_pointer(void *fp, int fplen)
}
static inline int
save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t *fpu)
save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
{
unsigned long *fpregs = (unsigned long *)(regs+1);
unsigned long fprs;
......@@ -466,7 +466,7 @@ save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t *fpu)
return err;
}
static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, unsigned long framesize)
static inline void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, unsigned long framesize)
{
unsigned long sp;
......@@ -478,14 +478,14 @@ static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, u
!((current->sas_ss_sp + current->sas_ss_size) & 7))
sp = current->sas_ss_sp + current->sas_ss_size;
}
return (void *)(sp - framesize);
return (void __user *)(sp - framesize);
}
static inline void
setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
int signo, sigset_t *oldset, siginfo_t *info)
{
struct rt_signal_frame *sf;
struct rt_signal_frame __user *sf;
int sigframe_size, err;
/* 1. Make sure everything is clean */
......@@ -496,7 +496,8 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
if (!(current_thread_info()->fpsaved[0] & FPRS_FEF))
sigframe_size -= sizeof(__siginfo_fpu_t);
sf = (struct rt_signal_frame *)get_sigframe(ka, regs, sigframe_size);
sf = (struct rt_signal_frame __user *)
get_sigframe(ka, regs, sigframe_size);
if (invalid_frame_pointer (sf, sigframe_size))
goto sigill;
......@@ -521,8 +522,8 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
err |= copy_to_user(&sf->mask, oldset, sizeof(sigset_t));
err |= copy_in_user((u64 *)sf,
(u64 *)(regs->u_regs[UREG_FP]+STACK_BIAS),
err |= copy_in_user((u64 __user *)sf,
(u64 __user *)(regs->u_regs[UREG_FP]+STACK_BIAS),
sizeof(struct reg_window));
if (info)
......@@ -560,7 +561,8 @@ static inline void handle_signal(unsigned long signr, struct k_sigaction *ka,
siginfo_t *info,
sigset_t *oldset, struct pt_regs *regs)
{
setup_rt_frame(ka, regs, signr, oldset, (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL);
setup_rt_frame(ka, regs, signr, oldset,
(ka->sa.sa_flags & SA_SIGINFO) ? info : NULL);
if (ka->sa.sa_flags & SA_ONESHOT)
ka->sa.sa_handler = SIG_DFL;
if (!(ka->sa.sa_flags & SA_NOMASK)) {
......
This diff is collapsed.
......@@ -245,9 +245,9 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir
return err;
}
extern asmlinkage int sys_newuname(struct new_utsname * name);
extern asmlinkage int sys_newuname(struct new_utsname __user *name);
asmlinkage int sparc64_newuname(struct new_utsname * name)
asmlinkage int sparc64_newuname(struct new_utsname __user *name)
{
int ret = sys_newuname(name);
......@@ -421,7 +421,7 @@ sparc_breakpoint (struct pt_regs *regs)
extern void check_pending(int signum);
asmlinkage int sys_getdomainname(char *name, int len)
asmlinkage int sys_getdomainname(char __user *name, int len)
{
int nlen;
int err = -EFAULT;
......@@ -432,9 +432,9 @@ asmlinkage int sys_getdomainname(char *name, int len)
if (nlen < len)
len = nlen;
if(len > __NEW_UTS_LEN)
if (len > __NEW_UTS_LEN)
goto done;
if(copy_to_user(name, system_utsname.domainname, len))
if (copy_to_user(name, system_utsname.domainname, len))
goto done;
err = 0;
done:
......@@ -458,7 +458,7 @@ asmlinkage int solaris_syscall(struct pt_regs *regs)
regs->tpc &= 0xffffffff;
regs->tnpc &= 0xffffffff;
}
if(++count <= 5) {
if (++count <= 5) {
printk ("For Solaris binary emulation you need solaris module loaded\n");
show_regs (regs);
}
......@@ -478,7 +478,7 @@ asmlinkage int sunos_syscall(struct pt_regs *regs)
regs->tpc &= 0xffffffff;
regs->tnpc &= 0xffffffff;
}
if(++count <= 20)
if (++count <= 20)
printk ("SunOS binary emulation not compiled in\n");
force_sig(SIGSEGV, current);
......@@ -486,9 +486,11 @@ asmlinkage int sunos_syscall(struct pt_regs *regs)
}
#endif
asmlinkage int sys_utrap_install(utrap_entry_t type, utrap_handler_t new_p,
asmlinkage int sys_utrap_install(utrap_entry_t type,
utrap_handler_t new_p,
utrap_handler_t new_d,
utrap_handler_t *old_p, utrap_handler_t *old_d)
utrap_handler_t __user *old_p,
utrap_handler_t __user *old_d)
{
if (type < UT_INSTRUCTION_EXCEPTION || type > UT_TRAP_INSTRUCTION_31)
return -EINVAL;
......@@ -511,9 +513,11 @@ asmlinkage int sys_utrap_install(utrap_entry_t type, utrap_handler_t new_p,
if (!current_thread_info()->utraps) {
current_thread_info()->utraps =
kmalloc((UT_TRAP_INSTRUCTION_31+1)*sizeof(long), GFP_KERNEL);
if (!current_thread_info()->utraps) return -ENOMEM;
if (!current_thread_info()->utraps)
return -ENOMEM;
current_thread_info()->utraps[0] = 1;
memset(current_thread_info()->utraps+1, 0, UT_TRAP_INSTRUCTION_31*sizeof(long));
memset(current_thread_info()->utraps+1, 0,
UT_TRAP_INSTRUCTION_31*sizeof(long));
} else {
if ((utrap_handler_t)current_thread_info()->utraps[type] != new_p &&
current_thread_info()->utraps[0] > 1) {
......
#ifndef _ASM_GENERIC_SIGINFO_H
#define _ASM_GENERIC_SIGINFO_H
#include <linux/compiler.h>
#include <linux/types.h>
typedef union sigval {
......
......@@ -118,10 +118,10 @@ struct sigstack {
};
/* Sigvec flags */
#define SV_SSTACK 1 /* This signal handler should use sig-stack */
#define SV_INTR 2 /* Sig return should not restart system call */
#define SV_RESET 4 /* Set handler to SIG_DFL upon taken signal */
#define SV_IGNCHILD 8 /* Do not send SIGCHLD */
#define SV_SSTACK 1u /* This signal handler should use sig-stack */
#define SV_INTR 2u /* Sig return should not restart system call */
#define SV_RESET 4u /* Set handler to SIG_DFL upon taken signal */
#define SV_IGNCHILD 8u /* Do not send SIGCHLD */
/*
* sa_flags values: SA_STACK is not currently supported, but will allow the
......@@ -137,11 +137,11 @@ struct sigstack {
#define SA_ONSTACK SV_SSTACK
#define SA_RESTART SV_INTR
#define SA_ONESHOT SV_RESET
#define SA_INTERRUPT 0x10
#define SA_NOMASK 0x20
#define SA_SHIRQ 0x40
#define SA_NOCLDWAIT 0x100
#define SA_SIGINFO 0x200
#define SA_INTERRUPT 0x10u
#define SA_NOMASK 0x20u
#define SA_SHIRQ 0x40u
#define SA_NOCLDWAIT 0x100u
#define SA_SIGINFO 0x200u
#define SIG_BLOCK 0x01 /* for blocking signals */
#define SIG_UNBLOCK 0x02 /* for unblocking signals */
......
......@@ -8,6 +8,7 @@
#define _ASM_UACCESS_H
#ifdef __KERNEL__
#include <linux/compiler.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/errno.h>
......@@ -45,7 +46,7 @@
#define __access_ok(addr,size) (__user_ok((addr) & get_fs().seg,(size)))
#define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size))
extern inline int verify_area(int type, const void * addr, unsigned long size)
static inline int verify_area(int type, const void __user * addr, unsigned long size)
{
return access_ok(type,addr,size)?0:-EFAULT;
}
......@@ -291,87 +292,87 @@ __asm__ __volatile__( \
extern int __get_user_bad(void);
extern __kernel_size_t __copy_user(void *to, void *from, __kernel_size_t size);
#define copy_to_user(to,from,n) ({ \
void *__copy_to = (void *) (to); \
__kernel_size_t __copy_size = (__kernel_size_t) (n); \
__kernel_size_t __copy_res; \
if(__copy_size && __access_ok((unsigned long)__copy_to, __copy_size)) { \
__copy_res = __copy_user(__copy_to, (void *) (from), __copy_size); \
} else __copy_res = __copy_size; \
__copy_res; })
#define __copy_to_user(to,from,n) \
__copy_user((void *)(to), \
(void *)(from), n)
#define copy_from_user(to,from,n) ({ \
void *__copy_to = (void *) (to); \
void *__copy_from = (void *) (from); \
__kernel_size_t __copy_size = (__kernel_size_t) (n); \
__kernel_size_t __copy_res; \
if(__copy_size && __access_ok((unsigned long)__copy_from, __copy_size)) { \
__copy_res = __copy_user(__copy_to, __copy_from, __copy_size); \
} else __copy_res = __copy_size; \
__copy_res; })
#define __copy_from_user(to,from,n) \
__copy_user((void *)(to), \
(void *)(from), n)
extern __inline__ __kernel_size_t __clear_user(void *addr, __kernel_size_t size)
extern unsigned long __copy_user(void *to, const void *from, unsigned long size);
static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)
{
__kernel_size_t ret;
__asm__ __volatile__ (
".section __ex_table,#alloc\n\t"
".align 4\n\t"
".word 1f,3\n\t"
".previous\n\t"
"mov %2, %%o1\n"
"1:\n\t"
"call __bzero\n\t"
" mov %1, %%o0\n\t"
"mov %%o0, %0\n"
: "=r" (ret) : "r" (addr), "r" (size) :
"o0", "o1", "o2", "o3", "o4", "o5", "o7",
"g1", "g2", "g3", "g4", "g5", "g7", "cc");
return ret;
if (n && __access_ok((unsigned long) to, n))
return __copy_user((void *) to, from, n);
else
return n;
}
#define clear_user(addr,n) ({ \
void *__clear_addr = (void *) (addr); \
__kernel_size_t __clear_size = (__kernel_size_t) (n); \
__kernel_size_t __clear_res; \
if(__clear_size && __access_ok((unsigned long)__clear_addr, __clear_size)) { \
__clear_res = __clear_user(__clear_addr, __clear_size); \
} else __clear_res = __clear_size; \
__clear_res; })
extern int __strncpy_from_user(unsigned long dest, unsigned long src, int count);
#define strncpy_from_user(dest,src,count) ({ \
unsigned long __sfu_src = (unsigned long) (src); \
int __sfu_count = (int) (count); \
long __sfu_res = -EFAULT; \
if(__access_ok(__sfu_src, __sfu_count)) { \
__sfu_res = __strncpy_from_user((unsigned long) (dest), __sfu_src, __sfu_count); \
} __sfu_res; })
extern int __strlen_user(const char *);
extern int __strnlen_user(const char *, long len);
extern __inline__ int strlen_user(const char *str)
static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n)
{
return __copy_user((void *)to, from, n);
}
static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
{
if (n && __access_ok((unsigned long) from, n))
return __copy_user(to, (void *) from, n);
else
return n;
}
static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)
{
return __copy_user(to, (void *)from, n);
}
static inline unsigned long __clear_user(void __user *addr, unsigned long size)
{
unsigned long ret;
__asm__ __volatile__ (
".section __ex_table,#alloc\n\t"
".align 4\n\t"
".word 1f,3\n\t"
".previous\n\t"
"mov %2, %%o1\n"
"1:\n\t"
"call __bzero\n\t"
" mov %1, %%o0\n\t"
"mov %%o0, %0\n"
: "=r" (ret) : "r" (addr), "r" (size) :
"o0", "o1", "o2", "o3", "o4", "o5", "o7",
"g1", "g2", "g3", "g4", "g5", "g7", "cc");
return ret;
}
static inline unsigned long clear_user(void __user *addr, unsigned long n)
{
if (n && __access_ok((unsigned long) addr, n))
return __clear_user(addr, n);
else
return n;
}
extern long __strncpy_from_user(char *dest, const char __user *src, long count);
static inline long strncpy_from_user(char *dest, const char __user *src, long count)
{
if (__access_ok((unsigned long) src, count))
return __strncpy_from_user(dest, src, count);
else
return -EFAULT;
}
extern long __strlen_user(const char __user *);
extern long __strnlen_user(const char __user *, long len);
static inline long strlen_user(const char __user *str)
{
if(!access_ok(VERIFY_READ, str, 0))
if (!access_ok(VERIFY_READ, str, 0))
return 0;
else
return __strlen_user(str);
}
extern __inline__ int strnlen_user(const char *str, long len)
static inline long strnlen_user(const char __user *str, long len)
{
if(!access_ok(VERIFY_READ, str, 0))
if (!access_ok(VERIFY_READ, str, 0))
return 0;
else
return __strnlen_user(str, len);
......
......@@ -123,10 +123,10 @@ struct sigstack {
};
/* Sigvec flags */
#define SV_SSTACK 1 /* This signal handler should use sig-stack */
#define SV_INTR 2 /* Sig return should not restart system call */
#define SV_RESET 4 /* Set handler to SIG_DFL upon taken signal */
#define SV_IGNCHILD 8 /* Do not send SIGCHLD */
#define SV_SSTACK 1u /* This signal handler should use sig-stack */
#define SV_INTR 2u /* Sig return should not restart system call */
#define SV_RESET 4u /* Set handler to SIG_DFL upon taken signal */
#define SV_IGNCHILD 8u /* Do not send SIGCHLD */
/*
* sa_flags values: SA_STACK is not currently supported, but will allow the
......@@ -142,11 +142,11 @@ struct sigstack {
#define SA_ONSTACK SV_SSTACK
#define SA_RESTART SV_INTR
#define SA_ONESHOT SV_RESET
#define SA_INTERRUPT 0x10
#define SA_NOMASK 0x20
#define SA_SHIRQ 0x40
#define SA_NOCLDWAIT 0x100
#define SA_SIGINFO 0x200
#define SA_INTERRUPT 0x10u
#define SA_NOMASK 0x20u
#define SA_SHIRQ 0x40u
#define SA_NOCLDWAIT 0x100u
#define SA_SIGINFO 0x200u
#define SIG_BLOCK 0x01 /* for blocking signals */
......
......@@ -7,6 +7,7 @@
*/
#ifdef __KERNEL__
#include <linux/compiler.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <asm/a.out.h>
......@@ -52,7 +53,7 @@ do { \
#define __access_ok(addr,size) 1
#define access_ok(type,addr,size) 1
static inline int verify_area(int type, const void * addr, unsigned long size)
static inline int verify_area(int type, const void __user * addr, unsigned long size)
{
return 0;
}
......@@ -249,44 +250,34 @@ __asm__ __volatile__( \
extern int __get_user_bad(void);
extern __kernel_size_t __copy_from_user(void *to, const void *from,
__kernel_size_t size);
extern unsigned long __copy_from_user(void *to, const void __user *from,
unsigned long size);
extern __kernel_size_t __copy_to_user(void *to, const void *from,
__kernel_size_t size);
extern unsigned long __copy_to_user(void __user *to, const void *from,
unsigned long size);
extern __kernel_size_t __copy_in_user(void *to, const void *from,
__kernel_size_t size);
extern unsigned long __copy_in_user(void __user *to, const void __user *from,
unsigned long size);
#define copy_from_user(to,from,n) \
__copy_from_user((void *)(to), \
(void *)(from), (__kernel_size_t)(n))
#define copy_from_user __copy_from_user
#define copy_to_user __copy_to_user
#define copy_in_user __copy_in_user
#define copy_to_user(to,from,n) \
__copy_to_user((void *)(to), \
(void *) (from), (__kernel_size_t)(n))
#define copy_in_user(to,from,n) \
__copy_in_user((void *)(to), \
(void *) (from), (__kernel_size_t)(n))
static __inline__ __kernel_size_t __clear_user(void *addr, __kernel_size_t size)
static inline unsigned long __clear_user(void __user *addr, unsigned long size)
{
extern __kernel_size_t __bzero_noasi(void *addr, __kernel_size_t size);
extern unsigned long __bzero_noasi(void *addr, unsigned long size);
return __bzero_noasi(addr, size);
return __bzero_noasi((void *) addr, size);
}
#define clear_user(addr,n) \
__clear_user((void *)(addr), (__kernel_size_t)(n))
#define clear_user __clear_user
extern int __strncpy_from_user(unsigned long dest, unsigned long src, int count);
extern long __strncpy_from_user(char *dest, const char __user *src, long count);
#define strncpy_from_user(dest,src,count) \
__strncpy_from_user((unsigned long)(dest), (unsigned long)(src), (int)(count))
#define strncpy_from_user __strncpy_from_user
extern int __strlen_user(const char *);
extern int __strnlen_user(const char *, long len);
extern long __strlen_user(const char __user *);
extern long __strnlen_user(const char __user *, long len);
#define strlen_user __strlen_user
#define strnlen_user __strnlen_user
......
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