Commit 52d9bf0b authored by Linus Torvalds's avatar Linus Torvalds

Merge http://lia64.bkbits.net/linux-ia64-release-2.6.9

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents 1c507e20 2e68d82e
......@@ -13,6 +13,8 @@ READELF := $(CROSS_COMPILE)readelf
export AWK
CHECKFLAGS += -m64 -D__ia64=1 -D__ia64__=1 -D_LP64 -D__LP64__
OBJCOPYFLAGS := --strip-all
LDFLAGS_vmlinux := -static
LDFLAGS_MODULE += -T $(srctree)/arch/ia64/module.lds
......@@ -24,8 +26,8 @@ cflags-y := -pipe $(EXTRA) -ffixed-r13 -mfixed-range=f12-f15,f32-f127 \
CFLAGS_KERNEL := -mconstant-gp
GCC_VERSION := $(call cc-version)
GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas $(CC) $(OBJDUMP))
CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags $(CC) $(OBJDUMP) $(READELF))
GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas "$(CC)" "$(OBJDUMP)")
CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags "$(CC)" "$(OBJDUMP)" "$(READELF)")
ifeq ($(GAS_STATUS),buggy)
$(error Sorry, you need a newer version of the assember, one that is built from \
......
......@@ -191,7 +191,7 @@ static unsigned long iovp_shift;
static unsigned long iovp_mask;
struct ioc {
void *ioc_hpa; /* I/O MMU base address */
void __iomem *ioc_hpa; /* I/O MMU base address */
char *res_map; /* resource map, bit == pdir entry */
u64 *pdir_base; /* physical base address */
unsigned long ibase; /* pdir IOV Space base */
......@@ -1153,7 +1153,7 @@ sba_fill_pdir(
{
struct scatterlist *dma_sg = startsg; /* pointer to current DMA */
int n_mappings = 0;
u64 *pdirp = 0;
u64 *pdirp = NULL;
unsigned long dma_offset = 0;
dma_sg--;
......@@ -1875,7 +1875,7 @@ ioc_proc_init(void)
{
struct proc_dir_entry *dir, *entry;
dir = proc_mkdir("bus/mckinley", 0);
dir = proc_mkdir("bus/mckinley", NULL);
if (!dir)
return;
......
......@@ -103,11 +103,15 @@ static inline int
elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpregset_t *fpu)
{
struct ia32_user_i387_struct *fpstate = (void*)fpu;
mm_segment_t old_fs;
if (!tsk->used_math)
return 0;
save_ia32_fpstate(tsk, fpstate);
old_fs = get_fs();
set_fs(KERNEL_DS);
save_ia32_fpstate(tsk, (struct ia32_user_i387_struct __user *) fpstate);
set_fs(old_fs);
return 1;
}
......@@ -117,11 +121,15 @@ static inline int
elf_core_copy_task_xfpregs(struct task_struct *tsk, elf_fpxregset_t *xfpu)
{
struct ia32_user_fxsr_struct *fpxstate = (void*) xfpu;
mm_segment_t old_fs;
if (!tsk->used_math)
return 0;
save_ia32_fpxstate(tsk, fpxstate);
old_fs = get_fs();
set_fs(KERNEL_DS);
save_ia32_fpxstate(tsk, (struct ia32_user_fxsr_struct __user *) fpxstate);
set_fs(old_fs);
return 1;
}
......
......@@ -493,6 +493,8 @@ ia32_syscall_table:
data8 compat_sys_mq_timedreceive /* 280 */
data8 compat_sys_mq_notify
data8 compat_sys_mq_getsetattr
data8 sys_ni_syscall /* reserved for kexec */
data8 sys32_waitid
// guard against failures to increase IA32_NR_syscalls
.org ia32_syscall_table + 8*IA32_NR_syscalls
/*
* Copyright (C) 2001 Hewlett-Packard Co
* Copyright (C) 2001, 2004 Hewlett-Packard Co
* David Mosberger-Tang <davidm@hpl.hp.com>
*
* Adapted from arch/i386/kernel/ldt.c
......@@ -17,25 +17,24 @@
#include "ia32priv.h"
#define P(p) ((void *) (unsigned long) (p))
/*
* read_ldt() is not really atomic - this is not a problem since synchronization of reads
* and writes done to the LDT has to be assured by user-space anyway. Writes are atomic,
* to protect the security checks done on new descriptors.
*/
static int
read_ldt (void *ptr, unsigned long bytecount)
read_ldt (void __user *ptr, unsigned long bytecount)
{
char *src, *dst, buf[256]; /* temporary buffer (don't overflow kernel stack!) */
unsigned long bytes_left, n;
char __user *src, *dst;
char buf[256]; /* temporary buffer (don't overflow kernel stack!) */
if (bytecount > IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE)
bytecount = IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE;
bytes_left = bytecount;
src = (void *) IA32_LDT_OFFSET;
src = (void __user *) IA32_LDT_OFFSET;
dst = ptr;
while (bytes_left) {
......@@ -61,7 +60,7 @@ read_ldt (void *ptr, unsigned long bytecount)
}
static int
read_default_ldt (void * ptr, unsigned long bytecount)
read_default_ldt (void __user * ptr, unsigned long bytecount)
{
unsigned long size;
int err;
......@@ -80,7 +79,7 @@ read_default_ldt (void * ptr, unsigned long bytecount)
}
static int
write_ldt (void * ptr, unsigned long bytecount, int oldmode)
write_ldt (void __user * ptr, unsigned long bytecount, int oldmode)
{
struct ia32_user_desc ldt_info;
__u64 entry;
......@@ -120,7 +119,7 @@ write_ldt (void * ptr, unsigned long bytecount, int oldmode)
* memory, but we still need to guard against out-of-memory, hence we must use
* put_user().
*/
ret = __put_user(entry, (__u64 *) IA32_LDT_OFFSET + ldt_info.entry_number);
ret = __put_user(entry, (__u64 __user *) IA32_LDT_OFFSET + ldt_info.entry_number);
ia32_load_segment_descriptors(current);
return ret;
}
......@@ -132,16 +131,16 @@ sys32_modify_ldt (int func, unsigned int ptr, unsigned int bytecount)
switch (func) {
case 0:
ret = read_ldt(P(ptr), bytecount);
ret = read_ldt(compat_ptr(ptr), bytecount);
break;
case 1:
ret = write_ldt(P(ptr), bytecount, 1);
ret = write_ldt(compat_ptr(ptr), bytecount, 1);
break;
case 2:
ret = read_default_ldt(P(ptr), bytecount);
ret = read_default_ldt(compat_ptr(ptr), bytecount);
break;
case 0x11:
ret = write_ldt(P(ptr), bytecount, 0);
ret = write_ldt(compat_ptr(ptr), bytecount, 0);
break;
}
return ret;
......
......@@ -66,7 +66,7 @@ struct rt_sigframe_ia32
};
int
copy_siginfo_from_user32 (siginfo_t *to, siginfo_t32 *from)
copy_siginfo_from_user32 (siginfo_t *to, siginfo_t32 __user *from)
{
unsigned long tmp;
int err;
......@@ -78,10 +78,10 @@ copy_siginfo_from_user32 (siginfo_t *to, siginfo_t32 *from)
err |= __get_user(to->si_errno, &from->si_errno);
err |= __get_user(to->si_code, &from->si_code);
if (from->si_code < 0)
if (to->si_code < 0)
err |= __copy_from_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
else {
switch (from->si_code >> 16) {
switch (to->si_code >> 16) {
case __SI_CHLD >> 16:
err |= __get_user(to->si_utime, &from->si_utime);
err |= __get_user(to->si_stime, &from->si_stime);
......@@ -92,7 +92,7 @@ copy_siginfo_from_user32 (siginfo_t *to, siginfo_t32 *from)
break;
case __SI_FAULT >> 16:
err |= __get_user(tmp, &from->si_addr);
to->si_addr = (void *) tmp;
to->si_addr = (void __user *) tmp;
break;
case __SI_POLL >> 16:
err |= __get_user(to->si_band, &from->si_band);
......@@ -110,7 +110,7 @@ copy_siginfo_from_user32 (siginfo_t *to, siginfo_t32 *from)
}
int
copy_siginfo_to_user32 (siginfo_t32 *to, siginfo_t *from)
copy_siginfo_to_user32 (siginfo_t32 __user *to, siginfo_t *from)
{
unsigned int addr;
int err;
......@@ -141,7 +141,8 @@ copy_siginfo_to_user32 (siginfo_t32 *to, siginfo_t *from)
err |= __put_user(from->si_uid, &to->si_uid);
break;
case __SI_FAULT >> 16:
err |= __put_user((long)from->si_addr, &to->si_addr);
/* avoid type-checking warnings by copying _pad[0] in lieu of si_addr... */
err |= __put_user(from->_sifields._pad[0], &to->si_addr);
break;
case __SI_POLL >> 16:
err |= __put_user(from->si_band, &to->si_band);
......@@ -202,7 +203,7 @@ copy_siginfo_to_user32 (siginfo_t32 *to, siginfo_t *from)
*/
static int
save_ia32_fpstate_live (struct _fpstate_ia32 *save)
save_ia32_fpstate_live (struct _fpstate_ia32 __user *save)
{
struct task_struct *tsk = current;
struct pt_regs *ptp;
......@@ -310,7 +311,7 @@ save_ia32_fpstate_live (struct _fpstate_ia32 *save)
}
static int
restore_ia32_fpstate_live (struct _fpstate_ia32 *save)
restore_ia32_fpstate_live (struct _fpstate_ia32 __user *save)
{
struct task_struct *tsk = current;
struct pt_regs *ptp;
......@@ -339,37 +340,37 @@ restore_ia32_fpstate_live (struct _fpstate_ia32 *save)
fir = ia64_getreg(_IA64_REG_AR_FIR);
fdr = ia64_getreg(_IA64_REG_AR_FDR);
__get_user(mxcsr, (unsigned int *)&save->mxcsr);
__get_user(mxcsr, (unsigned int __user *)&save->mxcsr);
/* setting bits 0..5 8..12 with cw and 39..47 from mxcsr */
__get_user(lo, (unsigned int *)&save->cw);
__get_user(lo, (unsigned int __user *)&save->cw);
num64 = mxcsr & 0xff10;
num64 = (num64 << 32) | (lo & 0x1f3f);
fcr = (fcr & (~0xff1000001f3f)) | num64;
fcr = (fcr & (~0xff1000001f3fUL)) | num64;
/* setting bits 0..31 with sw and tag and 32..37 from mxcsr */
__get_user(lo, (unsigned int *)&save->sw);
__get_user(lo, (unsigned int __user *)&save->sw);
/* set bits 15,7 (fsw.b, fsw.es) to reflect the current error status */
if ( !(lo & 0x7f) )
lo &= (~0x8080);
__get_user(hi, (unsigned int *)&save->tag);
__get_user(hi, (unsigned int __user *)&save->tag);
num64 = mxcsr & 0x3f;
num64 = (num64 << 16) | (hi & 0xffff);
num64 = (num64 << 16) | (lo & 0xffff);
fsr = (fsr & (~0x3fffffffff)) | num64;
fsr = (fsr & (~0x3fffffffffUL)) | num64;
/* setting bits 0..47 with cssel and ipoff */
__get_user(lo, (unsigned int *)&save->ipoff);
__get_user(hi, (unsigned int *)&save->cssel);
__get_user(lo, (unsigned int __user *)&save->ipoff);
__get_user(hi, (unsigned int __user *)&save->cssel);
num64 = hi & 0xffff;
num64 = (num64 << 32) | lo;
fir = (fir & (~0xffffffffffff)) | num64;
fir = (fir & (~0xffffffffffffUL)) | num64;
/* setting bits 0..47 with datasel and dataoff */
__get_user(lo, (unsigned int *)&save->dataoff);
__get_user(hi, (unsigned int *)&save->datasel);
__get_user(lo, (unsigned int __user *)&save->dataoff);
__get_user(hi, (unsigned int __user *)&save->datasel);
num64 = hi & 0xffff;
num64 = (num64 << 32) | lo;
fdr = (fdr & (~0xffffffffffff)) | num64;
fdr = (fdr & (~0xffffffffffffUL)) | num64;
ia64_setreg(_IA64_REG_AR_FSR, fsr);
ia64_setreg(_IA64_REG_AR_FCR, fcr);
......@@ -452,8 +453,8 @@ sigact_set_handler (struct k_sigaction *sa, unsigned int handler, unsigned int r
sa->sa.sa_handler = (__sighandler_t) (((unsigned long) restorer << 32) | handler);
}
asmlinkage long
ia32_rt_sigsuspend (compat_sigset_t *uset, unsigned int sigsetsize, struct sigscratch *scr)
long
__ia32_rt_sigsuspend (compat_sigset_t *sset, unsigned int sigsetsize, struct sigscratch *scr)
{
extern long ia64_do_signal (sigset_t *oldset, struct sigscratch *scr, long in_syscall);
sigset_t oldset, set;
......@@ -461,10 +462,7 @@ ia32_rt_sigsuspend (compat_sigset_t *uset, unsigned int sigsetsize, struct sigsc
scr->scratch_unat = 0; /* avoid leaking kernel bits to user level */
memset(&set, 0, sizeof(&set));
if (sigsetsize > sizeof(sigset_t))
return -EINVAL;
if (copy_from_user(&set.sig, &uset->sig, sigsetsize))
if (memcpy(&set.sig, &sset->sig, sigsetsize))
return -EFAULT;
sigdelsetmask(&set, ~_BLOCKABLE);
......@@ -491,10 +489,24 @@ ia32_rt_sigsuspend (compat_sigset_t *uset, unsigned int sigsetsize, struct sigsc
}
}
asmlinkage long
ia32_rt_sigsuspend (compat_sigset_t __user *uset, unsigned int sigsetsize, struct sigscratch *scr)
{
compat_sigset_t set;
if (sigsetsize > sizeof(compat_sigset_t))
return -EINVAL;
if (copy_from_user(&set.sig, &uset->sig, sigsetsize))
return -EFAULT;
return __ia32_rt_sigsuspend(&set, sigsetsize, scr);
}
asmlinkage long
ia32_sigsuspend (unsigned int mask, struct sigscratch *scr)
{
return ia32_rt_sigsuspend((compat_sigset_t *)&mask, sizeof(mask), scr);
return __ia32_rt_sigsuspend((compat_sigset_t *) &mask, sizeof(mask), scr);
}
asmlinkage long
......@@ -512,8 +524,8 @@ sys32_signal (int sig, unsigned int handler)
}
asmlinkage long
sys32_rt_sigaction (int sig, struct sigaction32 *act,
struct sigaction32 *oact, unsigned int sigsetsize)
sys32_rt_sigaction (int sig, struct sigaction32 __user *act,
struct sigaction32 __user *oact, unsigned int sigsetsize)
{
struct k_sigaction new_ka, old_ka;
unsigned int handler, restorer;
......@@ -547,7 +559,8 @@ sys32_rt_sigaction (int sig, struct sigaction32 *act,
asmlinkage long
sys32_rt_sigprocmask (int how, compat_sigset_t *set, compat_sigset_t *oset, unsigned int sigsetsize)
sys32_rt_sigprocmask (int how, compat_sigset_t __user *set, compat_sigset_t __user *oset,
unsigned int sigsetsize)
{
mm_segment_t old_fs = get_fs();
sigset_t s;
......@@ -562,7 +575,9 @@ sys32_rt_sigprocmask (int how, compat_sigset_t *set, compat_sigset_t *oset, unsi
return -EFAULT;
}
set_fs(KERNEL_DS);
ret = sys_rt_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL, sizeof(s));
ret = sys_rt_sigprocmask(how,
set ? (sigset_t __user *) &s : NULL,
oset ? (sigset_t __user *) &s : NULL, sizeof(s));
set_fs(old_fs);
if (ret)
return ret;
......@@ -574,10 +589,9 @@ sys32_rt_sigprocmask (int how, compat_sigset_t *set, compat_sigset_t *oset, unsi
}
asmlinkage long
sys32_rt_sigtimedwait (compat_sigset_t *uthese, siginfo_t32 *uinfo,
struct compat_timespec *uts, unsigned int sigsetsize)
sys32_rt_sigtimedwait (compat_sigset_t __user *uthese, siginfo_t32 __user *uinfo,
struct compat_timespec __user *uts, unsigned int sigsetsize)
{
extern int copy_siginfo_to_user32 (siginfo_t32 *, siginfo_t *);
mm_segment_t old_fs = get_fs();
struct timespec t;
siginfo_t info;
......@@ -589,8 +603,10 @@ sys32_rt_sigtimedwait (compat_sigset_t *uthese, siginfo_t32 *uinfo,
if (uts && get_compat_timespec(&t, uts))
return -EFAULT;
set_fs(KERNEL_DS);
ret = sys_rt_sigtimedwait(&s, uinfo ? &info : NULL, uts ? &t : NULL,
sigsetsize);
ret = sys_rt_sigtimedwait((sigset_t __user *) &s,
uinfo ? (siginfo_t __user *) &info : NULL,
uts ? (struct timespec __user *) &t : NULL,
sigsetsize);
set_fs(old_fs);
if (ret >= 0 && uinfo) {
if (copy_siginfo_to_user32(uinfo, &info))
......@@ -600,7 +616,7 @@ sys32_rt_sigtimedwait (compat_sigset_t *uthese, siginfo_t32 *uinfo,
}
asmlinkage long
sys32_rt_sigqueueinfo (int pid, int sig, siginfo_t32 *uinfo)
sys32_rt_sigqueueinfo (int pid, int sig, siginfo_t32 __user *uinfo)
{
mm_segment_t old_fs = get_fs();
siginfo_t info;
......@@ -609,13 +625,13 @@ sys32_rt_sigqueueinfo (int pid, int sig, siginfo_t32 *uinfo)
if (copy_siginfo_from_user32(&info, uinfo))
return -EFAULT;
set_fs(KERNEL_DS);
ret = sys_rt_sigqueueinfo(pid, sig, &info);
ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *) &info);
set_fs(old_fs);
return ret;
}
asmlinkage long
sys32_sigaction (int sig, struct old_sigaction32 *act, struct old_sigaction32 *oact)
sys32_sigaction (int sig, struct old_sigaction32 __user *act, struct old_sigaction32 __user *oact)
{
struct k_sigaction new_ka, old_ka;
unsigned int handler, restorer;
......@@ -648,7 +664,7 @@ sys32_sigaction (int sig, struct old_sigaction32 *act, struct old_sigaction32 *o
}
static int
setup_sigcontext_ia32 (struct sigcontext_ia32 *sc, struct _fpstate_ia32 *fpstate,
setup_sigcontext_ia32 (struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __user *fpstate,
struct pt_regs *regs, unsigned long mask)
{
int err = 0;
......@@ -657,10 +673,10 @@ setup_sigcontext_ia32 (struct sigcontext_ia32 *sc, struct _fpstate_ia32 *fpstate
if (!access_ok(VERIFY_WRITE, sc, sizeof(*sc)))
return -EFAULT;
err |= __put_user((regs->r16 >> 32) & 0xffff, (unsigned int *)&sc->fs);
err |= __put_user((regs->r16 >> 48) & 0xffff, (unsigned int *)&sc->gs);
err |= __put_user((regs->r16 >> 16) & 0xffff, (unsigned int *)&sc->es);
err |= __put_user(regs->r16 & 0xffff, (unsigned int *)&sc->ds);
err |= __put_user((regs->r16 >> 32) & 0xffff, (unsigned int __user *)&sc->fs);
err |= __put_user((regs->r16 >> 48) & 0xffff, (unsigned int __user *)&sc->gs);
err |= __put_user((regs->r16 >> 16) & 0xffff, (unsigned int __user *)&sc->es);
err |= __put_user(regs->r16 & 0xffff, (unsigned int __user *)&sc->ds);
err |= __put_user(regs->r15, &sc->edi);
err |= __put_user(regs->r14, &sc->esi);
err |= __put_user(regs->r13, &sc->ebp);
......@@ -674,14 +690,14 @@ setup_sigcontext_ia32 (struct sigcontext_ia32 *sc, struct _fpstate_ia32 *fpstate
err |= __put_user(current->tss.error_code, &sc->err);
#endif
err |= __put_user(regs->cr_iip, &sc->eip);
err |= __put_user(regs->r17 & 0xffff, (unsigned int *)&sc->cs);
err |= __put_user(regs->r17 & 0xffff, (unsigned int __user *)&sc->cs);
/*
* `eflags' is in an ar register for this context
*/
flag = ia64_getreg(_IA64_REG_AR_EFLAG);
err |= __put_user((unsigned int)flag, &sc->eflags);
err |= __put_user(regs->r12, &sc->esp_at_signal);
err |= __put_user((regs->r17 >> 16) & 0xffff, (unsigned int *)&sc->ss);
err |= __put_user((regs->r17 >> 16) & 0xffff, (unsigned int __user *)&sc->ss);
if ( save_ia32_fpstate_live(fpstate) < 0 )
err = -EFAULT;
......@@ -705,7 +721,7 @@ setup_sigcontext_ia32 (struct sigcontext_ia32 *sc, struct _fpstate_ia32 *fpstate
}
static int
restore_sigcontext_ia32 (struct pt_regs *regs, struct sigcontext_ia32 *sc, int *peax)
restore_sigcontext_ia32 (struct pt_regs *regs, struct sigcontext_ia32 __user *sc, int *peax)
{
unsigned int err = 0;
......@@ -775,10 +791,10 @@ restore_sigcontext_ia32 (struct pt_regs *regs, struct sigcontext_ia32 *sc, int *
}
{
struct _fpstate_ia32 *buf = NULL;
struct _fpstate_ia32 __user *buf = NULL;
u32 fpstate_ptr;
err |= get_user(fpstate_ptr, &(sc->fpstate));
buf = (struct _fpstate_ia32 *)(u64)fpstate_ptr;
buf = compat_ptr(fpstate_ptr);
if (buf) {
err |= restore_ia32_fpstate_live(buf);
}
......@@ -808,7 +824,7 @@ restore_sigcontext_ia32 (struct pt_regs *regs, struct sigcontext_ia32 *sc, int *
/*
* Determine which stack to use..
*/
static inline void *
static inline void __user *
get_sigframe (struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
{
unsigned long esp;
......@@ -823,14 +839,14 @@ get_sigframe (struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
}
/* Legacy stack switching not supported */
return (void *)((esp - frame_size) & -8ul);
return (void __user *)((esp - frame_size) & -8ul);
}
static int
setup_frame_ia32 (int sig, struct k_sigaction *ka, sigset_t *set, struct pt_regs * regs)
{
struct exec_domain *ed = current_thread_info()->exec_domain;
struct sigframe_ia32 *frame;
struct sigframe_ia32 __user *frame;
int err = 0;
frame = get_sigframe(ka, regs, sizeof(*frame));
......@@ -862,9 +878,9 @@ setup_frame_ia32 (int sig, struct k_sigaction *ka, sigset_t *set, struct pt_regs
* See arch/i386/kernel/signal.c
*/
err |= __put_user(0xb858, (short *)(frame->retcode+0));
err |= __put_user(__IA32_NR_sigreturn, (int *)(frame->retcode+2));
err |= __put_user(0x80cd, (short *)(frame->retcode+6));
err |= __put_user(0xb858, (short __user *)(frame->retcode+0));
err |= __put_user(__IA32_NR_sigreturn, (int __user *)(frame->retcode+2));
err |= __put_user(0x80cd, (short __user *)(frame->retcode+6));
if (err)
goto give_sigsegv;
......@@ -896,7 +912,8 @@ setup_rt_frame_ia32 (int sig, struct k_sigaction *ka, siginfo_t *info,
sigset_t *set, struct pt_regs * regs)
{
struct exec_domain *ed = current_thread_info()->exec_domain;
struct rt_sigframe_ia32 *frame;
compat_uptr_t pinfo, puc;
struct rt_sigframe_ia32 __user *frame;
int err = 0;
frame = get_sigframe(ka, regs, sizeof(*frame));
......@@ -906,8 +923,11 @@ setup_rt_frame_ia32 (int sig, struct k_sigaction *ka, siginfo_t *info,
err |= __put_user((ed && ed->signal_invmap
&& sig < 32 ? ed->signal_invmap[sig] : sig), &frame->sig);
err |= __put_user((long)&frame->info, &frame->pinfo);
err |= __put_user((long)&frame->uc, &frame->puc);
pinfo = (long __user) &frame->info;
puc = (long __user) &frame->uc;
err |= __put_user(pinfo, &frame->pinfo);
err |= __put_user(puc, &frame->puc);
err |= copy_siginfo_to_user32(&frame->info, info);
/* Create the ucontext. */
......@@ -936,9 +956,9 @@ setup_rt_frame_ia32 (int sig, struct k_sigaction *ka, siginfo_t *info,
* See arch/i386/kernel/signal.c
*/
err |= __put_user(0xb8, (char *)(frame->retcode+0));
err |= __put_user(__IA32_NR_rt_sigreturn, (int *)(frame->retcode+1));
err |= __put_user(0x80cd, (short *)(frame->retcode+5));
err |= __put_user(0xb8, (char __user *)(frame->retcode+0));
err |= __put_user(__IA32_NR_rt_sigreturn, (int __user *)(frame->retcode+1));
err |= __put_user(0x80cd, (short __user *)(frame->retcode+5));
if (err)
goto give_sigsegv;
......@@ -982,7 +1002,7 @@ sys32_sigreturn (int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int
{
struct pt_regs *regs = (struct pt_regs *) &stack;
unsigned long esp = (unsigned int) regs->r12;
struct sigframe_ia32 *frame = (struct sigframe_ia32 *)(esp - 8);
struct sigframe_ia32 __user *frame = (struct sigframe_ia32 __user *)(esp - 8);
sigset_t set;
int eax;
......@@ -996,7 +1016,7 @@ sys32_sigreturn (int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int
sigdelsetmask(&set, ~_BLOCKABLE);
spin_lock_irq(&current->sighand->siglock);
current->blocked = (sigset_t) set;
current->blocked = set;
recalc_sigpending();
spin_unlock_irq(&current->sighand->siglock);
......@@ -1015,9 +1035,8 @@ sys32_rt_sigreturn (int arg0, int arg1, int arg2, int arg3, int arg4, int arg5,
{
struct pt_regs *regs = (struct pt_regs *) &stack;
unsigned long esp = (unsigned int) regs->r12;
struct rt_sigframe_ia32 *frame = (struct rt_sigframe_ia32 *)(esp - 4);
struct rt_sigframe_ia32 __user *frame = (struct rt_sigframe_ia32 __user *)(esp - 4);
sigset_t set;
stack_t st;
int eax;
if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
......@@ -1034,11 +1053,9 @@ sys32_rt_sigreturn (int arg0, int arg1, int arg2, int arg3, int arg4, int arg5,
if (restore_sigcontext_ia32(regs, &frame->uc.uc_mcontext, &eax))
goto badframe;
if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st)))
goto badframe;
/* It is more difficult to avoid calling this function than to
call it and ignore errors. */
do_sigaltstack(&st, NULL, esp);
do_sigaltstack((stack_t __user *) &frame->uc.uc_stack, NULL, esp);
return eax;
......
......@@ -76,7 +76,7 @@ ia32_clone_tls (struct task_struct *child, struct pt_regs *childregs)
struct ia32_user_desc info;
int idx;
if (copy_from_user(&info, (void *)(childregs->r14 & 0xffffffff), sizeof(info)))
if (copy_from_user(&info, (void __user *)(childregs->r14 & 0xffffffff), sizeof(info)))
return -EFAULT;
if (LDT_empty(&info))
return -EINVAL;
......@@ -223,7 +223,7 @@ ia32_bad_interrupt (unsigned long int_num, struct pt_regs *regs)
siginfo.si_errno = int_num; /* XXX is it OK to abuse si_errno like this? */
siginfo.si_flags = 0;
siginfo.si_isr = 0;
siginfo.si_addr = 0;
siginfo.si_addr = NULL;
siginfo.si_imm = 0;
siginfo.si_code = TRAP_BRKPT;
force_sig_info(SIGTRAP, &siginfo, current);
......
......@@ -361,7 +361,7 @@ void ia64_elf32_init(struct pt_regs *regs);
/* This macro yields a string that ld.so will use to load
implementation specific libraries for optimization. Not terribly
relevant until we have real hardware to play with... */
#define ELF_PLATFORM 0
#define ELF_PLATFORM NULL
#ifdef __KERNEL__
# define SET_PERSONALITY(EX,IBCS2) \
......@@ -439,7 +439,7 @@ void ia64_elf32_init(struct pt_regs *regs);
| ((((sd) >> IA32_SEG_DB) & 0x1) << SEG_DB) \
| ((((sd) >> IA32_SEG_G) & 0x1) << SEG_G))
#define IA32_IOBASE 0x2000000000000000 /* Virtual address for I/O space */
#define IA32_IOBASE 0x2000000000000000UL /* Virtual address for I/O space */
#define IA32_CR0 0x80000001 /* Enable PG and PE bits */
#define IA32_CR4 0x600 /* MMXEX and FXSR on */
......@@ -556,8 +556,8 @@ struct user_regs_struct32 {
};
/* Prototypes for use in elfcore32.h */
extern int save_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct *save);
extern int save_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct *save);
extern int save_ia32_fpstate (struct task_struct *, struct ia32_user_i387_struct __user *);
extern int save_ia32_fpxstate (struct task_struct *, struct ia32_user_fxsr_struct __user *);
#endif /* !CONFIG_IA32_SUPPORT */
......
......@@ -70,10 +70,7 @@
# define DBG(fmt...)
#endif
#define A(__x) ((unsigned long)(__x))
#define AA(__x) ((unsigned long)(__x))
#define ROUND_UP(x,a) ((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & ~((a) - 1)))
#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
#define OFFSET4K(a) ((a) & 0xfff)
#define PAGE_START(addr) ((addr) & PAGE_MASK)
......@@ -82,9 +79,6 @@
#define high2lowuid(uid) ((uid) > 65535 ? 65534 : (uid))
#define high2lowgid(gid) ((gid) > 65535 ? 65534 : (gid))
extern unsigned long arch_get_unmapped_area (struct file *, unsigned long, unsigned long,
unsigned long, unsigned long);
/*
* Anything that modifies or inspects ia32 user virtual memory must hold this semaphore
* while doing so.
......@@ -93,7 +87,8 @@ extern unsigned long arch_get_unmapped_area (struct file *, unsigned long, unsig
static DECLARE_MUTEX(ia32_mmap_sem);
asmlinkage long
sys32_execve (char *name, compat_uptr_t __user *argv, compat_uptr_t __user *envp, struct pt_regs *regs)
sys32_execve (char __user *name, compat_uptr_t __user *argv, compat_uptr_t __user *envp,
struct pt_regs *regs)
{
long error;
char *filename;
......@@ -128,7 +123,7 @@ sys32_execve (char *name, compat_uptr_t __user *argv, compat_uptr_t __user *envp
return error;
}
int cp_compat_stat(struct kstat *stat, struct compat_stat *ubuf)
int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf)
{
int err;
......@@ -199,7 +194,7 @@ mmap_subpage (struct file *file, unsigned long start, unsigned long end, int pro
/* Optimize the case where the old mmap and the new mmap are both anonymous */
if ((old_prot & PROT_WRITE) && (flags & MAP_ANONYMOUS) && !vma->vm_file) {
if (clear_user((void *) start, end - start)) {
if (clear_user((void __user *) start, end - start)) {
ret = -EFAULT;
goto out;
}
......@@ -211,11 +206,11 @@ mmap_subpage (struct file *file, unsigned long start, unsigned long end, int pro
return -ENOMEM;
if (old_prot)
copy_from_user(page, (void *) PAGE_START(start), PAGE_SIZE);
copy_from_user(page, (void __user *) PAGE_START(start), PAGE_SIZE);
down_write(&current->mm->mmap_sem);
{
ret = do_mmap(0, PAGE_START(start), PAGE_SIZE, prot | PROT_WRITE,
ret = do_mmap(NULL, PAGE_START(start), PAGE_SIZE, prot | PROT_WRITE,
flags | MAP_FIXED | MAP_ANONYMOUS, 0);
}
up_write(&current->mm->mmap_sem);
......@@ -226,9 +221,10 @@ mmap_subpage (struct file *file, unsigned long start, unsigned long end, int pro
if (old_prot) {
/* copy back the old page contents. */
if (offset_in_page(start))
copy_to_user((void *) PAGE_START(start), page, offset_in_page(start));
copy_to_user((void __user *) PAGE_START(start), page,
offset_in_page(start));
if (offset_in_page(end))
copy_to_user((void *) end, page + offset_in_page(end),
copy_to_user((void __user *) end, page + offset_in_page(end),
PAGE_SIZE - offset_in_page(end));
}
......@@ -236,7 +232,7 @@ mmap_subpage (struct file *file, unsigned long start, unsigned long end, int pro
/* read the file contents */
inode = file->f_dentry->d_inode;
if (!inode->i_fop || !file->f_op->read
|| ((*file->f_op->read)(file, (char *) start, end - start, &off) < 0))
|| ((*file->f_op->read)(file, (char __user *) start, end - start, &off) < 0))
{
ret = -EINVAL;
goto out;
......@@ -266,9 +262,9 @@ ia32_init_pp_list(void)
if ((p = kmalloc(sizeof(*p), GFP_KERNEL)) == NULL)
return p;
p->pp_head = 0;
p->pp_head = NULL;
p->ppl_rb = RB_ROOT;
p->pp_hint = 0;
p->pp_hint = NULL;
atomic_set(&p->pp_count, 1);
return p;
}
......@@ -825,7 +821,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro
if (!(flags & MAP_ANONYMOUS) && is_congruent)
ret = do_mmap(file, pstart, pend - pstart, prot, flags | MAP_FIXED, poff);
else
ret = do_mmap(0, pstart, pend - pstart,
ret = do_mmap(NULL, pstart, pend - pstart,
prot | ((flags & MAP_ANONYMOUS) ? 0 : PROT_WRITE),
flags | MAP_FIXED | MAP_ANONYMOUS, 0);
}
......@@ -838,7 +834,8 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro
/* read the file contents */
inode = file->f_dentry->d_inode;
if (!inode->i_fop || !file->f_op->read
|| ((*file->f_op->read)(file, (char *) pstart, pend - pstart, &poff) < 0))
|| ((*file->f_op->read)(file, (char __user *) pstart, pend - pstart, &poff)
< 0))
{
sys_munmap(pstart, pend - pstart);
return -EINVAL;
......@@ -927,7 +924,7 @@ struct mmap_arg_struct {
};
asmlinkage long
sys32_mmap (struct mmap_arg_struct *arg)
sys32_mmap (struct mmap_arg_struct __user *arg)
{
struct mmap_arg_struct a;
struct file *file = NULL;
......@@ -1140,7 +1137,7 @@ sys32_mremap (unsigned int addr, unsigned int old_len, unsigned int new_len,
}
asmlinkage long
sys32_pipe (int *fd)
sys32_pipe (int __user *fd)
{
int retval;
int fds[2];
......@@ -1155,14 +1152,14 @@ sys32_pipe (int *fd)
}
static inline long
get_tv32 (struct timeval *o, struct compat_timeval *i)
get_tv32 (struct timeval *o, struct compat_timeval __user *i)
{
return (!access_ok(VERIFY_READ, i, sizeof(*i)) ||
(__get_user(o->tv_sec, &i->tv_sec) | __get_user(o->tv_usec, &i->tv_usec)));
}
static inline long
put_tv32 (struct compat_timeval *o, struct timeval *i)
put_tv32 (struct compat_timeval __user *o, struct timeval *i)
{
return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
(__put_user(i->tv_sec, &o->tv_sec) | __put_user(i->tv_usec, &o->tv_usec)));
......@@ -1192,7 +1189,7 @@ sys32_alarm (unsigned int seconds)
extern struct timezone sys_tz;
asmlinkage long
sys32_gettimeofday (struct compat_timeval *tv, struct timezone *tz)
sys32_gettimeofday (struct compat_timeval __user *tv, struct timezone __user *tz)
{
if (tv) {
struct timeval ktv;
......@@ -1208,7 +1205,7 @@ sys32_gettimeofday (struct compat_timeval *tv, struct timezone *tz)
}
asmlinkage long
sys32_settimeofday (struct compat_timeval *tv, struct timezone *tz)
sys32_settimeofday (struct compat_timeval __user *tv, struct timezone __user *tz)
{
struct timeval ktv;
struct timespec kts;
......@@ -1229,14 +1226,14 @@ sys32_settimeofday (struct compat_timeval *tv, struct timezone *tz)
}
struct getdents32_callback {
struct compat_dirent * current_dir;
struct compat_dirent * previous;
struct compat_dirent __user *current_dir;
struct compat_dirent __user *previous;
int count;
int error;
};
struct readdir32_callback {
struct old_linux32_dirent * dirent;
struct old_linux32_dirent __user * dirent;
int count;
};
......@@ -1244,9 +1241,9 @@ static int
filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino,
unsigned int d_type)
{
struct compat_dirent * dirent;
struct compat_dirent __user * dirent;
struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1, 4);
int reclen = ROUND_UP(offsetof(struct compat_dirent, d_name) + namlen + 1, 4);
buf->error = -EINVAL; /* only used if we fail.. */
if (reclen > buf->count)
......@@ -1263,17 +1260,17 @@ filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino,
|| copy_to_user(dirent->d_name, name, namlen)
|| put_user(0, dirent->d_name + namlen))
return -EFAULT;
dirent = (struct compat_dirent *) ((char *) dirent + reclen);
dirent = (struct compat_dirent __user *) ((char __user *) dirent + reclen);
buf->current_dir = dirent;
buf->count -= reclen;
return 0;
}
asmlinkage long
sys32_getdents (unsigned int fd, struct compat_dirent *dirent, unsigned int count)
sys32_getdents (unsigned int fd, struct compat_dirent __user *dirent, unsigned int count)
{
struct file * file;
struct compat_dirent * lastdirent;
struct compat_dirent __user * lastdirent;
struct getdents32_callback buf;
int error;
......@@ -1310,7 +1307,7 @@ fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t
unsigned int d_type)
{
struct readdir32_callback * buf = (struct readdir32_callback *) __buf;
struct old_linux32_dirent * dirent;
struct old_linux32_dirent __user * dirent;
if (buf->count)
return -EINVAL;
......@@ -1326,7 +1323,7 @@ fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t
}
asmlinkage long
sys32_readdir (unsigned int fd, void *dirent, unsigned int count)
sys32_readdir (unsigned int fd, void __user *dirent, unsigned int count)
{
int error;
struct file * file;
......@@ -1357,7 +1354,7 @@ struct sel_arg_struct {
};
asmlinkage long
sys32_old_select (struct sel_arg_struct *arg)
sys32_old_select (struct sel_arg_struct __user *arg)
{
struct sel_arg_struct a;
......@@ -1434,7 +1431,7 @@ sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth)
* so we have to implement this system call here.
*/
asmlinkage long
sys32_time (int *tloc)
sys32_time (int __user *tloc)
{
int i;
struct timeval tv;
......@@ -1564,8 +1561,8 @@ putreg (struct task_struct *child, int regno, unsigned int value)
}
static void
put_fpreg (int regno, struct _fpreg_ia32 *reg, struct pt_regs *ptp, struct switch_stack *swp,
int tos)
put_fpreg (int regno, struct _fpreg_ia32 __user *reg, struct pt_regs *ptp,
struct switch_stack *swp, int tos)
{
struct _fpreg_ia32 *f;
char buf[32];
......@@ -1597,8 +1594,8 @@ put_fpreg (int regno, struct _fpreg_ia32 *reg, struct pt_regs *ptp, struct switc
}
static void
get_fpreg (int regno, struct _fpreg_ia32 *reg, struct pt_regs *ptp, struct switch_stack *swp,
int tos)
get_fpreg (int regno, struct _fpreg_ia32 __user *reg, struct pt_regs *ptp,
struct switch_stack *swp, int tos)
{
if ((regno += tos) >= 8)
......@@ -1627,7 +1624,7 @@ get_fpreg (int regno, struct _fpreg_ia32 *reg, struct pt_regs *ptp, struct switc
}
int
save_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct *save)
save_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct __user *save)
{
struct switch_stack *swp;
struct pt_regs *ptp;
......@@ -1656,7 +1653,7 @@ save_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct *save)
}
static int
restore_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct *save)
restore_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct __user *save)
{
struct switch_stack *swp;
struct pt_regs *ptp;
......@@ -1666,15 +1663,15 @@ restore_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct *sav
if (!access_ok(VERIFY_READ, save, sizeof(*save)))
return(-EFAULT);
__get_user(num32, (unsigned int *)&save->cwd);
__get_user(num32, (unsigned int __user *)&save->cwd);
tsk->thread.fcr = (tsk->thread.fcr & (~0x1f3f)) | (num32 & 0x1f3f);
__get_user(fsrlo, (unsigned int *)&save->swd);
__get_user(fsrhi, (unsigned int *)&save->twd);
__get_user(fsrlo, (unsigned int __user *)&save->swd);
__get_user(fsrhi, (unsigned int __user *)&save->twd);
num32 = (fsrhi << 16) | fsrlo;
tsk->thread.fsr = (tsk->thread.fsr & (~0xffffffff)) | num32;
__get_user(num32, (unsigned int *)&save->fip);
__get_user(num32, (unsigned int __user *)&save->fip);
tsk->thread.fir = (tsk->thread.fir & (~0xffffffff)) | num32;
__get_user(num32, (unsigned int *)&save->foo);
__get_user(num32, (unsigned int __user *)&save->foo);
tsk->thread.fdr = (tsk->thread.fdr & (~0xffffffff)) | num32;
/*
......@@ -1689,7 +1686,7 @@ restore_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct *sav
}
int
save_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct *save)
save_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct __user *save)
{
struct switch_stack *swp;
struct pt_regs *ptp;
......@@ -1715,7 +1712,7 @@ save_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct *save)
ptp = ia64_task_regs(tsk);
tos = (tsk->thread.fsr >> 11) & 7;
for (i = 0; i < 8; i++)
put_fpreg(i, (struct _fpreg_ia32 *)&save->st_space[4*i], ptp, swp, tos);
put_fpreg(i, (struct _fpreg_ia32 __user *)&save->st_space[4*i], ptp, swp, tos);
mxcsr = ((tsk->thread.fcr>>32) & 0xff80) | ((tsk->thread.fsr>>32) & 0x3f);
__put_user(mxcsr & 0xffff, &save->mxcsr);
......@@ -1728,7 +1725,7 @@ save_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct *save)
}
static int
restore_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct *save)
restore_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct __user *save)
{
struct switch_stack *swp;
struct pt_regs *ptp;
......@@ -1741,15 +1738,15 @@ restore_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct *sa
if (!access_ok(VERIFY_READ, save, sizeof(*save)))
return(-EFAULT);
__get_user(num32, (unsigned int *)&save->cwd);
__get_user(num32, (unsigned int __user *)&save->cwd);
tsk->thread.fcr = (tsk->thread.fcr & (~0x1f3f)) | (num32 & 0x1f3f);
__get_user(fsrlo, (unsigned int *)&save->swd);
__get_user(fsrhi, (unsigned int *)&save->twd);
__get_user(fsrlo, (unsigned int __user *)&save->swd);
__get_user(fsrhi, (unsigned int __user *)&save->twd);
num32 = (fsrhi << 16) | fsrlo;
tsk->thread.fsr = (tsk->thread.fsr & (~0xffffffff)) | num32;
__get_user(num32, (unsigned int *)&save->fip);
__get_user(num32, (unsigned int __user *)&save->fip);
tsk->thread.fir = (tsk->thread.fir & (~0xffffffff)) | num32;
__get_user(num32, (unsigned int *)&save->foo);
__get_user(num32, (unsigned int __user *)&save->foo);
tsk->thread.fdr = (tsk->thread.fdr & (~0xffffffff)) | num32;
/*
......@@ -1759,13 +1756,13 @@ restore_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct *sa
ptp = ia64_task_regs(tsk);
tos = (tsk->thread.fsr >> 11) & 7;
for (i = 0; i < 8; i++)
get_fpreg(i, (struct _fpreg_ia32 *)&save->st_space[4*i], ptp, swp, tos);
get_fpreg(i, (struct _fpreg_ia32 __user *)&save->st_space[4*i], ptp, swp, tos);
__get_user(mxcsr, (unsigned int *)&save->mxcsr);
__get_user(mxcsr, (unsigned int __user *)&save->mxcsr);
num64 = mxcsr & 0xff10;
tsk->thread.fcr = (tsk->thread.fcr & (~0xff1000000000)) | (num64<<32);
tsk->thread.fcr = (tsk->thread.fcr & (~0xff1000000000UL)) | (num64<<32);
num64 = mxcsr & 0x3f;
tsk->thread.fsr = (tsk->thread.fsr & (~0x3f00000000)) | (num64<<32);
tsk->thread.fsr = (tsk->thread.fsr & (~0x3f00000000UL)) | (num64<<32);
for (i = 0; i < 8; i++) {
copy_from_user(num128, &save->xmm_space[0] + 4*i, sizeof(struct _xmmreg_ia32));
......@@ -1823,7 +1820,7 @@ sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data,
case PTRACE_PEEKDATA: /* read word at location addr */
ret = ia32_peek(regs, child, addr, &value);
if (ret == 0)
ret = put_user(value, (unsigned int *) A(data));
ret = put_user(value, (unsigned int __user *) compat_ptr(data));
else
ret = -EIO;
goto out_tsk;
......@@ -1839,7 +1836,7 @@ sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data,
break;
tmp = getreg(child, addr);
if (!put_user(tmp, (unsigned int *) A(data)))
if (!put_user(tmp, (unsigned int __user *) compat_ptr(data)))
ret = 0;
break;
......@@ -1853,24 +1850,24 @@ sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data,
break;
case IA32_PTRACE_GETREGS:
if (!access_ok(VERIFY_WRITE, (int *) A(data), 17*sizeof(int))) {
if (!access_ok(VERIFY_WRITE, compat_ptr(data), 17*sizeof(int))) {
ret = -EIO;
break;
}
for (i = 0; i < (int) (17*sizeof(int)); i += sizeof(int) ) {
put_user(getreg(child, i), (unsigned int *) A(data));
put_user(getreg(child, i), (unsigned int __user *) compat_ptr(data));
data += sizeof(int);
}
ret = 0;
break;
case IA32_PTRACE_SETREGS:
if (!access_ok(VERIFY_READ, (int *) A(data), 17*sizeof(int))) {
if (!access_ok(VERIFY_READ, compat_ptr(data), 17*sizeof(int))) {
ret = -EIO;
break;
}
for (i = 0; i < (int) (17*sizeof(int)); i += sizeof(int) ) {
get_user(tmp, (unsigned int *) A(data));
get_user(tmp, (unsigned int __user *) compat_ptr(data));
putreg(child, i, tmp);
data += sizeof(int);
}
......@@ -1878,19 +1875,23 @@ sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data,
break;
case IA32_PTRACE_GETFPREGS:
ret = save_ia32_fpstate(child, (struct ia32_user_i387_struct *) A(data));
ret = save_ia32_fpstate(child, (struct ia32_user_i387_struct __user *)
compat_ptr(data));
break;
case IA32_PTRACE_GETFPXREGS:
ret = save_ia32_fpxstate(child, (struct ia32_user_fxsr_struct *) A(data));
ret = save_ia32_fpxstate(child, (struct ia32_user_fxsr_struct __user *)
compat_ptr(data));
break;
case IA32_PTRACE_SETFPREGS:
ret = restore_ia32_fpstate(child, (struct ia32_user_i387_struct *) A(data));
ret = restore_ia32_fpstate(child, (struct ia32_user_i387_struct __user *)
compat_ptr(data));
break;
case IA32_PTRACE_SETFPXREGS:
ret = restore_ia32_fpxstate(child, (struct ia32_user_fxsr_struct *) A(data));
ret = restore_ia32_fpxstate(child, (struct ia32_user_fxsr_struct __user *)
compat_ptr(data));
break;
case PTRACE_SYSCALL: /* continue, stop after next syscall */
......@@ -1920,7 +1921,7 @@ typedef struct {
} ia32_stack_t;
asmlinkage long
sys32_sigaltstack (ia32_stack_t *uss32, ia32_stack_t *uoss32,
sys32_sigaltstack (ia32_stack_t __user *uss32, ia32_stack_t __user *uoss32,
long arg2, long arg3, long arg4, long arg5, long arg6, long arg7, long stack)
{
struct pt_regs *pt = (struct pt_regs *) &stack;
......@@ -1932,9 +1933,9 @@ sys32_sigaltstack (ia32_stack_t *uss32, ia32_stack_t *uoss32,
if (uss32) {
if (copy_from_user(&buf32, uss32, sizeof(ia32_stack_t)))
return -EFAULT;
uss.ss_sp = (void *) (long) buf32.ss_sp;
uss.ss_sp = (void __user *) (long) buf32.ss_sp;
uss.ss_flags = buf32.ss_flags;
/* MINSIGSTKSZ is different for ia32 vs ia64. We lie here to pass the
/* MINSIGSTKSZ is different for ia32 vs ia64. We lie here to pass the
check and set it to the user requested value later */
if ((buf32.ss_flags != SS_DISABLE) && (buf32.ss_size < MINSIGSTKSZ_IA32)) {
ret = -ENOMEM;
......@@ -1943,14 +1944,15 @@ sys32_sigaltstack (ia32_stack_t *uss32, ia32_stack_t *uoss32,
uss.ss_size = MINSIGSTKSZ;
}
set_fs(KERNEL_DS);
ret = do_sigaltstack(uss32 ? &uss : NULL, &uoss, pt->r12);
current->sas_ss_size = buf32.ss_size;
ret = do_sigaltstack(uss32 ? (stack_t __user *) &uss : NULL,
(stack_t __user *) &uoss, pt->r12);
current->sas_ss_size = buf32.ss_size;
set_fs(old_fs);
out:
if (ret < 0)
return(ret);
if (uoss32) {
buf32.ss_sp = (long) uoss.ss_sp;
buf32.ss_sp = (long __user) uoss.ss_sp;
buf32.ss_flags = uoss.ss_flags;
buf32.ss_size = uoss.ss_size;
if (copy_to_user(uoss32, &buf32, sizeof(ia32_stack_t)))
......@@ -1989,14 +1991,14 @@ struct sysctl32 {
};
asmlinkage long
sys32_sysctl (struct sysctl32 *args)
sys32_sysctl (struct sysctl32 __user *args)
{
#ifdef CONFIG_SYSCTL
struct sysctl32 a32;
mm_segment_t old_fs = get_fs ();
void *oldvalp, *newvalp;
void __user *oldvalp, *newvalp;
size_t oldlen;
int *namep;
int __user *namep;
long ret;
if (copy_from_user(&a32, args, sizeof(a32)))
......@@ -2009,11 +2011,11 @@ sys32_sysctl (struct sysctl32 *args)
* addresses, we KNOW that access_ok() will always succeed, so this is an
* expensive NOP, but so what...
*/
namep = (int *) A(a32.name);
oldvalp = (void *) A(a32.oldval);
newvalp = (void *) A(a32.newval);
namep = (int __user *) compat_ptr(a32.name);
oldvalp = compat_ptr(a32.oldval);
newvalp = compat_ptr(a32.newval);
if ((oldvalp && get_user(oldlen, (int *) A(a32.oldlenp)))
if ((oldvalp && get_user(oldlen, (int __user *) compat_ptr(a32.oldlenp)))
|| !access_ok(VERIFY_WRITE, namep, 0)
|| !access_ok(VERIFY_WRITE, oldvalp, 0)
|| !access_ok(VERIFY_WRITE, newvalp, 0))
......@@ -2021,11 +2023,12 @@ sys32_sysctl (struct sysctl32 *args)
set_fs(KERNEL_DS);
lock_kernel();
ret = do_sysctl(namep, a32.nlen, oldvalp, &oldlen, newvalp, (size_t) a32.newlen);
ret = do_sysctl(namep, a32.nlen, oldvalp, (size_t __user *) &oldlen,
newvalp, (size_t) a32.newlen);
unlock_kernel();
set_fs(old_fs);
if (oldvalp && put_user (oldlen, (int *) A(a32.oldlenp)))
if (oldvalp && put_user (oldlen, (int __user *) compat_ptr(a32.oldlenp)))
return -EFAULT;
return ret;
......@@ -2035,7 +2038,7 @@ sys32_sysctl (struct sysctl32 *args)
}
asmlinkage long
sys32_newuname (struct new_utsname *name)
sys32_newuname (struct new_utsname __user *name)
{
int ret = sys_newuname(name);
......@@ -2046,14 +2049,14 @@ sys32_newuname (struct new_utsname *name)
}
asmlinkage long
sys32_getresuid16 (u16 *ruid, u16 *euid, u16 *suid)
sys32_getresuid16 (u16 __user *ruid, u16 __user *euid, u16 __user *suid)
{
uid_t a, b, c;
int ret;
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_getresuid(&a, &b, &c);
ret = sys_getresuid((uid_t __user *) &a, (uid_t __user *) &b, (uid_t __user *) &c);
set_fs(old_fs);
if (put_user(a, ruid) || put_user(b, euid) || put_user(c, suid))
......@@ -2062,14 +2065,14 @@ sys32_getresuid16 (u16 *ruid, u16 *euid, u16 *suid)
}
asmlinkage long
sys32_getresgid16 (u16 *rgid, u16 *egid, u16 *sgid)
sys32_getresgid16 (u16 __user *rgid, u16 __user *egid, u16 __user *sgid)
{
gid_t a, b, c;
int ret;
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_getresgid(&a, &b, &c);
ret = sys_getresgid((gid_t __user *) &a, (gid_t __user *) &b, (gid_t __user *) &c);
set_fs(old_fs);
if (ret)
......@@ -2086,7 +2089,7 @@ sys32_lseek (unsigned int fd, int offset, unsigned int whence)
}
static int
groups16_to_user(short *grouplist, struct group_info *group_info)
groups16_to_user(short __user *grouplist, struct group_info *group_info)
{
int i;
short group;
......@@ -2101,7 +2104,7 @@ groups16_to_user(short *grouplist, struct group_info *group_info)
}
static int
groups16_from_user(struct group_info *group_info, short *grouplist)
groups16_from_user(struct group_info *group_info, short __user *grouplist)
{
int i;
short group;
......@@ -2116,7 +2119,7 @@ groups16_from_user(struct group_info *group_info, short *grouplist)
}
asmlinkage long
sys32_getgroups16 (int gidsetsize, short *grouplist)
sys32_getgroups16 (int gidsetsize, short __user *grouplist)
{
int i;
......@@ -2141,7 +2144,7 @@ sys32_getgroups16 (int gidsetsize, short *grouplist)
}
asmlinkage long
sys32_setgroups16 (int gidsetsize, short *grouplist)
sys32_setgroups16 (int gidsetsize, short __user *grouplist)
{
struct group_info *group_info;
int retval;
......@@ -2169,7 +2172,7 @@ sys32_setgroups16 (int gidsetsize, short *grouplist)
asmlinkage long
sys32_truncate64 (unsigned int path, unsigned int len_lo, unsigned int len_hi)
{
return sys_truncate((const char *) A(path), ((unsigned long) len_hi << 32) | len_lo);
return sys_truncate(compat_ptr(path), ((unsigned long) len_hi << 32) | len_lo);
}
asmlinkage long
......@@ -2179,7 +2182,7 @@ sys32_ftruncate64 (int fd, unsigned int len_lo, unsigned int len_hi)
}
static int
putstat64 (struct stat64 *ubuf, struct kstat *kbuf)
putstat64 (struct stat64 __user *ubuf, struct kstat *kbuf)
{
int err;
u64 hdev;
......@@ -2188,8 +2191,8 @@ putstat64 (struct stat64 *ubuf, struct kstat *kbuf)
return -EFAULT;
hdev = huge_encode_dev(kbuf->dev);
err = __put_user(hdev, (u32*)&ubuf->st_dev);
err |= __put_user(hdev >> 32, ((u32*)&ubuf->st_dev) + 1);
err = __put_user(hdev, (u32 __user*)&ubuf->st_dev);
err |= __put_user(hdev >> 32, ((u32 __user*)&ubuf->st_dev) + 1);
err |= __put_user(kbuf->ino, &ubuf->__st_ino);
err |= __put_user(kbuf->ino, &ubuf->st_ino_lo);
err |= __put_user(kbuf->ino >> 32, &ubuf->st_ino_hi);
......@@ -2198,8 +2201,8 @@ putstat64 (struct stat64 *ubuf, struct kstat *kbuf)
err |= __put_user(kbuf->uid, &ubuf->st_uid);
err |= __put_user(kbuf->gid, &ubuf->st_gid);
hdev = huge_encode_dev(kbuf->rdev);
err = __put_user(hdev, (u32*)&ubuf->st_rdev);
err |= __put_user(hdev >> 32, ((u32*)&ubuf->st_rdev) + 1);
err = __put_user(hdev, (u32 __user*)&ubuf->st_rdev);
err |= __put_user(hdev >> 32, ((u32 __user*)&ubuf->st_rdev) + 1);
err |= __put_user(kbuf->size, &ubuf->st_size_lo);
err |= __put_user((kbuf->size >> 32), &ubuf->st_size_hi);
err |= __put_user(kbuf->atime.tv_sec, &ubuf->st_atime);
......@@ -2214,7 +2217,7 @@ putstat64 (struct stat64 *ubuf, struct kstat *kbuf)
}
asmlinkage long
sys32_stat64 (char *filename, struct stat64 *statbuf)
sys32_stat64 (char __user *filename, struct stat64 __user *statbuf)
{
struct kstat s;
long ret = vfs_stat(filename, &s);
......@@ -2224,7 +2227,7 @@ sys32_stat64 (char *filename, struct stat64 *statbuf)
}
asmlinkage long
sys32_lstat64 (char *filename, struct stat64 *statbuf)
sys32_lstat64 (char __user *filename, struct stat64 __user *statbuf)
{
struct kstat s;
long ret = vfs_lstat(filename, &s);
......@@ -2234,7 +2237,7 @@ sys32_lstat64 (char *filename, struct stat64 *statbuf)
}
asmlinkage long
sys32_fstat64 (unsigned int fd, struct stat64 *statbuf)
sys32_fstat64 (unsigned int fd, struct stat64 __user *statbuf)
{
struct kstat s;
long ret = vfs_fstat(fd, &s);
......@@ -2261,7 +2264,7 @@ struct sysinfo32 {
};
asmlinkage long
sys32_sysinfo (struct sysinfo32 *info)
sys32_sysinfo (struct sysinfo32 __user *info)
{
struct sysinfo s;
long ret, err;
......@@ -2269,7 +2272,7 @@ sys32_sysinfo (struct sysinfo32 *info)
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_sysinfo(&s);
ret = sys_sysinfo((struct sysinfo __user *) &s);
set_fs(old_fs);
/* Check to see if any memory value is too large for 32-bit and
* scale down if needed.
......@@ -2312,14 +2315,14 @@ sys32_sysinfo (struct sysinfo32 *info)
}
asmlinkage long
sys32_sched_rr_get_interval (pid_t pid, struct compat_timespec *interval)
sys32_sched_rr_get_interval (pid_t pid, struct compat_timespec __user *interval)
{
mm_segment_t old_fs = get_fs();
struct timespec t;
long ret;
set_fs(KERNEL_DS);
ret = sys_sched_rr_get_interval(pid, &t);
ret = sys_sched_rr_get_interval(pid, (struct timespec __user *) &t);
set_fs(old_fs);
if (put_compat_timespec(&t, interval))
return -EFAULT;
......@@ -2327,19 +2330,19 @@ sys32_sched_rr_get_interval (pid_t pid, struct compat_timespec *interval)
}
asmlinkage long
sys32_pread (unsigned int fd, void *buf, unsigned int count, u32 pos_lo, u32 pos_hi)
sys32_pread (unsigned int fd, void __user *buf, unsigned int count, u32 pos_lo, u32 pos_hi)
{
return sys_pread64(fd, buf, count, ((unsigned long) pos_hi << 32) | pos_lo);
}
asmlinkage long
sys32_pwrite (unsigned int fd, void *buf, unsigned int count, u32 pos_lo, u32 pos_hi)
sys32_pwrite (unsigned int fd, void __user *buf, unsigned int count, u32 pos_lo, u32 pos_hi)
{
return sys_pwrite64(fd, buf, count, ((unsigned long) pos_hi << 32) | pos_lo);
}
asmlinkage long
sys32_sendfile (int out_fd, int in_fd, int *offset, unsigned int count)
sys32_sendfile (int out_fd, int in_fd, int __user *offset, unsigned int count)
{
mm_segment_t old_fs = get_fs();
long ret;
......@@ -2349,7 +2352,7 @@ sys32_sendfile (int out_fd, int in_fd, int *offset, unsigned int count)
return -EFAULT;
set_fs(KERNEL_DS);
ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *) &of : NULL, count);
set_fs(old_fs);
if (!ret && offset && put_user(of, offset))
......@@ -2380,7 +2383,7 @@ sys32_brk (unsigned int brk)
obrk = mm->brk;
ret = sys_brk(brk);
if (ret < obrk)
clear_user((void *) ret, PAGE_ALIGN(ret) - ret);
clear_user(compat_ptr(ret), PAGE_ALIGN(ret) - ret);
return ret;
}
......@@ -2388,7 +2391,7 @@ sys32_brk (unsigned int brk)
* Exactly like fs/open.c:sys_open(), except that it doesn't set the O_LARGEFILE flag.
*/
asmlinkage long
sys32_open (const char * filename, int flags, int mode)
sys32_open (const char __user * filename, int flags, int mode)
{
char * tmp;
int fd, error;
......@@ -2420,10 +2423,10 @@ struct epoll_event32
{
u32 events;
u32 data[2];
};
};
asmlinkage long
sys32_epoll_ctl(int epfd, int op, int fd, struct epoll_event32 *event)
sys32_epoll_ctl(int epfd, int op, int fd, struct epoll_event32 __user *event)
{
mm_segment_t old_fs = get_fs();
struct epoll_event event64;
......@@ -2441,14 +2444,14 @@ sys32_epoll_ctl(int epfd, int op, int fd, struct epoll_event32 *event)
event64.data |= (u64)data_halfword << 32;
set_fs(KERNEL_DS);
error = sys_epoll_ctl(epfd, op, fd, &event64);
error = sys_epoll_ctl(epfd, op, fd, (struct epoll_event __user *) &event64);
set_fs(old_fs);
return error;
}
asmlinkage long
sys32_epoll_wait(int epfd, struct epoll_event32 *events, int maxevents,
sys32_epoll_wait(int epfd, struct epoll_event32 __user * events, int maxevents,
int timeout)
{
struct epoll_event *events64 = NULL;
......@@ -2466,8 +2469,8 @@ sys32_epoll_wait(int epfd, struct epoll_event32 *events, int maxevents,
maxevents * sizeof(struct epoll_event32))))
return error;
/*
* Allocate space for the intermediate copy. If the space needed
/*
* Allocate space for the intermediate copy. If the space needed
* is large enough to cause kmalloc to fail, then try again with
* __get_free_pages.
*/
......@@ -2476,14 +2479,15 @@ sys32_epoll_wait(int epfd, struct epoll_event32 *events, int maxevents,
if (events64 == NULL) {
events64 = (struct epoll_event *)
__get_free_pages(GFP_KERNEL, get_order(size));
if (events64 == NULL)
if (events64 == NULL)
return -ENOMEM;
do_free_pages = 1;
}
/* Do the system call */
set_fs(KERNEL_DS); /* copy_to/from_user should work on kernel mem*/
numevents = sys_epoll_wait(epfd, events64, maxevents, timeout);
numevents = sys_epoll_wait(epfd, (struct epoll_event __user *) events64,
maxevents, timeout);
set_fs(old_fs);
/* Don't modify userspace memory if we're returning an error */
......@@ -2526,7 +2530,7 @@ get_free_idx (void)
* Set a given TLS descriptor:
*/
asmlinkage int
sys32_set_thread_area (struct ia32_user_desc *u_info)
sys32_set_thread_area (struct ia32_user_desc __user *u_info)
{
struct thread_struct *t = &current->thread;
struct ia32_user_desc info;
......@@ -2587,7 +2591,7 @@ sys32_set_thread_area (struct ia32_user_desc *u_info)
#define GET_USEABLE(desc) (((desc)->b >> 20) & 1)
asmlinkage int
sys32_get_thread_area (struct ia32_user_desc *u_info)
sys32_get_thread_area (struct ia32_user_desc __user *u_info)
{
struct ia32_user_desc info;
struct desc_struct *desc;
......@@ -2615,12 +2619,8 @@ sys32_get_thread_area (struct ia32_user_desc *u_info)
return 0;
}
extern asmlinkage long
sys_timer_create(clockid_t which_clock, struct sigevent *timer_event_spec,
timer_t * created_timer_id);
asmlinkage long
sys32_timer_create(u32 clock, struct sigevent32 *se32, timer_t *timer_id)
sys32_timer_create(u32 clock, struct sigevent32 __user *se32, timer_t __user *timer_id)
{
struct sigevent se;
mm_segment_t oldfs;
......@@ -2643,7 +2643,7 @@ sys32_timer_create(u32 clock, struct sigevent32 *se32, timer_t *timer_id)
oldfs = get_fs();
set_fs(KERNEL_DS);
err = sys_timer_create(clock, &se, &t);
err = sys_timer_create(clock, (struct sigevent __user *) &se, (timer_t __user *) &t);
set_fs(oldfs);
if (!err)
......@@ -2661,6 +2661,32 @@ long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high,
advice);
}
asmlinkage long sys32_waitid(int which, compat_pid_t pid,
siginfo_t32 __user *uinfo, int options,
struct compat_rusage __user *uru)
{
siginfo_t info;
struct rusage ru;
long ret;
mm_segment_t old_fs = get_fs();
info.si_signo = 0;
set_fs (KERNEL_DS);
ret = sys_waitid(which, pid, (siginfo_t __user *) &info, options,
uru ? &ru : NULL);
set_fs (old_fs);
if (ret < 0 || info.si_signo == 0)
return ret;
if (uru && (ret = put_compat_rusage(&ru, uru)))
return ret;
BUG_ON(info.si_code & __SI_MASK);
info.si_code |= __SI_CHLD;
return copy_siginfo_to_user32(uinfo, &info);
}
#ifdef NOTYET /* UNTESTED FOR IA64 FROM HERE DOWN */
asmlinkage long sys32_setreuid(compat_uid_t ruid, compat_uid_t euid)
......
......@@ -62,7 +62,7 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
struct acpi_vendor_info info;
info.descriptor = id;
info.data = 0;
info.data = NULL;
acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match, &info);
if (!info.data)
......
......@@ -178,8 +178,8 @@ acpi_parse_lapic_addr_ovr (
return -EINVAL;
if (lapic->address) {
iounmap((void *) ipi_base_addr);
ipi_base_addr = (unsigned long) ioremap(lapic->address, 0);
iounmap(ipi_base_addr);
ipi_base_addr = ioremap(lapic->address, 0);
}
return 0;
}
......@@ -336,9 +336,9 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size)
/* Get base address of IPI Message Block */
if (acpi_madt->lapic_address)
ipi_base_addr = (unsigned long) ioremap(acpi_madt->lapic_address, 0);
ipi_base_addr = ioremap(acpi_madt->lapic_address, 0);
printk(KERN_INFO PREFIX "Local APIC address 0x%lx\n", ipi_base_addr);
printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr);
acpi_madt_oem_check(acpi_madt->header.oem_id,
acpi_madt->header.oem_table_id);
......
......@@ -34,6 +34,11 @@ void foo(void)
BLANK();
DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));
BLANK();
DEFINE(IA64_TASK_BLOCKED_OFFSET,offsetof (struct task_struct, blocked));
DEFINE(IA64_TASK_CLEAR_CHILD_TID_OFFSET,offsetof (struct task_struct, clear_child_tid));
DEFINE(IA64_TASK_GROUP_LEADER_OFFSET, offsetof (struct task_struct, group_leader));
......
......@@ -48,7 +48,7 @@ static efi_status_t \
prefix##_get_time (efi_time_t *tm, efi_time_cap_t *tc) \
{ \
struct ia64_fpreg fr[6]; \
efi_time_cap_t *atc = 0; \
efi_time_cap_t *atc = NULL; \
efi_status_t ret; \
\
if (tc) \
......@@ -91,7 +91,7 @@ static efi_status_t \
prefix##_set_wakeup_time (efi_bool_t enabled, efi_time_t *tm) \
{ \
struct ia64_fpreg fr[6]; \
efi_time_t *atm = 0; \
efi_time_t *atm = NULL; \
efi_status_t ret; \
\
if (tm) \
......@@ -109,7 +109,7 @@ prefix##_get_variable (efi_char16_t *name, efi_guid_t *vendor, u32 *attr, \
unsigned long *data_size, void *data) \
{ \
struct ia64_fpreg fr[6]; \
u32 *aattr = 0; \
u32 *aattr = NULL; \
efi_status_t ret; \
\
if (attr) \
......@@ -172,7 +172,7 @@ prefix##_reset_system (int reset_type, efi_status_t status, \
unsigned long data_size, efi_char16_t *data) \
{ \
struct ia64_fpreg fr[6]; \
efi_char16_t *adata = 0; \
efi_char16_t *adata = NULL; \
\
if (data) \
adata = adjust_arg(data); \
......@@ -214,7 +214,7 @@ efi_gettimeofday (struct timespec *ts)
efi_time_t tm;
memset(ts, 0, sizeof(ts));
if ((*efi.get_time)(&tm, 0) != EFI_SUCCESS)
if ((*efi.get_time)(&tm, NULL) != EFI_SUCCESS)
return;
ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second);
......
......@@ -104,7 +104,7 @@ static spinlock_t iosapic_lock = SPIN_LOCK_UNLOCKED;
/* These tables map IA-64 vectors to the IOSAPIC pin that generates this vector. */
static struct iosapic_intr_info {
char *addr; /* base address of IOSAPIC */
char __iomem *addr; /* base address of IOSAPIC */
u32 low32; /* current value of low word of Redirection table entry */
unsigned int gsi_base; /* first GSI assigned to this IOSAPIC */
char rte_index; /* IOSAPIC RTE index (-1 => not an IOSAPIC interrupt) */
......@@ -114,7 +114,7 @@ static struct iosapic_intr_info {
} iosapic_intr_info[IA64_NUM_VECTORS];
static struct iosapic {
char *addr; /* base address of IOSAPIC */
char __iomem *addr; /* base address of IOSAPIC */
unsigned int gsi_base; /* first GSI assigned to this IOSAPIC */
unsigned short num_rte; /* number of RTE in this IOSAPIC */
#ifdef CONFIG_NUMA
......@@ -179,7 +179,7 @@ set_rte (unsigned int vector, unsigned int dest, int mask)
{
unsigned long pol, trigger, dmode, flags;
u32 low32, high32;
char *addr;
char __iomem *addr;
int rte_index;
char redir;
......@@ -237,7 +237,7 @@ static void
mask_irq (unsigned int irq)
{
unsigned long flags;
char *addr;
char __iomem *addr;
u32 low32;
int rte_index;
ia64_vector vec = irq_to_vector(irq);
......@@ -261,7 +261,7 @@ static void
unmask_irq (unsigned int irq)
{
unsigned long flags;
char *addr;
char __iomem *addr;
u32 low32;
int rte_index;
ia64_vector vec = irq_to_vector(irq);
......@@ -287,7 +287,7 @@ iosapic_set_affinity (unsigned int irq, cpumask_t mask)
unsigned long flags;
u32 high32, low32;
int dest, rte_index;
char *addr;
char __iomem *addr;
int redir = (irq & IA64_IRQ_REDIRECTED) ? 1 : 0;
ia64_vector vec;
......@@ -412,7 +412,7 @@ struct hw_interrupt_type irq_type_iosapic_edge = {
};
unsigned int
iosapic_version (char *addr)
iosapic_version (char __iomem *addr)
{
/*
* IOSAPIC Version Register return 32 bit structure like:
......@@ -457,7 +457,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
int rte_index;
int index;
unsigned long gsi_base;
char *iosapic_address;
void __iomem *iosapic_address;
index = find_iosapic(gsi);
if (index < 0) {
......@@ -696,7 +696,7 @@ iosapic_init (unsigned long phys_addr, unsigned int gsi_base)
{
int num_rte;
unsigned int isa_irq, ver;
char *addr;
char __iomem *addr;
addr = ioremap(phys_addr, 0);
ver = iosapic_version(addr);
......
......@@ -966,7 +966,7 @@ static int irq_affinity_read_proc (char *page, char **start, off_t off,
return len;
}
static int irq_affinity_write_proc (struct file *file, const char *buffer,
static int irq_affinity_write_proc (struct file *file, const char __user *buffer,
unsigned long count, void *data)
{
unsigned int irq = (unsigned long) data;
......@@ -1180,7 +1180,7 @@ void init_irq_proc (void)
int i;
/* create /proc/irq */
root_irq_dir = proc_mkdir("irq", 0);
root_irq_dir = proc_mkdir("irq", NULL);
/* create /proc/irq/prof_cpu_mask */
create_prof_cpu_mask(root_irq_dir);
......
......@@ -47,7 +47,8 @@
#define IRQ_DEBUG 0
/* default base addr of IPI table */
unsigned long ipi_base_addr = (__IA64_UNCACHED_OFFSET | IA64_IPI_DEFAULT_BASE_ADDR);
void __iomem *ipi_base_addr = ((void __iomem *)
(__IA64_UNCACHED_OFFSET | IA64_IPI_DEFAULT_BASE_ADDR));
/*
* Legacy IRQ to IA-64 vector translation table.
......@@ -254,7 +255,7 @@ init_IRQ (void)
void
ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect)
{
unsigned long ipi_addr;
void __iomem *ipi_addr;
unsigned long ipi_data;
unsigned long phys_cpu_id;
......@@ -269,7 +270,7 @@ ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect)
*/
ipi_data = (delivery_mode << 8) | (vector & 0xff);
ipi_addr = ipi_base_addr | (phys_cpu_id << 4) | ((redirect & 1) << 3);
ipi_addr = ipi_base_addr + ((phys_cpu_id << 4) | ((redirect & 1) << 3));
writeq(ipi_data, ipi_addr);
}
......@@ -195,10 +195,10 @@ apply_imm22 (struct module *mod, struct insn *insn, uint64_t val)
printk(KERN_ERR "%s: value %li out of IMM22 range\n", mod->name, (int64_t)val);
return 0;
}
ia64_patch((u64) insn, 0x01fffcfe000, ( ((val & 0x200000) << 15) /* bit 21 -> 36 */
| ((val & 0x1f0000) << 6) /* bit 16 -> 22 */
| ((val & 0x00ff80) << 20) /* bit 7 -> 27 */
| ((val & 0x00007f) << 13) /* bit 0 -> 13 */));
ia64_patch((u64) insn, 0x01fffcfe000UL, ( ((val & 0x200000UL) << 15) /* bit 21 -> 36 */
| ((val & 0x1f0000UL) << 6) /* bit 16 -> 22 */
| ((val & 0x00ff80UL) << 20) /* bit 7 -> 27 */
| ((val & 0x00007fUL) << 13) /* bit 0 -> 13 */));
return 1;
}
......@@ -209,8 +209,8 @@ apply_imm21b (struct module *mod, struct insn *insn, uint64_t val)
printk(KERN_ERR "%s: value %li out of IMM21b range\n", mod->name, (int64_t)val);
return 0;
}
ia64_patch((u64) insn, 0x11ffffe000, ( ((val & 0x100000) << 16) /* bit 20 -> 36 */
| ((val & 0x0fffff) << 13) /* bit 0 -> 13 */));
ia64_patch((u64) insn, 0x11ffffe000UL, ( ((val & 0x100000UL) << 16) /* bit 20 -> 36 */
| ((val & 0x0fffffUL) << 13) /* bit 0 -> 13 */));
return 1;
}
......@@ -253,9 +253,9 @@ plt_target (struct plt_entry *plt)
long off;
b0 = b[0]; b1 = b[1];
off = ( ((b1 & 0x00fffff000000000) >> 36) /* imm20b -> bit 0 */
| ((b0 >> 48) << 20) | ((b1 & 0x7fffff) << 36) /* imm39 -> bit 20 */
| ((b1 & 0x0800000000000000) << 0)); /* i -> bit 59 */
off = ( ((b1 & 0x00fffff000000000UL) >> 36) /* imm20b -> bit 0 */
| ((b0 >> 48) << 20) | ((b1 & 0x7fffffUL) << 36) /* imm39 -> bit 20 */
| ((b1 & 0x0800000000000000UL) << 0)); /* i -> bit 59 */
return (long) plt->bundle[1] + 16*off;
}
......@@ -739,7 +739,7 @@ do_reloc (struct module *mod, uint8_t r_type, Elf64_Sym *sym, uint64_t addend,
if (gp_addressable(mod, val)) {
/* turn "ld8" into "mov": */
DEBUGP("%s: patching ld8 at %p to mov\n", __FUNCTION__, location);
ia64_patch((u64) location, 0x1fff80fe000, 0x10000000000);
ia64_patch((u64) location, 0x1fff80fe000UL, 0x10000000000UL);
}
return 0;
......
......@@ -446,7 +446,7 @@ register_info(char *page)
"RSE stacked physical registers : %ld\n"
"RSE load/store hints : %ld (%s)\n",
phys_stacked, hints.ph_data,
hints.ph_data < RSE_HINTS_COUNT ? rse_hints[hints.ph_data]: "(\?\?)");
hints.ph_data < RSE_HINTS_COUNT ? rse_hints[hints.ph_data]: "(??)");
if (ia64_pal_debug_info(&iregs, &dregs))
return 0;
......
......@@ -65,21 +65,21 @@ void
ia64_patch_imm64 (u64 insn_addr, u64 val)
{
ia64_patch(insn_addr,
0x01fffefe000, ( ((val & 0x8000000000000000) >> 27) /* bit 63 -> 36 */
| ((val & 0x0000000000200000) << 0) /* bit 21 -> 21 */
| ((val & 0x00000000001f0000) << 6) /* bit 16 -> 22 */
| ((val & 0x000000000000ff80) << 20) /* bit 7 -> 27 */
| ((val & 0x000000000000007f) << 13) /* bit 0 -> 13 */));
ia64_patch(insn_addr - 1, 0x1ffffffffff, val >> 22);
0x01fffefe000UL, ( ((val & 0x8000000000000000UL) >> 27) /* bit 63 -> 36 */
| ((val & 0x0000000000200000UL) << 0) /* bit 21 -> 21 */
| ((val & 0x00000000001f0000UL) << 6) /* bit 16 -> 22 */
| ((val & 0x000000000000ff80UL) << 20) /* bit 7 -> 27 */
| ((val & 0x000000000000007fUL) << 13) /* bit 0 -> 13 */));
ia64_patch(insn_addr - 1, 0x1ffffffffffUL, val >> 22);
}
void
ia64_patch_imm60 (u64 insn_addr, u64 val)
{
ia64_patch(insn_addr,
0x011ffffe000, ( ((val & 0x0800000000000000) >> 23) /* bit 59 -> 36 */
| ((val & 0x00000000000fffff) << 13) /* bit 0 -> 13 */));
ia64_patch(insn_addr - 1, 0x1fffffffffc, val >> 18);
0x011ffffe000UL, ( ((val & 0x0800000000000000UL) >> 23) /* bit 59 -> 36 */
| ((val & 0x00000000000fffffUL) << 13) /* bit 0 -> 13 */));
ia64_patch(insn_addr - 1, 0x1fffffffffcUL, val >> 18);
}
/*
......@@ -130,10 +130,10 @@ ia64_patch_mckinley_e9 (unsigned long start, unsigned long end)
while (offp < (s32 *) end) {
wp = (u64 *) ia64_imva((char *) offp + *offp);
wp[0] = 0x0000000100000000; /* nop.m 0; nop.i 0; nop.i 0 */
wp[1] = 0x0004000000000200;
wp[2] = 0x0000000100000011; /* nop.m 0; nop.i 0; br.ret.sptk.many b6 */
wp[3] = 0x0084006880000200;
wp[0] = 0x0000000100000000UL; /* nop.m 0; nop.i 0; nop.i 0 */
wp[1] = 0x0004000000000200UL;
wp[2] = 0x0000000100000011UL; /* nop.m 0; nop.i 0; br.ret.sptk.many b6 */
wp[3] = 0x0084006880000200UL;
ia64_fc(wp); ia64_fc(wp + 2);
++offp;
}
......
......@@ -1513,7 +1513,7 @@ exit_pfm_fs(void)
}
static ssize_t
pfm_read(struct file *filp, char *buf, size_t size, loff_t *ppos)
pfm_read(struct file *filp, char __user *buf, size_t size, loff_t *ppos)
{
pfm_context_t *ctx;
pfm_msg_t *msg;
......@@ -1606,7 +1606,7 @@ pfm_read(struct file *filp, char *buf, size_t size, loff_t *ppos)
}
static ssize_t
pfm_write(struct file *file, const char *ubuf,
pfm_write(struct file *file, const char __user *ubuf,
size_t size, loff_t *ppos)
{
DPRINT(("pfm_write called\n"));
......@@ -1678,7 +1678,6 @@ static int
pfm_fasync(int fd, struct file *filp, int on)
{
pfm_context_t *ctx;
unsigned long flags;
int ret;
if (PFM_IS_FILE(filp) == 0) {
......@@ -1691,19 +1690,21 @@ pfm_fasync(int fd, struct file *filp, int on)
printk(KERN_ERR "perfmon: pfm_fasync NULL ctx [%d]\n", current->pid);
return -EBADF;
}
PROTECT_CTX(ctx, flags);
/*
* we cannot mask interrupts during this call because this may
* may go to sleep if memory is not readily avalaible.
*
* We are protected from the conetxt disappearing by the get_fd()/put_fd()
* done in caller. Serialization of this function is ensured by caller.
*/
ret = pfm_do_fasync(fd, filp, ctx, on);
DPRINT(("pfm_fasync called on ctx_fd=%d on=%d async_queue=%p ret=%d\n",
fd,
on,
ctx->ctx_async_queue, ret));
UNPROTECT_CTX(ctx, flags);
return ret;
}
......@@ -4796,7 +4797,7 @@ pfm_check_task_state(pfm_context_t *ctx, int cmd, unsigned long flags)
* system-call entry point (must return long)
*/
asmlinkage long
sys_perfmonctl (int fd, int cmd, void *arg, int count, long arg5, long arg6, long arg7,
sys_perfmonctl (int fd, int cmd, void __user *arg, int count, long arg5, long arg6, long arg7,
long arg8, long stack)
{
struct pt_regs *regs = (struct pt_regs *)&stack;
......
......@@ -74,12 +74,12 @@ void
show_stack (struct task_struct *task, unsigned long *sp)
{
if (!task)
unw_init_running(ia64_do_show_stack, 0);
unw_init_running(ia64_do_show_stack, NULL);
else {
struct unw_frame_info info;
unw_init_from_blocked_task(&info, task);
ia64_do_show_stack(&info, 0);
ia64_do_show_stack(&info, NULL);
}
}
......@@ -138,7 +138,7 @@ show_regs (struct pt_regs *regs)
ndirty = (regs->loadrs >> 19);
bsp = ia64_rse_skip_regs((unsigned long *) regs->ar_bspstore, ndirty);
for (i = 0; i < sof; ++i) {
get_user(val, ia64_rse_skip_regs(bsp, i));
get_user(val, (unsigned long __user *) ia64_rse_skip_regs(bsp, i));
printk("r%-3u:%c%016lx%s", 32 + i, is_nat ? '*' : ' ', val,
((i == sof - 1) || (i % 3) == 2) ? "\n" : " ");
}
......@@ -610,16 +610,18 @@ dump_fpu (struct pt_regs *pt, elf_fpregset_t dst)
}
asmlinkage long
sys_execve (char *filename, char **argv, char **envp, struct pt_regs *regs)
sys_execve (char __user *filename, char __user * __user *argv, char __user * __user *envp,
struct pt_regs *regs)
{
char *fname;
int error;
filename = getname(filename);
error = PTR_ERR(filename);
if (IS_ERR(filename))
fname = getname(filename);
error = PTR_ERR(fname);
if (IS_ERR(fname))
goto out;
error = do_execve(filename, argv, envp, regs);
putname(filename);
error = do_execve(fname, argv, envp, regs);
putname(fname);
out:
return error;
}
......@@ -751,7 +753,7 @@ cpu_halt (void)
void
machine_restart (char *restart_cmd)
{
(*efi.reset_system)(EFI_RESET_WARM, 0, 0, 0);
(*efi.reset_system)(EFI_RESET_WARM, 0, 0, NULL);
}
EXPORT_SYMBOL(machine_restart);
......
......@@ -152,7 +152,7 @@ ia64_increment_ip (struct pt_regs *regs)
ri = 0;
regs->cr_iip += 16;
} else if (ri == 2) {
get_user(w0, (char *) regs->cr_iip + 0);
get_user(w0, (char __user *) regs->cr_iip + 0);
if (((w0 >> 1) & 0xf) == IA64_MLX_TEMPLATE) {
/*
* rfi'ing to slot 2 of an MLX bundle causes
......@@ -174,7 +174,7 @@ ia64_decrement_ip (struct pt_regs *regs)
if (ia64_psr(regs)->ri == 0) {
regs->cr_iip -= 16;
ri = 2;
get_user(w0, (char *) regs->cr_iip + 0);
get_user(w0, (char __user *) regs->cr_iip + 0);
if (((w0 >> 1) & 0xf) == IA64_MLX_TEMPLATE) {
/*
* rfi'ing to slot 2 of an MLX bundle causes
......@@ -833,7 +833,7 @@ access_uarea (struct task_struct *child, unsigned long addr, unsigned long *data
case PT_CFM:
urbs_end = ia64_get_user_rbs_end(child, pt, &cfm);
if (write_access) {
if (((cfm ^ *data) & 0x3fffffffffU) != 0) {
if (((cfm ^ *data) & 0x3fffffffffUL) != 0) {
if (ia64_sync_user_rbs(child, sw,
pt->ar_bspstore, urbs_end) < 0)
return -1;
......@@ -997,12 +997,14 @@ access_uarea (struct task_struct *child, unsigned long addr, unsigned long *data
}
static long
ptrace_getregs (struct task_struct *child, struct pt_all_user_regs *ppr)
ptrace_getregs (struct task_struct *child, struct pt_all_user_regs __user *ppr)
{
unsigned long psr, ec, lc, rnat, bsp, cfm, nat_bits, val;
struct unw_frame_info info;
struct ia64_fpreg fpval;
struct switch_stack *sw;
struct pt_regs *pt;
long ret, retval;
struct unw_frame_info info;
char nat = 0;
int i;
......@@ -1023,12 +1025,21 @@ ptrace_getregs (struct task_struct *child, struct pt_all_user_regs *ppr)
return -EIO;
}
if (access_uarea(child, PT_CR_IPSR, &psr, 0) < 0
|| access_uarea(child, PT_AR_EC, &ec, 0) < 0
|| access_uarea(child, PT_AR_LC, &lc, 0) < 0
|| access_uarea(child, PT_AR_RNAT, &rnat, 0) < 0
|| access_uarea(child, PT_AR_BSP, &bsp, 0) < 0
|| access_uarea(child, PT_CFM, &cfm, 0)
|| access_uarea(child, PT_NAT_BITS, &nat_bits, 0))
return -EIO;
retval = 0;
/* control regs */
retval |= __put_user(pt->cr_iip, &ppr->cr_iip);
retval |= access_uarea(child, PT_CR_IPSR, &ppr->cr_ipsr, 0);
retval |= __put_user(psr, &ppr->cr_ipsr);
/* app regs */
......@@ -1039,11 +1050,11 @@ ptrace_getregs (struct task_struct *child, struct pt_all_user_regs *ppr)
retval |= __put_user(pt->ar_ccv, &ppr->ar[PT_AUR_CCV]);
retval |= __put_user(pt->ar_fpsr, &ppr->ar[PT_AUR_FPSR]);
retval |= access_uarea(child, PT_AR_EC, &ppr->ar[PT_AUR_EC], 0);
retval |= access_uarea(child, PT_AR_LC, &ppr->ar[PT_AUR_LC], 0);
retval |= access_uarea(child, PT_AR_RNAT, &ppr->ar[PT_AUR_RNAT], 0);
retval |= access_uarea(child, PT_AR_BSP, &ppr->ar[PT_AUR_BSP], 0);
retval |= access_uarea(child, PT_CFM, &ppr->cfm, 0);
retval |= __put_user(ec, &ppr->ar[PT_AUR_EC]);
retval |= __put_user(lc, &ppr->ar[PT_AUR_LC]);
retval |= __put_user(rnat, &ppr->ar[PT_AUR_RNAT]);
retval |= __put_user(bsp, &ppr->ar[PT_AUR_BSP]);
retval |= __put_user(cfm, &ppr->cfm);
/* gr1-gr3 */
......@@ -1053,7 +1064,9 @@ ptrace_getregs (struct task_struct *child, struct pt_all_user_regs *ppr)
/* gr4-gr7 */
for (i = 4; i < 8; i++) {
retval |= unw_access_gr(&info, i, &ppr->gr[i], &nat, 0);
if (unw_access_gr(&info, i, &val, &nat, 0) < 0)
return -EIO;
retval |= __put_user(val, &ppr->gr[i]);
}
/* gr8-gr11 */
......@@ -1077,7 +1090,9 @@ ptrace_getregs (struct task_struct *child, struct pt_all_user_regs *ppr)
/* b1-b5 */
for (i = 1; i < 6; i++) {
retval |= unw_access_br(&info, i, &ppr->br[i], 0);
if (unw_access_br(&info, i, &val, 0) < 0)
return -EIO;
__put_user(val, &ppr->br[i]);
}
/* b6-b7 */
......@@ -1088,8 +1103,9 @@ ptrace_getregs (struct task_struct *child, struct pt_all_user_regs *ppr)
/* fr2-fr5 */
for (i = 2; i < 6; i++) {
retval |= access_fr(&info, i, 0, (unsigned long *) &ppr->fr[i], 0);
retval |= access_fr(&info, i, 1, (unsigned long *) &ppr->fr[i] + 1, 0);
if (unw_get_fr(&info, i, &fpval) < 0)
return -EIO;
retval |= __copy_to_user(&ppr->fr[i], &fpval, sizeof (fpval));
}
/* fr6-fr11 */
......@@ -1103,8 +1119,9 @@ ptrace_getregs (struct task_struct *child, struct pt_all_user_regs *ppr)
/* fr16-fr31 */
for (i = 16; i < 32; i++) {
retval |= access_fr(&info, i, 0, (unsigned long *) &ppr->fr[i], 0);
retval |= access_fr(&info, i, 1, (unsigned long *) &ppr->fr[i] + 1, 0);
if (unw_get_fr(&info, i, &fpval) < 0)
return -EIO;
retval |= __copy_to_user(&ppr->fr[i], &fpval, sizeof (fpval));
}
/* fph */
......@@ -1118,22 +1135,25 @@ ptrace_getregs (struct task_struct *child, struct pt_all_user_regs *ppr)
/* nat bits */
retval |= access_uarea(child, PT_NAT_BITS, &ppr->nat, 0);
retval |= __put_user(nat_bits, &ppr->nat);
ret = retval ? -EIO : 0;
return ret;
}
static long
ptrace_setregs (struct task_struct *child, struct pt_all_user_regs *ppr)
ptrace_setregs (struct task_struct *child, struct pt_all_user_regs __user *ppr)
{
unsigned long psr, ec, lc, rnat, bsp, cfm, nat_bits, val = 0;
struct unw_frame_info info;
struct switch_stack *sw;
struct ia64_fpreg fpval;
struct pt_regs *pt;
long ret, retval;
struct unw_frame_info info;
char nat = 0;
int i;
memset(&fpval, 0, sizeof(fpval));
retval = verify_area(VERIFY_READ, ppr, sizeof(struct pt_all_user_regs));
if (retval != 0) {
return -EIO;
......@@ -1156,7 +1176,7 @@ ptrace_setregs (struct task_struct *child, struct pt_all_user_regs *ppr)
/* control regs */
retval |= __get_user(pt->cr_iip, &ppr->cr_iip);
retval |= access_uarea(child, PT_CR_IPSR, &ppr->cr_ipsr, 1);
retval |= __get_user(psr, &ppr->cr_ipsr);
/* app regs */
......@@ -1167,11 +1187,11 @@ ptrace_setregs (struct task_struct *child, struct pt_all_user_regs *ppr)
retval |= __get_user(pt->ar_ccv, &ppr->ar[PT_AUR_CCV]);
retval |= __get_user(pt->ar_fpsr, &ppr->ar[PT_AUR_FPSR]);
retval |= access_uarea(child, PT_AR_EC, &ppr->ar[PT_AUR_EC], 1);
retval |= access_uarea(child, PT_AR_LC, &ppr->ar[PT_AUR_LC], 1);
retval |= access_uarea(child, PT_AR_RNAT, &ppr->ar[PT_AUR_RNAT], 1);
retval |= access_uarea(child, PT_AR_BSP, &ppr->ar[PT_AUR_BSP], 1);
retval |= access_uarea(child, PT_CFM, &ppr->cfm, 1);
retval |= __get_user(ec, &ppr->ar[PT_AUR_EC]);
retval |= __get_user(lc, &ppr->ar[PT_AUR_LC]);
retval |= __get_user(rnat, &ppr->ar[PT_AUR_RNAT]);
retval |= __get_user(bsp, &ppr->ar[PT_AUR_BSP]);
retval |= __get_user(cfm, &ppr->cfm);
/* gr1-gr3 */
......@@ -1181,11 +1201,9 @@ ptrace_setregs (struct task_struct *child, struct pt_all_user_regs *ppr)
/* gr4-gr7 */
for (i = 4; i < 8; i++) {
long ret = unw_get_gr(&info, i, &ppr->gr[i], &nat);
if (ret < 0) {
return ret;
}
retval |= unw_access_gr(&info, i, &ppr->gr[i], &nat, 1);
retval |= __get_user(val, &ppr->gr[i]);
if (unw_set_gr(&info, i, val, 0) < 0) /* NaT bit will be set via PT_NAT_BITS */
return -EIO;
}
/* gr8-gr11 */
......@@ -1209,7 +1227,8 @@ ptrace_setregs (struct task_struct *child, struct pt_all_user_regs *ppr)
/* b1-b5 */
for (i = 1; i < 6; i++) {
retval |= unw_access_br(&info, i, &ppr->br[i], 1);
retval |= __get_user(val, &ppr->br[i]);
unw_set_br(&info, i, val);
}
/* b6-b7 */
......@@ -1220,8 +1239,9 @@ ptrace_setregs (struct task_struct *child, struct pt_all_user_regs *ppr)
/* fr2-fr5 */
for (i = 2; i < 6; i++) {
retval |= access_fr(&info, i, 0, (unsigned long *) &ppr->fr[i], 1);
retval |= access_fr(&info, i, 1, (unsigned long *) &ppr->fr[i] + 1, 1);
retval |= __copy_from_user(&fpval, &ppr->fr[i], sizeof(fpval));
if (unw_set_fr(&info, i, fpval) < 0)
return -EIO;
}
/* fr6-fr11 */
......@@ -1235,8 +1255,9 @@ ptrace_setregs (struct task_struct *child, struct pt_all_user_regs *ppr)
/* fr16-fr31 */
for (i = 16; i < 32; i++) {
retval |= access_fr(&info, i, 0, (unsigned long *) &ppr->fr[i], 1);
retval |= access_fr(&info, i, 1, (unsigned long *) &ppr->fr[i] + 1, 1);
retval |= __copy_from_user(&fpval, &ppr->fr[i], sizeof(fpval));
if (unw_set_fr(&info, i, fpval) < 0)
return -EIO;
}
/* fph */
......@@ -1250,7 +1271,15 @@ ptrace_setregs (struct task_struct *child, struct pt_all_user_regs *ppr)
/* nat bits */
retval |= access_uarea(child, PT_NAT_BITS, &ppr->nat, 1);
retval |= __get_user(nat_bits, &ppr->nat);
retval |= access_uarea(child, PT_CR_IPSR, &psr, 1);
retval |= access_uarea(child, PT_AR_EC, &ec, 1);
retval |= access_uarea(child, PT_AR_LC, &lc, 1);
retval |= access_uarea(child, PT_AR_RNAT, &rnat, 1);
retval |= access_uarea(child, PT_AR_BSP, &bsp, 1);
retval |= access_uarea(child, PT_CFM, &cfm, 1);
retval |= access_uarea(child, PT_NAT_BITS, &nat_bits, 1);
ret = retval ? -EIO : 0;
return ret;
......@@ -1429,11 +1458,11 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data,
goto out_tsk;
case PTRACE_GETREGS:
ret = ptrace_getregs(child, (struct pt_all_user_regs*) data);
ret = ptrace_getregs(child, (struct pt_all_user_regs __user *) data);
goto out_tsk;
case PTRACE_SETREGS:
ret = ptrace_setregs(child, (struct pt_all_user_regs*) data);
ret = ptrace_setregs(child, (struct pt_all_user_regs __user *) data);
goto out_tsk;
default:
......
......@@ -268,7 +268,7 @@ salinfo_event_open(struct inode *inode, struct file *file)
}
static ssize_t
salinfo_event_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
{
struct inode *inode = file->f_dentry->d_inode;
struct proc_dir_entry *entry = PDE(inode);
......@@ -426,7 +426,7 @@ salinfo_log_new_read(int cpu, struct salinfo_data *data)
}
static ssize_t
salinfo_log_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
salinfo_log_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
{
struct inode *inode = file->f_dentry->d_inode;
struct proc_dir_entry *entry = PDE(inode);
......@@ -483,7 +483,7 @@ salinfo_log_clear(struct salinfo_data *data, int cpu)
}
static ssize_t
salinfo_log_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
salinfo_log_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
{
struct inode *inode = file->f_dentry->d_inode;
struct proc_dir_entry *entry = PDE(inode);
......
......@@ -680,7 +680,7 @@ cpu_init (void)
break;
}
if (ia64_pal_rse_info(&num_phys_stacked, 0) != 0) {
if (ia64_pal_rse_info(&num_phys_stacked, NULL) != 0) {
printk(KERN_WARNING "cpu_init: PAL RSE info failed; assuming 96 physical "
"stacked regs\n");
num_phys_stacked = 96;
......
......@@ -17,7 +17,7 @@ struct sigframe {
* End of architected state.
*/
void *handler; /* pointer to the plabel of the signal handler */
void __user *handler; /* pointer to the plabel of the signal handler */
struct siginfo info;
struct sigcontext sc;
};
......
......@@ -43,7 +43,7 @@
#endif
long
ia64_rt_sigsuspend (sigset_t *uset, size_t sigsetsize, struct sigscratch *scr)
ia64_rt_sigsuspend (sigset_t __user *uset, size_t sigsetsize, struct sigscratch *scr)
{
sigset_t oldset, set;
......@@ -84,7 +84,7 @@ ia64_rt_sigsuspend (sigset_t *uset, size_t sigsetsize, struct sigscratch *scr)
}
asmlinkage long
sys_sigaltstack (const stack_t *uss, stack_t *uoss, long arg2, long arg3, long arg4,
sys_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, long arg2, long arg3, long arg4,
long arg5, long arg6, long arg7, long stack)
{
struct pt_regs *pt = (struct pt_regs *) &stack;
......@@ -93,7 +93,7 @@ sys_sigaltstack (const stack_t *uss, stack_t *uoss, long arg2, long arg3, long a
}
static long
restore_sigcontext (struct sigcontext *sc, struct sigscratch *scr)
restore_sigcontext (struct sigcontext __user *sc, struct sigscratch *scr)
{
unsigned long ip, flags, nat, um, cfm;
long err;
......@@ -155,7 +155,7 @@ restore_sigcontext (struct sigcontext *sc, struct sigscratch *scr)
}
int
copy_siginfo_to_user (siginfo_t *to, siginfo_t *from)
copy_siginfo_to_user (siginfo_t __user *to, siginfo_t *from)
{
if (!access_ok(VERIFY_WRITE, to, sizeof(siginfo_t)))
return -EFAULT;
......@@ -211,12 +211,12 @@ long
ia64_rt_sigreturn (struct sigscratch *scr)
{
extern char ia64_strace_leave_kernel, ia64_leave_kernel;
struct sigcontext *sc;
struct sigcontext __user *sc;
struct siginfo si;
sigset_t set;
long retval;
sc = &((struct sigframe *) (scr->pt.r12 + 16))->sc;
sc = &((struct sigframe __user *) (scr->pt.r12 + 16))->sc;
/*
* When we return to the previously executing context, r8 and r10 have already
......@@ -260,7 +260,7 @@ ia64_rt_sigreturn (struct sigscratch *scr)
* It is more difficult to avoid calling this function than to
* call it and ignore errors.
*/
do_sigaltstack(&sc->sc_stack, 0, scr->pt.r12);
do_sigaltstack(&sc->sc_stack, NULL, scr->pt.r12);
return retval;
give_sigsegv:
......@@ -281,7 +281,7 @@ ia64_rt_sigreturn (struct sigscratch *scr)
* trampoline starts. Everything else is done at the user-level.
*/
static long
setup_sigcontext (struct sigcontext *sc, sigset_t *mask, struct sigscratch *scr)
setup_sigcontext (struct sigcontext __user *sc, sigset_t *mask, struct sigscratch *scr)
{
unsigned long flags = 0, ifs, cfm, nat;
long err;
......@@ -335,7 +335,7 @@ setup_sigcontext (struct sigcontext *sc, sigset_t *mask, struct sigscratch *scr)
err |= __put_user(scr->pt.ar_ccv, &sc->sc_ar_ccv); /* ar.ccv */
err |= __put_user(scr->pt.b7, &sc->sc_br[7]); /* b7 */
err |= __put_user(scr->pt.r14, &sc->sc_gr[14]); /* r14 */
err |= __copy_to_user(&scr->pt.ar_csd, &sc->sc_ar25, 2*8); /* ar.csd & ar.ssd */
err |= __copy_to_user(&sc->sc_ar25, &scr->pt.ar_csd, 2*8); /* ar.csd & ar.ssd */
err |= __copy_to_user(&sc->sc_gr[2], &scr->pt.r2, 2*8); /* r2-r3 */
err |= __copy_to_user(&sc->sc_gr[16], &scr->pt.r16, 16*8); /* r16-r31 */
}
......@@ -352,7 +352,7 @@ rbs_on_sig_stack (unsigned long bsp)
}
static long
force_sigsegv_info (int sig, void *addr)
force_sigsegv_info (int sig, void __user *addr)
{
unsigned long flags;
struct siginfo si;
......@@ -387,14 +387,14 @@ setup_frame (int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set,
{
extern char __kernel_sigtramp[];
unsigned long tramp_addr, new_rbs = 0;
struct sigframe *frame;
struct sigframe __user *frame;
long err;
frame = (void *) scr->pt.r12;
frame = (void __user *) scr->pt.r12;
tramp_addr = (unsigned long) __kernel_sigtramp;
if ((ka->sa.sa_flags & SA_ONSTACK) && sas_ss_flags((unsigned long) frame) == 0) {
frame = (void *) ((current->sas_ss_sp + current->sas_ss_size)
& ~(STACK_ALIGN - 1));
frame = (void __user *) ((current->sas_ss_sp + current->sas_ss_size)
& ~(STACK_ALIGN - 1));
/*
* We need to check for the register stack being on the signal stack
* separately, because it's switched separately (memory stack is switched
......@@ -403,7 +403,7 @@ setup_frame (int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set,
if (!rbs_on_sig_stack(scr->pt.ar_bspstore))
new_rbs = (current->sas_ss_sp + sizeof(long) - 1) & ~(sizeof(long) - 1);
}
frame = (void *) frame - ((sizeof(*frame) + STACK_ALIGN - 1) & ~(STACK_ALIGN - 1));
frame = (void __user *) frame - ((sizeof(*frame) + STACK_ALIGN - 1) & ~(STACK_ALIGN - 1));
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
return force_sigsegv_info(sig, frame);
......
......@@ -225,7 +225,7 @@ smp_send_reschedule (int cpu)
void
smp_flush_tlb_all (void)
{
on_each_cpu((void (*)(void *))local_flush_tlb_all, 0, 1, 1);
on_each_cpu((void (*)(void *))local_flush_tlb_all, NULL, 1, 1);
}
EXPORT_SYMBOL(smp_flush_tlb_all);
......
......@@ -93,7 +93,7 @@ sys_getpagesize (void)
}
asmlinkage unsigned long
ia64_shmat (int shmid, void *shmaddr, int shmflg)
ia64_shmat (int shmid, void __user *shmaddr, int shmflg)
{
unsigned long raddr;
int retval;
......@@ -183,7 +183,7 @@ static inline unsigned long
do_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, unsigned long pgoff)
{
unsigned long roff;
struct file *file = 0;
struct file *file = NULL;
flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
if (!(flags & MAP_ANONYMOUS)) {
......
......@@ -167,7 +167,7 @@ ia64_init_itm (void)
if (status != 0) {
printk(KERN_ERR "SAL_FREQ_BASE_PLATFORM failed: %s\n", ia64_sal_strerror(status));
} else {
status = ia64_pal_freq_ratios(&proc_ratio, 0, &itc_ratio);
status = ia64_pal_freq_ratios(&proc_ratio, NULL, &itc_ratio);
if (status != 0)
printk(KERN_ERR "PAL_FREQ_RATIOS failed with status=%ld\n", status);
}
......
......@@ -112,7 +112,7 @@ ia64_bad_break (unsigned long break_num, struct pt_regs *regs)
int sig, code;
/* SIGILL, SIGFPE, SIGSEGV, and SIGBUS want these field initialized: */
siginfo.si_addr = (void *) (regs->cr_iip + ia64_psr(regs)->ri);
siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri);
siginfo.si_imm = break_num;
siginfo.si_flags = 0; /* clear __ISR_VALID */
siginfo.si_isr = 0;
......@@ -282,7 +282,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
fault_ip = regs->cr_iip;
if (!fp_fault && (ia64_psr(regs)->ri == 0))
fault_ip -= 16;
if (copy_from_user(bundle, (void *) fault_ip, sizeof(bundle)))
if (copy_from_user(bundle, (void __user *) fault_ip, sizeof(bundle)))
return -1;
if (jiffies - last_time > 5*HZ)
......@@ -312,7 +312,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
siginfo.si_signo = SIGFPE;
siginfo.si_errno = 0;
siginfo.si_code = __SI_FAULT; /* default code */
siginfo.si_addr = (void *) (regs->cr_iip + ia64_psr(regs)->ri);
siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri);
if (isr & 0x11) {
siginfo.si_code = FPE_FLTINV;
} else if (isr & 0x22) {
......@@ -336,7 +336,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
siginfo.si_signo = SIGFPE;
siginfo.si_errno = 0;
siginfo.si_code = __SI_FAULT; /* default code */
siginfo.si_addr = (void *) (regs->cr_iip + ia64_psr(regs)->ri);
siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri);
if (isr & 0x880) {
siginfo.si_code = FPE_FLTOVF;
} else if (isr & 0x1100) {
......@@ -383,7 +383,7 @@ ia64_illegal_op_fault (unsigned long ec, unsigned long arg1, unsigned long arg2,
memset(&si, 0, sizeof(si));
si.si_signo = SIGILL;
si.si_code = ILL_ILLOPC;
si.si_addr = (void *) (regs->cr_iip + ia64_psr(regs)->ri);
si.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri);
force_sig_info(SIGILL, &si, current);
rv.fkt = 0;
return rv;
......@@ -445,18 +445,18 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
case 26: /* NaT Consumption */
if (user_mode(regs)) {
void *addr;
void __user *addr;
if (((isr >> 4) & 0xf) == 2) {
/* NaT page consumption */
sig = SIGSEGV;
code = SEGV_ACCERR;
addr = (void *) ifa;
addr = (void __user *) ifa;
} else {
/* register NaT consumption */
sig = SIGILL;
code = ILL_ILLOPN;
addr = (void *) (regs->cr_iip + ia64_psr(regs)->ri);
addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri);
}
siginfo.si_signo = sig;
siginfo.si_code = code;
......@@ -477,7 +477,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
siginfo.si_signo = SIGILL;
siginfo.si_code = ILL_ILLOPN;
siginfo.si_errno = 0;
siginfo.si_addr = (void *) (regs->cr_iip + ia64_psr(regs)->ri);
siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri);
siginfo.si_imm = vector;
siginfo.si_flags = __ISR_VALID;
siginfo.si_isr = isr;
......@@ -524,7 +524,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
}
siginfo.si_signo = SIGTRAP;
siginfo.si_errno = 0;
siginfo.si_addr = (void *) ifa;
siginfo.si_addr = (void __user *) ifa;
siginfo.si_imm = 0;
siginfo.si_flags = __ISR_VALID;
siginfo.si_isr = isr;
......@@ -538,7 +538,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
siginfo.si_signo = SIGFPE;
siginfo.si_errno = 0;
siginfo.si_code = FPE_FLTINV;
siginfo.si_addr = (void *) (regs->cr_iip + ia64_psr(regs)->ri);
siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri);
siginfo.si_flags = __ISR_VALID;
siginfo.si_isr = isr;
siginfo.si_imm = 0;
......@@ -565,7 +565,8 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
siginfo.si_flags = 0;
siginfo.si_isr = 0;
siginfo.si_imm = 0;
siginfo.si_addr = (void *) (regs->cr_iip + ia64_psr(regs)->ri);
siginfo.si_addr = (void __user *)
(regs->cr_iip + ia64_psr(regs)->ri);
force_sig_info(SIGILL, &siginfo, current);
return;
}
......
......@@ -760,7 +760,7 @@ emulate_load_int (unsigned long ifa, load_store_t ld, struct pt_regs *regs)
return -1;
}
/* this assumes little-endian byte-order: */
if (copy_from_user(&val, (void *) ifa, len))
if (copy_from_user(&val, (void __user *) ifa, len))
return -1;
setreg(ld.r1, val, 0, regs);
......@@ -869,7 +869,7 @@ emulate_store_int (unsigned long ifa, load_store_t ld, struct pt_regs *regs)
*
* extract the value to be stored
*/
getreg(ld.imm, &r2, 0, regs);
getreg(ld.imm, &r2, NULL, regs);
/*
* we rely on the macros in unaligned.h for now i.e.,
......@@ -887,7 +887,7 @@ emulate_store_int (unsigned long ifa, load_store_t ld, struct pt_regs *regs)
}
/* this assumes little-endian byte-order: */
if (copy_to_user((void *) ifa, &r2, len))
if (copy_to_user((void __user *) ifa, &r2, len))
return -1;
/*
......@@ -1036,8 +1036,8 @@ emulate_load_floatpair (unsigned long ifa, load_store_t ld, struct pt_regs *regs
* This assumes little-endian byte-order. Note that there is no "ldfpe"
* instruction:
*/
if (copy_from_user(&fpr_init[0], (void *) ifa, len)
|| copy_from_user(&fpr_init[1], (void *) (ifa + len), len))
if (copy_from_user(&fpr_init[0], (void __user *) ifa, len)
|| copy_from_user(&fpr_init[1], (void __user *) (ifa + len), len))
return -1;
DPRINT("ld.r1=%d ld.imm=%d x6_sz=%d\n", ld.r1, ld.imm, ld.x6_sz);
......@@ -1138,7 +1138,7 @@ emulate_load_float (unsigned long ifa, load_store_t ld, struct pt_regs *regs)
* See comments in ldX for descriptions on how the various loads are handled.
*/
if (ld.x6_op != 0x2) {
if (copy_from_user(&fpr_init, (void *) ifa, len))
if (copy_from_user(&fpr_init, (void __user *) ifa, len))
return -1;
DPRINT("ld.r1=%d x6_sz=%d\n", ld.r1, ld.x6_sz);
......@@ -1230,7 +1230,7 @@ emulate_store_float (unsigned long ifa, load_store_t ld, struct pt_regs *regs)
DDUMP("fpr_init =", &fpr_init, len);
DDUMP("fpr_final =", &fpr_final, len);
if (copy_to_user((void *) ifa, &fpr_final, len))
if (copy_to_user((void __user *) ifa, &fpr_final, len))
return -1;
/*
......@@ -1351,7 +1351,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
DPRINT("iip=%lx ifa=%lx isr=%lx (ei=%d, sp=%d)\n",
regs->cr_iip, ifa, regs->cr_ipsr, ipsr->ri, ipsr->it);
if (__copy_from_user(bundle, (void *) regs->cr_iip, 16))
if (__copy_from_user(bundle, (void __user *) regs->cr_iip, 16))
goto failure;
/*
......@@ -1496,7 +1496,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
si.si_signo = SIGBUS;
si.si_errno = 0;
si.si_code = BUS_ADRALN;
si.si_addr = (void *) ifa;
si.si_addr = (void __user *) ifa;
si.si_flags = 0;
si.si_isr = 0;
si.si_imm = 0;
......
......@@ -446,7 +446,7 @@ EXPORT_SYMBOL(unw_access_br);
int
unw_access_fr (struct unw_frame_info *info, int regnum, struct ia64_fpreg *val, int write)
{
struct ia64_fpreg *addr = 0;
struct ia64_fpreg *addr = NULL;
struct pt_regs *pt;
if ((unsigned) (regnum - 2) >= 126) {
......@@ -842,7 +842,7 @@ desc_prologue (int body, unw_word rlen, unsigned char mask, unsigned char grsave
}
sr->gr_save_loc = grsave;
sr->any_spills = 0;
sr->imask = 0;
sr->imask = NULL;
sr->spill_offset = 0x10; /* default to psp+16 */
}
}
......@@ -1205,7 +1205,7 @@ desc_spill_sprel_p (unsigned char qp, unw_word t, unsigned char abreg, unw_word
static inline unw_hash_index_t
hash (unsigned long ip)
{
# define hashmagic 0x9e3779b97f4a7c16 /* based on (sqrt(5)/2-1)*2^64 */
# define hashmagic 0x9e3779b97f4a7c16UL /* based on (sqrt(5)/2-1)*2^64 */
return (ip >> 4)*hashmagic >> (64 - UNW_LOG_HASH_SIZE);
#undef hashmagic
......@@ -1230,7 +1230,7 @@ script_lookup (struct unw_frame_info *info)
unsigned long ip, pr;
if (UNW_DEBUG_ON(0))
return 0; /* Always regenerate scripts in debug mode */
return NULL; /* Always regenerate scripts in debug mode */
STAT(++unw.stat.cache.lookups);
......@@ -1244,7 +1244,7 @@ script_lookup (struct unw_frame_info *info)
index = unw.hash[hash(ip)];
if (index >= UNW_CACHE_SIZE)
return 0;
return NULL;
script = unw.cache + index;
while (1) {
......@@ -1255,7 +1255,7 @@ script_lookup (struct unw_frame_info *info)
return script;
}
if (script->coll_chain >= UNW_HASH_SIZE)
return 0;
return NULL;
script = unw.cache + script->coll_chain;
STAT(++unw.stat.cache.collision_chain_traversals);
}
......@@ -1305,7 +1305,7 @@ script_new (unsigned long ip)
if (script->ip) {
index = hash(script->ip);
tmp = unw.cache + unw.hash[index];
prev = 0;
prev = NULL;
while (1) {
if (tmp == script) {
if (prev)
......@@ -1510,7 +1510,7 @@ compile_reg (struct unw_state_record *sr, int i, struct unw_script *script)
static inline const struct unw_table_entry *
lookup (struct unw_table *table, unsigned long rel_ip)
{
const struct unw_table_entry *e = 0;
const struct unw_table_entry *e = NULL;
unsigned long lo, hi, mid;
/* do a binary search for right entry: */
......@@ -1536,8 +1536,8 @@ lookup (struct unw_table *table, unsigned long rel_ip)
static inline struct unw_script *
build_script (struct unw_frame_info *info)
{
const struct unw_table_entry *e = 0;
struct unw_script *script = 0;
const struct unw_table_entry *e = NULL;
struct unw_script *script = NULL;
struct unw_labeled_state *ls, *next;
unsigned long ip = info->ip;
struct unw_state_record sr;
......@@ -1562,7 +1562,7 @@ build_script (struct unw_frame_info *info)
if (!script) {
UNW_DPRINT(0, "unwind.%s: failed to create unwind script\n", __FUNCTION__);
STAT(unw.stat.script.build_time += ia64_get_itc() - start);
return 0;
return NULL;
}
unw.cache[info->prev_script].hint = script - unw.cache;
......@@ -1835,7 +1835,7 @@ find_save_locs (struct unw_frame_info *info)
/* don't let obviously bad addresses pollute the cache */
/* FIXME: should really be level 0 but it occurs too often. KAO */
UNW_DPRINT(1, "unwind.%s: rejecting bad ip=0x%lx\n", __FUNCTION__, info->ip);
info->rp_loc = 0;
info->rp_loc = NULL;
return -1;
}
......@@ -2092,12 +2092,12 @@ unw_add_unwind_table (const char *name, unsigned long segment_base, unsigned lon
if (end - start <= 0) {
UNW_DPRINT(0, "unwind.%s: ignoring attempt to insert empty unwind table\n",
__FUNCTION__);
return 0;
return NULL;
}
table = kmalloc(sizeof(*table), GFP_USER);
if (!table)
return 0;
return NULL;
init_unwind_table(table, name, segment_base, gp, table_start, table_end);
......@@ -2299,7 +2299,7 @@ unw_init (void)
* EFAULT BUF points outside your accessible address space.
*/
asmlinkage long
sys_getunwind (void *buf, size_t buf_size)
sys_getunwind (void __user *buf, size_t buf_size)
{
if (buf && buf_size >= unw.gate_table_size)
if (copy_to_user(buf, unw.gate_table, unw.gate_table_size) != 0)
......
/*
* Network Checksum & Copy routine
*
* Copyright (C) 1999, 2003 Hewlett-Packard Co
* Copyright (C) 1999, 2003-2004 Hewlett-Packard Co
* Stephane Eranian <eranian@hpl.hp.com>
*
* Most of the code has been imported from Linux/Alpha
......@@ -105,7 +105,7 @@ unsigned long do_csum_c(const unsigned char * buff, int len, unsigned int psum)
extern unsigned long do_csum(const unsigned char *, long);
static unsigned int
do_csum_partial_copy_from_user (const char *src, char *dst, int len,
do_csum_partial_copy_from_user (const char __user *src, char *dst, int len,
unsigned int psum, int *errp)
{
unsigned long result;
......@@ -129,10 +129,10 @@ do_csum_partial_copy_from_user (const char *src, char *dst, int len,
}
unsigned int
csum_partial_copy_from_user(const char *src, char *dst, int len,
unsigned int sum, int *errp)
csum_partial_copy_from_user (const char __user *src, char *dst, int len,
unsigned int sum, int *errp)
{
if (!access_ok(src, len, VERIFY_READ)) {
if (!access_ok(VERIFY_READ, src, len)) {
*errp = -EFAULT;
memset(dst, 0, len);
return sum;
......@@ -142,7 +142,7 @@ csum_partial_copy_from_user(const char *src, char *dst, int len,
}
unsigned int
csum_partial_copy_nocheck(const char *src, char *dst, int len, unsigned int sum)
csum_partial_copy_nocheck(const char __user *src, char *dst, int len, unsigned int sum)
{
return do_csum_partial_copy_from_user(src, dst, len, sum, NULL);
}
......
......@@ -9,7 +9,7 @@
* This needs to be optimized.
*/
void
__ia64_memcpy_fromio (void *to, unsigned long from, long count)
__ia64_memcpy_fromio (void *to, volatile void __iomem *from, long count)
{
char *dst = to;
......@@ -25,7 +25,7 @@ EXPORT_SYMBOL(__ia64_memcpy_fromio);
* This needs to be optimized.
*/
void
__ia64_memcpy_toio (unsigned long to, void *from, long count)
__ia64_memcpy_toio (volatile void __iomem *to, void *from, long count)
{
char *src = from;
......@@ -41,7 +41,7 @@ EXPORT_SYMBOL(__ia64_memcpy_toio);
* This needs to be optimized.
*/
void
__ia64_memset_c_io (unsigned long dst, unsigned long c, long count)
__ia64_memset_c_io (volatile void __iomem *dst, unsigned long c, long count)
{
unsigned char ch = (char)(c & 0xff);
......@@ -111,49 +111,49 @@ __ia64_outl (unsigned int val, unsigned long port)
}
unsigned char
__ia64_readb (void *addr)
__ia64_readb (void __iomem *addr)
{
return ___ia64_readb (addr);
}
unsigned short
__ia64_readw (void *addr)
__ia64_readw (void __iomem *addr)
{
return ___ia64_readw (addr);
}
unsigned int
__ia64_readl (void *addr)
__ia64_readl (void __iomem *addr)
{
return ___ia64_readl (addr);
}
unsigned long
__ia64_readq (void *addr)
__ia64_readq (void __iomem *addr)
{
return ___ia64_readq (addr);
}
unsigned char
__ia64_readb_relaxed (void *addr)
__ia64_readb_relaxed (void __iomem *addr)
{
return ___ia64_readb (addr);
}
unsigned short
__ia64_readw_relaxed (void *addr)
__ia64_readw_relaxed (void __iomem *addr)
{
return ___ia64_readw (addr);
}
unsigned int
__ia64_readl_relaxed (void *addr)
__ia64_readl_relaxed (void __iomem *addr)
{
return ___ia64_readl (addr);
}
unsigned long
__ia64_readq_relaxed (void *addr)
__ia64_readq_relaxed (void __iomem *addr)
{
return ___ia64_readq (addr);
}
......
......@@ -277,7 +277,7 @@ paging_init (void)
map_size = PAGE_ALIGN(max_low_pfn * sizeof(struct page));
vmalloc_end -= map_size;
vmem_map = (struct page *) vmalloc_end;
efi_memmap_walk(create_mem_map_page_table, 0);
efi_memmap_walk(create_mem_map_page_table, NULL);
mem_map = contig_page_data.node_mem_map = vmem_map;
free_area_init_node(0, &contig_page_data, zones_size,
......
......@@ -77,7 +77,7 @@ search_extable (const struct exception_table_entry *first,
else
last = mid - 1;
}
return 0;
return NULL;
}
void
......
......@@ -196,7 +196,7 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
si.si_signo = signal;
si.si_errno = 0;
si.si_code = code;
si.si_addr = (void *) address;
si.si_addr = (void __user *) address;
si.si_isr = isr;
si.si_flags = __ISR_VALID;
force_sig_info(signal, &si, current);
......
......@@ -67,9 +67,9 @@ check_pgt_cache (void)
if (pgtable_cache_size > (u64) high) {
do {
if (pgd_quicklist)
free_page((unsigned long)pgd_alloc_one_fast(0));
free_page((unsigned long)pgd_alloc_one_fast(NULL));
if (pmd_quicklist)
free_page((unsigned long)pmd_alloc_one_fast(0, 0));
free_page((unsigned long)pmd_alloc_one_fast(NULL, 0));
} while (pgtable_cache_size > (u64) low);
}
preempt_enable();
......@@ -460,9 +460,9 @@ ia64_pfn_valid (unsigned long pfn)
char byte;
struct page *pg = pfn_to_page(pfn);
return (__get_user(byte, (char *) pg) == 0)
return (__get_user(byte, (char __user *) pg) == 0)
&& ((((u64)pg & PAGE_MASK) == (((u64)(pg + 1) - 1) & PAGE_MASK))
|| (__get_user(byte, (char *) (pg + 1) - 1) == 0));
|| (__get_user(byte, (char __user *) (pg + 1) - 1) == 0));
}
EXPORT_SYMBOL(ia64_pfn_valid);
......
......@@ -176,7 +176,7 @@ ia64_tlb_init (void)
if ((status = ia64_pal_vm_page_size(&tr_pgbits, &purge.mask)) != 0) {
printk(KERN_ERR "PAL_VM_PAGE_SIZE failed with status=%ld;"
"defaulting to architected purge page-sizes.\n", status);
purge.mask = 0x115557000;
purge.mask = 0x115557000UL;
}
purge.max_bits = ia64_fls(purge.mask);
......
......@@ -59,8 +59,8 @@ static struct gatt_mask hp_zx1_masks[] =
};
static struct _hp_private {
volatile u8 *ioc_regs;
volatile u8 *lba_regs;
volatile u8 __iomem *ioc_regs;
volatile u8 __iomem *lba_regs;
int lba_cap_offset;
u64 *io_pdir; // PDIR for entire IOVA
u64 *gatt; // PDIR just for GART (subset of above)
......@@ -97,7 +97,7 @@ static int __init hp_zx1_ioc_shared(void)
default:
printk(KERN_ERR PFX "Invalid IOTLB page size "
"configuration 0x%x\n", hp->io_tlb_ps);
hp->gatt = 0;
hp->gatt = NULL;
hp->gatt_entries = 0;
return -ENODEV;
}
......@@ -115,7 +115,7 @@ static int __init hp_zx1_ioc_shared(void)
if (hp->gatt[0] != HP_ZX1_SBA_IOMMU_COOKIE) {
/* Normal case when no AGP device in system */
hp->gatt = 0;
hp->gatt = NULL;
hp->gatt_entries = 0;
printk(KERN_ERR PFX "No reserved IO PDIR entry found; "
"GART disabled\n");
......@@ -183,7 +183,7 @@ hp_zx1_ioc_init (u64 hpa)
}
static int
hp_zx1_lba_find_capability (volatile u8 *hpa, int cap)
hp_zx1_lba_find_capability (volatile u8 __iomem *hpa, int cap)
{
u16 status;
u8 pos, id;
......@@ -267,10 +267,10 @@ hp_zx1_cleanup (void)
if (hp->ioc_regs) {
if (hp->io_pdir_owner)
OUTREG64(hp->ioc_regs, HP_ZX1_IBASE, 0);
iounmap((void *) hp->ioc_regs);
iounmap(hp->ioc_regs);
}
if (hp->lba_regs)
iounmap((void *) hp->lba_regs);
iounmap(hp->lba_regs);
}
static void
......@@ -294,7 +294,7 @@ hp_zx1_create_gatt_table (void)
if (!hp->io_pdir) {
printk(KERN_ERR PFX "Couldn't allocate contiguous "
"memory for I/O PDIR\n");
hp->gatt = 0;
hp->gatt = NULL;
hp->gatt_entries = 0;
return -ENOMEM;
}
......
......@@ -155,7 +155,7 @@ efi_rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
efi_time_t eft;
efi_time_cap_t cap;
struct rtc_time wtime;
struct rtc_wkalrm *ewp;
struct rtc_wkalrm __user *ewp;
unsigned char enabled, pending;
switch (cmd) {
......@@ -189,13 +189,15 @@ efi_rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
convert_from_efi_time(&eft, &wtime);
return copy_to_user((void *)arg, &wtime, sizeof (struct rtc_time)) ? - EFAULT : 0;
return copy_to_user((void __user *)arg, &wtime,
sizeof (struct rtc_time)) ? - EFAULT : 0;
case RTC_SET_TIME:
if (!capable(CAP_SYS_TIME)) return -EACCES;
if (copy_from_user(&wtime, (struct rtc_time *)arg, sizeof(struct rtc_time)) )
if (copy_from_user(&wtime, (struct rtc_time __user *)arg,
sizeof(struct rtc_time)) )
return -EFAULT;
convert_to_efi_time(&wtime, &eft);
......@@ -212,19 +214,19 @@ efi_rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
if (!capable(CAP_SYS_TIME)) return -EACCES;
ewp = (struct rtc_wkalrm *)arg;
ewp = (struct rtc_wkalrm __user *)arg;
if ( get_user(enabled, &ewp->enabled)
|| copy_from_user(&wtime, &ewp->time, sizeof(struct rtc_time)) )
return -EFAULT;
convert_to_efi_time(&wtime, &eft);
spin_lock_irqsave(&efi_rtc_lock, flags);
/*
* XXX Fixme:
* As of EFI 0.92 with the firmware I have on my
* machine this call does not seem to work quite
* machine this call does not seem to work quite
* right
*/
status = efi.set_wakeup_time((efi_bool_t)enabled, &eft);
......@@ -243,14 +245,15 @@ efi_rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
if (status != EFI_SUCCESS) return -EINVAL;
ewp = (struct rtc_wkalrm *)arg;
ewp = (struct rtc_wkalrm __user *)arg;
if ( put_user(enabled, &ewp->enabled)
|| put_user(pending, &ewp->pending)) return -EFAULT;
convert_from_efi_time(&eft, &wtime);
return copy_to_user((void *)&ewp->time, &wtime, sizeof(struct rtc_time)) ? -EFAULT : 0;
return copy_to_user(&ewp->time, &wtime,
sizeof(struct rtc_time)) ? -EFAULT : 0;
}
return -EINVAL;
}
......
......@@ -182,17 +182,17 @@ struct compat_shmid64_ds {
*/
typedef u32 compat_uptr_t;
static inline void *
static inline void __user *
compat_ptr (compat_uptr_t uptr)
{
return (void *) (unsigned long) uptr;
return (void __user *) (unsigned long) uptr;
}
static __inline__ void *
static __inline__ void __user *
compat_alloc_user_space (long len)
{
struct pt_regs *regs = ia64_task_regs(current);
return (void *) (((regs->r12 & 0xffffffff) & -16) - len);
return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len);
}
#endif /* _ASM_IA64_COMPAT_H */
......@@ -4,7 +4,7 @@
/*
* ELF-specific definitions.
*
* Copyright (C) 1998-1999, 2002-2003 Hewlett-Packard Co
* Copyright (C) 1998-1999, 2002-2004 Hewlett-Packard Co
* David Mosberger-Tang <davidm@hpl.hp.com>
*/
......@@ -40,7 +40,7 @@
* the way of the program that it will "exec", and that there is
* sufficient room for the brk.
*/
#define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x800000000)
#define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x800000000UL)
#define PT_IA_64_UNWIND 0x70000001
......@@ -175,7 +175,7 @@ extern void ia64_elf_core_copy_regs (struct pt_regs *src, elf_gregset_t dst);
/* This macro yields a string that ld.so will use to load
implementation specific libraries for optimization. Not terribly
relevant until we have real hardware to play with... */
#define ELF_PLATFORM 0
#define ELF_PLATFORM NULL
/*
* Architecture-neutral AT_ values are in the range 0-17. Leave some room for more of
......
......@@ -259,35 +259,35 @@ register unsigned long ia64_r13 asm ("r13") __attribute_used__;
ia64_intri_res; \
})
#define ia64_xchg1(ptr,x) \
({ \
__u64 ia64_intri_res; \
asm __volatile ("xchg1 %0=[%1],%2" : "=r" (ia64_intri_res) \
: "r" (ptr), "r" (x) : "memory"); \
ia64_intri_res; \
#define ia64_xchg1(ptr,x) \
({ \
__u64 ia64_intri_res; \
asm volatile ("xchg1 %0=[%1],%2" \
: "=r" (ia64_intri_res) : "r" (ptr), "r" (x) : "memory"); \
ia64_intri_res; \
})
#define ia64_xchg2(ptr,x) \
({ \
__u64 ia64_intri_res; \
asm __volatile ("xchg2 %0=[%1],%2" : "=r" (ia64_intri_res) \
: "r" (ptr), "r" (x) : "memory"); \
asm volatile ("xchg2 %0=[%1],%2" : "=r" (ia64_intri_res) \
: "r" (ptr), "r" (x) : "memory"); \
ia64_intri_res; \
})
#define ia64_xchg4(ptr,x) \
({ \
__u64 ia64_intri_res; \
asm __volatile ("xchg4 %0=[%1],%2" : "=r" (ia64_intri_res) \
: "r" (ptr), "r" (x) : "memory"); \
asm volatile ("xchg4 %0=[%1],%2" : "=r" (ia64_intri_res) \
: "r" (ptr), "r" (x) : "memory"); \
ia64_intri_res; \
})
#define ia64_xchg8(ptr,x) \
({ \
__u64 ia64_intri_res; \
asm __volatile ("xchg8 %0=[%1],%2" : "=r" (ia64_intri_res) \
: "r" (ptr), "r" (x) : "memory"); \
asm volatile ("xchg8 %0=[%1],%2" : "=r" (ia64_intri_res) \
: "r" (ptr), "r" (x) : "memory"); \
ia64_intri_res; \
})
......
......@@ -60,4 +60,6 @@
# error HARDIRQ_BITS is too low!
#endif
extern void __iomem *ipi_base_addr;
#endif /* _ASM_IA64_HARDIRQ_H */
......@@ -78,8 +78,6 @@ enum {
extern __u8 isa_irq_to_vector_map[16];
#define isa_irq_to_vector(x) isa_irq_to_vector_map[(x)]
extern unsigned long ipi_base_addr;
extern struct hw_interrupt_type irq_type_ia64_lsapic; /* CPU-internal interrupt controller */
extern int assign_irq_vector (int irq); /* allocate a free vector */
......
......@@ -6,7 +6,7 @@
#include <asm/ptrace.h>
#include <asm/signal.h>
#define IA32_NR_syscalls 283 /* length of syscall table */
#define IA32_NR_syscalls 285 /* length of syscall table */
#define IA32_PAGE_SHIFT 12 /* 4KB pages */
#ifndef __ASSEMBLY__
......
......@@ -23,7 +23,7 @@
#define __SLOW_DOWN_IO do { } while (0)
#define SLOW_DOWN_IO do { } while (0)
#define __IA64_UNCACHED_OFFSET 0xc000000000000000 /* region 6 */
#define __IA64_UNCACHED_OFFSET 0xc000000000000000UL /* region 6 */
/*
* The legacy I/O space defined by the ia64 architecture supports only 65536 ports, but
......@@ -248,7 +248,7 @@ __outsw (unsigned long port, const void *src, unsigned long count)
}
static inline void
__outsl (unsigned long port, void *src, unsigned long count)
__outsl (unsigned long port, const void *src, unsigned long count)
{
const unsigned int *sp = src;
......@@ -290,51 +290,51 @@ __outsl (unsigned long port, void *src, unsigned long count)
* hopefully it'll stay that way).
*/
static inline unsigned char
___ia64_readb (void *addr)
___ia64_readb (const volatile void __iomem *addr)
{
return *(volatile unsigned char *)addr;
return *(volatile unsigned char __force *)addr;
}
static inline unsigned short
___ia64_readw (void *addr)
___ia64_readw (const volatile void __iomem *addr)
{
return *(volatile unsigned short *)addr;
return *(volatile unsigned short __force *)addr;
}
static inline unsigned int
___ia64_readl (void *addr)
___ia64_readl (const volatile void __iomem *addr)
{
return *(volatile unsigned int *) addr;
return *(volatile unsigned int __force *) addr;
}
static inline unsigned long
___ia64_readq (void *addr)
___ia64_readq (const volatile void __iomem *addr)
{
return *(volatile unsigned long *) addr;
return *(volatile unsigned long __force *) addr;
}
static inline void
__writeb (unsigned char val, void *addr)
__writeb (unsigned char val, volatile void __iomem *addr)
{
*(volatile unsigned char *) addr = val;
*(volatile unsigned char __force *) addr = val;
}
static inline void
__writew (unsigned short val, void *addr)
__writew (unsigned short val, volatile void __iomem *addr)
{
*(volatile unsigned short *) addr = val;
*(volatile unsigned short __force *) addr = val;
}
static inline void
__writel (unsigned int val, void *addr)
__writel (unsigned int val, volatile void __iomem *addr)
{
*(volatile unsigned int *) addr = val;
*(volatile unsigned int __force *) addr = val;
}
static inline void
__writeq (unsigned long val, void *addr)
__writeq (unsigned long val, volatile void __iomem *addr)
{
*(volatile unsigned long *) addr = val;
*(volatile unsigned long __force *) addr = val;
}
#define __readb platform_readb
......@@ -346,14 +346,14 @@ __writeq (unsigned long val, void *addr)
#define __readl_relaxed platform_readl_relaxed
#define __readq_relaxed platform_readq_relaxed
#define readb(a) __readb((void *)(a))
#define readw(a) __readw((void *)(a))
#define readl(a) __readl((void *)(a))
#define readq(a) __readq((void *)(a))
#define readb_relaxed(a) __readb_relaxed((void *)(a))
#define readw_relaxed(a) __readw_relaxed((void *)(a))
#define readl_relaxed(a) __readl_relaxed((void *)(a))
#define readq_relaxed(a) __readq_relaxed((void *)(a))
#define readb(a) __readb((a))
#define readw(a) __readw((a))
#define readl(a) __readl((a))
#define readq(a) __readq((a))
#define readb_relaxed(a) __readb_relaxed((a))
#define readw_relaxed(a) __readw_relaxed((a))
#define readl_relaxed(a) __readl_relaxed((a))
#define readq_relaxed(a) __readq_relaxed((a))
#define __raw_readb readb
#define __raw_readw readw
#define __raw_readl readl
......@@ -362,10 +362,10 @@ __writeq (unsigned long val, void *addr)
#define __raw_readw_relaxed readw_relaxed
#define __raw_readl_relaxed readl_relaxed
#define __raw_readq_relaxed readq_relaxed
#define writeb(v,a) __writeb((v), (void *) (a))
#define writew(v,a) __writew((v), (void *) (a))
#define writel(v,a) __writel((v), (void *) (a))
#define writeq(v,a) __writeq((v), (void *) (a))
#define writeb(v,a) __writeb((v), (a))
#define writew(v,a) __writew((v), (a))
#define writel(v,a) __writel((v), (a))
#define writeq(v,a) __writeq((v), (a))
#define __raw_writeb writeb
#define __raw_writew writew
#define __raw_writel writel
......@@ -397,14 +397,14 @@ __writeq (unsigned long val, void *addr)
*
* On ia-64, we access the physical I/O memory space through the uncached kernel region.
*/
static inline void *
static inline void __iomem *
ioremap (unsigned long offset, unsigned long size)
{
return (void *) (__IA64_UNCACHED_OFFSET | (offset));
return (void __iomem *) (__IA64_UNCACHED_OFFSET | (offset));
}
static inline void
iounmap (void *addr)
iounmap (volatile void __iomem *addr)
{
}
......@@ -415,17 +415,14 @@ iounmap (void *addr)
/*
* String version of IO memory access ops:
*/
extern void __ia64_memcpy_fromio (void *, unsigned long, long);
extern void __ia64_memcpy_toio (unsigned long, void *, long);
extern void __ia64_memset_c_io (unsigned long, unsigned long, long);
#define memcpy_fromio(to,from,len) \
__ia64_memcpy_fromio((to),(unsigned long)(from),(len))
#define memcpy_toio(to,from,len) \
__ia64_memcpy_toio((unsigned long)(to),(from),(len))
#define memset_io(addr,c,len) \
__ia64_memset_c_io((unsigned long)(addr),0x0101010101010101UL*(u8)(c),(len))
extern void __ia64_memcpy_fromio (void *, volatile void __iomem *, long);
extern void __ia64_memcpy_toio (volatile void __iomem *, void *, long);
extern void __ia64_memset_c_io (volatile void __iomem *, unsigned long, long);
#define memcpy_fromio(to,from,len) __ia64_memcpy_fromio((to), (from),(len))
#define memcpy_toio(to,from,len) __ia64_memcpy_toio((to),(from),(len))
#define memset_io(addr,c,len) __ia64_memset_c_io((addr), 0x0101010101010101UL*(u8)(c), \
(len))
#define dma_cache_inv(_start,_size) do { } while (0)
#define dma_cache_wback(_start,_size) do { } while (0)
......
......@@ -53,19 +53,19 @@
#define NR_IOSAPICS 256
static inline unsigned int iosapic_read(char *iosapic, unsigned int reg)
static inline unsigned int iosapic_read(char __iomem *iosapic, unsigned int reg)
{
writel(reg, iosapic + IOSAPIC_REG_SELECT);
return readl(iosapic + IOSAPIC_WINDOW);
}
static inline void iosapic_write(char *iosapic, unsigned int reg, u32 val)
static inline void iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
{
writel(reg, iosapic + IOSAPIC_REG_SELECT);
writel(val, iosapic + IOSAPIC_WINDOW);
}
static inline void iosapic_eoi(char *iosapic, u32 vector)
static inline void iosapic_eoi(char __iomem *iosapic, u32 vector)
{
writel(vector, iosapic + IOSAPIC_EOI);
}
......@@ -87,7 +87,7 @@ extern int __init iosapic_register_platform_intr (u32 int_type,
u16 eid, u16 id,
unsigned long polarity,
unsigned long trigger);
extern unsigned int iosapic_version (char *addr);
extern unsigned int iosapic_version (char __iomem *addr);
extern void iosapic_pci_fixup (int);
#ifdef CONFIG_NUMA
......
......@@ -110,7 +110,7 @@ reload_context (mm_context_t context)
unsigned long rid_incr = 0;
unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
old_rr4 = ia64_get_rr(0x8000000000000000);
old_rr4 = ia64_get_rr(0x8000000000000000UL);
rid = context << 3; /* make space for encoding the region number */
rid_incr = 1 << 8;
......@@ -124,11 +124,11 @@ reload_context (mm_context_t context)
rr4 = (rr4 & (~(0xfcUL))) | (old_rr4 & 0xfc);
#endif
ia64_set_rr(0x0000000000000000, rr0);
ia64_set_rr(0x2000000000000000, rr1);
ia64_set_rr(0x4000000000000000, rr2);
ia64_set_rr(0x6000000000000000, rr3);
ia64_set_rr(0x8000000000000000, rr4);
ia64_set_rr(0x0000000000000000UL, rr0);
ia64_set_rr(0x2000000000000000UL, rr1);
ia64_set_rr(0x4000000000000000UL, rr2);
ia64_set_rr(0x6000000000000000UL, rr3);
ia64_set_rr(0x8000000000000000UL, rr4);
ia64_srlz_i(); /* srlz.i implies srlz.d */
}
......
......@@ -123,7 +123,7 @@ typedef union ia64_va {
#define REGION_KERNEL 7
#ifdef CONFIG_HUGETLB_PAGE
# define htlbpage_to_page(x) ((REGION_NUMBER(x) << 61) \
# define htlbpage_to_page(x) (((unsigned long) REGION_NUMBER(x) << 61) \
| (REGION_OFFSET(x) >> (HPAGE_SHIFT-PAGE_SHIFT)))
# define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
# define is_hugepage_only_range(addr, len) \
......@@ -186,7 +186,7 @@ get_order (unsigned long size)
# define __pgprot(x) (x)
#endif /* !STRICT_MM_TYPECHECKS */
#define PAGE_OFFSET 0xe000000000000000
#define PAGE_OFFSET __IA64_UL_CONST(0xe000000000000000)
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC | \
......
......@@ -206,18 +206,18 @@ ia64_phys_addr_valid (unsigned long addr)
#define RGN_SIZE (1UL << 61)
#define RGN_KERNEL 7
#define VMALLOC_START 0xa000000200000000
#define VMALLOC_START 0xa000000200000000UL
#ifdef CONFIG_VIRTUAL_MEM_MAP
# define VMALLOC_END_INIT (0xa000000000000000 + (1UL << (4*PAGE_SHIFT - 9)))
# define VMALLOC_END_INIT (0xa000000000000000UL + (1UL << (4*PAGE_SHIFT - 9)))
# define VMALLOC_END vmalloc_end
extern unsigned long vmalloc_end;
#else
# define VMALLOC_END (0xa000000000000000 + (1UL << (4*PAGE_SHIFT - 9)))
# define VMALLOC_END (0xa000000000000000UL + (1UL << (4*PAGE_SHIFT - 9)))
#endif
/* fs/proc/kcore.c */
#define kc_vaddr_to_offset(v) ((v) - 0xa000000000000000)
#define kc_offset_to_vaddr(o) ((o) + 0xa000000000000000)
#define kc_vaddr_to_offset(v) ((v) - 0xa000000000000000UL)
#define kc_offset_to_vaddr(o) ((o) + 0xa000000000000000UL)
/*
* Conversion functions: convert page frame number (pfn) and a protection value to a page
......
......@@ -28,8 +28,8 @@
#define IA64_NUM_PMC_REGS 32
#define IA64_NUM_PMD_REGS 32
#define DEFAULT_MAP_BASE 0x2000000000000000
#define DEFAULT_TASK_SIZE 0xa000000000000000
#define DEFAULT_MAP_BASE __IA64_UL_CONST(0x2000000000000000)
#define DEFAULT_TASK_SIZE __IA64_UL_CONST(0xa000000000000000)
/*
* TASK_SIZE really is a mis-named. It really is the maximum user
......@@ -200,7 +200,7 @@ typedef struct {
#define GET_UNALIGN_CTL(task,addr) \
({ \
put_user(((task)->thread.flags & IA64_THREAD_UAC_MASK) >> IA64_THREAD_UAC_SHIFT, \
(int *) (addr)); \
(int __user *) (addr)); \
})
#define SET_FPEMU_CTL(task,value) \
......@@ -212,7 +212,7 @@ typedef struct {
#define GET_FPEMU_CTL(task,addr) \
({ \
put_user(((task)->thread.flags & IA64_THREAD_FPEMU_MASK) >> IA64_THREAD_FPEMU_SHIFT, \
(int *) (addr)); \
(int __user *) (addr)); \
})
#ifdef CONFIG_IA32_SUPPORT
......@@ -262,7 +262,7 @@ struct thread_struct {
.fdr = 0, \
.old_k1 = 0, \
.old_iob = 0, \
.ppl = 0,
.ppl = NULL,
#else
# define INIT_THREAD_IA32
#endif /* CONFIG_IA32_SUPPORT */
......
......@@ -60,7 +60,7 @@ typedef struct siginfo {
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
struct {
void *_addr; /* faulting insn/memory ref. */
void __user *_addr; /* faulting insn/memory ref. */
int _imm; /* immediate value for "break" */
unsigned int _flags; /* see below */
unsigned long _isr; /* isr */
......
......@@ -144,10 +144,10 @@
struct siginfo;
/* Type of a signal handler. */
typedef void (*__sighandler_t)(int);
typedef void __user (*__sighandler_t)(int);
typedef struct sigaltstack {
void *ss_sp;
void __user *ss_sp;
int ss_flags;
size_t ss_size;
} stack_t;
......
......@@ -39,7 +39,7 @@ extern struct smp_boot_data {
extern char no_int_routing __devinitdata;
extern cpumask_t cpu_online_map;
extern unsigned long ipi_base_addr;
extern void __iomem *ipi_base_addr;
extern unsigned char smp_int_redirect;
extern volatile int ia64_cpu_to_sapicid[];
......@@ -73,21 +73,21 @@ static inline void
min_xtp (void)
{
if (smp_int_redirect & SMP_IRQ_REDIRECTION)
writeb(0x00, ipi_base_addr | XTP_OFFSET); /* XTP to min */
writeb(0x00, ipi_base_addr + XTP_OFFSET); /* XTP to min */
}
static inline void
normal_xtp (void)
{
if (smp_int_redirect & SMP_IRQ_REDIRECTION)
writeb(0x08, ipi_base_addr | XTP_OFFSET); /* XTP normal */
writeb(0x08, ipi_base_addr + XTP_OFFSET); /* XTP normal */
}
static inline void
max_xtp (void)
{
if (smp_int_redirect & SMP_IRQ_REDIRECTION)
writeb(0x0f, ipi_base_addr | XTP_OFFSET); /* Set XTP to max */
writeb(0x0f, ipi_base_addr + XTP_OFFSET); /* Set XTP to max */
}
static inline unsigned int
......
......@@ -114,8 +114,8 @@ do { \
#define spin_unlock_wait(x) do { barrier(); } while ((x)->lock)
typedef struct {
volatile int read_counter : 31;
volatile int write_lock : 1;
volatile unsigned int read_counter : 31;
volatile unsigned int write_lock : 1;
} rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 }
......
......@@ -19,12 +19,12 @@
#include <asm/pal.h>
#include <asm/percpu.h>
#define GATE_ADDR (0xa000000000000000)
#define GATE_ADDR __IA64_UL_CONST(0xa000000000000000)
/*
* 0xa000000000000000+2*PERCPU_PAGE_SIZE
* - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page)
*/
#define KERNEL_START 0xa000000100000000
#define KERNEL_START __IA64_UL_CONST(0xa000000100000000)
#define PERCPU_ADDR (-PERCPU_PAGE_SIZE)
#ifndef __ASSEMBLY__
......
......@@ -9,14 +9,6 @@
#include <asm/processor.h>
#include <asm/ptrace.h>
#define TI_TASK 0x00
#define TI_EXEC_DOMAIN 0x08
#define TI_FLAGS 0x10
#define TI_CPU 0x14
#define TI_ADDR_LIMIT 0x18
#define TI_PRE_COUNT 0x20
#define TI_RESTART_BLOCK 0x28
#define PREEMPT_ACTIVE_BIT 30
#define PREEMPT_ACTIVE (1 << PREEMPT_ACTIVE_BIT)
......
......@@ -60,14 +60,17 @@
* address TASK_SIZE is never valid. We also need to make sure that the address doesn't
* point inside the virtually mapped linear page table.
*/
#define __access_ok(addr, size, segment) \
(likely((unsigned long) (addr) <= (segment).seg) \
&& ((segment).seg == KERNEL_DS.seg \
|| likely(REGION_OFFSET((unsigned long) (addr)) < RGN_MAP_LIMIT)))
#define __access_ok(addr, size, segment) \
({ \
__chk_user_ptr(addr); \
(likely((unsigned long) (addr) <= (segment).seg) \
&& ((segment).seg == KERNEL_DS.seg \
|| likely(REGION_OFFSET((unsigned long) (addr)) < RGN_MAP_LIMIT))); \
})
#define access_ok(type, addr, size) __access_ok((addr), (size), get_fs())
static inline int
verify_area (int type, const void *addr, unsigned long size)
verify_area (int type, const void __user *addr, unsigned long size)
{
return access_ok(type, addr, size) ? 0 : -EFAULT;
}
......@@ -185,11 +188,11 @@ extern void __get_user_unknown (void);
*/
#define __do_get_user(check, x, ptr, size, segment) \
({ \
const __typeof__(*(ptr)) *__gu_ptr = (ptr); \
const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \
__typeof__ (size) __gu_size = (size); \
long __gu_err = -EFAULT, __gu_val = 0; \
\
if (!check || __access_ok((long) __gu_ptr, size, segment)) \
if (!check || __access_ok(__gu_ptr, size, segment)) \
switch (__gu_size) { \
case 1: __get_user_size(__gu_val, __gu_ptr, 1, __gu_err); break; \
case 2: __get_user_size(__gu_val, __gu_ptr, 2, __gu_err); break; \
......@@ -213,11 +216,11 @@ extern void __put_user_unknown (void);
#define __do_put_user(check, x, ptr, size, segment) \
({ \
__typeof__ (x) __pu_x = (x); \
__typeof__ (*(ptr)) *__pu_ptr = (ptr); \
__typeof__ (*(ptr)) __user *__pu_ptr = (ptr); \
__typeof__ (size) __pu_size = (size); \
long __pu_err = -EFAULT; \
\
if (!check || __access_ok((long) __pu_ptr, __pu_size, segment)) \
if (!check || __access_ok(__pu_ptr, __pu_size, segment)) \
switch (__pu_size) { \
case 1: __put_user_size(__pu_x, __pu_ptr, 1, __pu_err); break; \
case 2: __put_user_size(__pu_x, __pu_ptr, 2, __pu_err); break; \
......@@ -234,44 +237,64 @@ extern void __put_user_unknown (void);
/*
* Complex access routines
*/
extern unsigned long __copy_user (void *to, const void *from, unsigned long count);
extern unsigned long __must_check __copy_user (void __user *to, const void __user *from,
unsigned long count);
#define __copy_to_user(to, from, n) __copy_user((to), (from), (n))
#define __copy_from_user(to, from, n) __copy_user((to), (from), (n))
#define __copy_to_user_inatomic __copy_to_user
#define __copy_from_user_inatomic __copy_from_user
#define copy_to_user(to, from, n) __copy_tofrom_user((to), (from), (n), 1)
#define copy_from_user(to, from, n) __copy_tofrom_user((to), (from), (n), 0)
static inline unsigned long
__copy_to_user (void __user *to, const void *from, unsigned long count)
{
return __copy_user(to, (void __user *) from, count);
}
static inline unsigned long
__copy_from_user (void *to, const void __user *from, unsigned long count)
{
return __copy_user((void __user *) to, from, count);
}
#define __copy_tofrom_user(to, from, n, check_to) \
#define __copy_to_user_inatomic __copy_to_user
#define __copy_from_user_inatomic __copy_from_user
#define copy_to_user(to, from, n) \
({ \
void *__cu_to = (to); \
void __user *__cu_to = (to); \
const void *__cu_from = (from); \
long __cu_len = (n); \
\
if (__access_ok((long) ((check_to) ? __cu_to : __cu_from), __cu_len, get_fs())) \
__cu_len = __copy_user(__cu_to, __cu_from, __cu_len); \
if (__access_ok(__cu_to, __cu_len, get_fs())) \
__cu_len = __copy_user(__cu_to, (void __user *) __cu_from, __cu_len); \
__cu_len; \
})
#define copy_from_user(to, from, n) \
({ \
void *__cu_to = (to); \
const void __user *__cu_from = (from); \
long __cu_len = (n); \
\
__chk_user_ptr(__cu_from); \
if (__access_ok(__cu_from, __cu_len, get_fs())) \
__cu_len = __copy_user((void __user *) __cu_to, __cu_from, __cu_len); \
__cu_len; \
})
#define __copy_in_user(to, from, size) __copy_user((to), (from), (size))
static inline unsigned long
copy_in_user (void *to, const void *from, unsigned long n)
copy_in_user (void __user *to, const void __user *from, unsigned long n)
{
if (likely(access_ok(VERIFY_READ, from, n) && access_ok(VERIFY_WRITE, to, n)))
n = __copy_user(to, from, n);
return n;
}
extern unsigned long __do_clear_user (void *, unsigned long);
extern unsigned long __do_clear_user (void __user *, unsigned long);
#define __clear_user(to, n) __do_clear_user(to, n)
#define clear_user(to, n) \
({ \
unsigned long __cu_len = (n); \
if (__access_ok((long) to, __cu_len, get_fs())) \
if (__access_ok(to, __cu_len, get_fs())) \
__cu_len = __do_clear_user(to, __cu_len); \
__cu_len; \
})
......@@ -281,25 +304,25 @@ extern unsigned long __do_clear_user (void *, unsigned long);
* Returns: -EFAULT if exception before terminator, N if the entire buffer filled, else
* strlen.
*/
extern long __strncpy_from_user (char *to, const char *from, long to_len);
extern long __must_check __strncpy_from_user (char *to, const char __user *from, long to_len);
#define strncpy_from_user(to, from, n) \
({ \
const char * __sfu_from = (from); \
const char __user * __sfu_from = (from); \
long __sfu_ret = -EFAULT; \
if (__access_ok((long) __sfu_from, 0, get_fs())) \
if (__access_ok(__sfu_from, 0, get_fs())) \
__sfu_ret = __strncpy_from_user((to), __sfu_from, (n)); \
__sfu_ret; \
})
/* Returns: 0 if bad, string length+1 (memory size) of string if ok */
extern unsigned long __strlen_user (const char *);
extern unsigned long __strlen_user (const char __user *);
#define strlen_user(str) \
({ \
const char *__su_str = (str); \
const char __user *__su_str = (str); \
unsigned long __su_ret = 0; \
if (__access_ok((long) __su_str, 0, get_fs())) \
if (__access_ok(__su_str, 0, get_fs())) \
__su_ret = __strlen_user(__su_str); \
__su_ret; \
})
......@@ -309,13 +332,13 @@ extern unsigned long __strlen_user (const char *);
* (N), a value greater than N if the limit would be exceeded, else
* strlen.
*/
extern unsigned long __strnlen_user (const char *, long);
extern unsigned long __strnlen_user (const char __user *, long);
#define strnlen_user(str, len) \
({ \
const char *__su_str = (str); \
const char __user *__su_str = (str); \
unsigned long __su_ret = 0; \
if (__access_ok((long) __su_str, 0, get_fs())) \
if (__access_ok(__su_str, 0, get_fs())) \
__su_ret = __strnlen_user(__su_str, len); \
__su_ret; \
})
......
......@@ -369,8 +369,8 @@ asmlinkage unsigned long sys_mmap2(
int fd, long pgoff);
struct pt_regs;
struct sigaction;
asmlinkage long sys_execve(char *filename, char **argv, char **envp,
struct pt_regs *regs);
asmlinkage long sys_execve(char __user *filename, char __user * __user *argv,
char __user * __user *envp, struct pt_regs *regs);
asmlinkage long sys_pipe(long arg0, long arg1, long arg2, long arg3,
long arg4, long arg5, long arg6, long arg7, long stack);
asmlinkage long sys_ptrace(long request, pid_t pid,
......
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