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;
......
This diff is collapsed.
......@@ -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 */
......
This diff is collapsed.
......@@ -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