Commit fe00f943 authored by Ralf Baechle's avatar Ralf Baechle

Sparseify MIPS.

Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 14f18b7f
......@@ -52,6 +52,21 @@ ifdef CONFIG_CROSSCOMPILE
CROSS_COMPILE := $(tool-prefix)
endif
CHECKFLAGS-y += -D__linux__ -D__mips__ \
-D_ABIO32=1 \
-D_ABIN32=2 \
-D_ABI64=3
CHECKFLAGS-$(CONFIG_32BIT) += -D_MIPS_SIM=_ABIO32 \
-D_MIPS_SZLONG=32 \
-D__PTRDIFF_TYPE__=int
CHECKFLAGS-$(CONFIG_64BIT) += -m64 -D_MIPS_SIM=_ABI64 \
-D_MIPS_SZLONG=64 \
-D__PTRDIFF_TYPE__="long int"
CHECKFLAGS-$(CONFIG_CPU_BIG_ENDIAN) += -D__MIPSEB__
CHECKFLAGS-$(CONFIG_CPU_LITTLE_ENDIAN) += -D__MIPSEL__
CHECKFLAGS = $(CHECKFLAGS-y)
ifdef CONFIG_BUILD_ELF64
gas-abi = 64
ld-emul = $(64bit-emul)
......
......@@ -321,7 +321,7 @@ void __init init_i8259_irqs (void)
for (i = 0; i < 16; i++) {
irq_desc[i].status = IRQ_DISABLED;
irq_desc[i].action = 0;
irq_desc[i].action = NULL;
irq_desc[i].depth = 1;
irq_desc[i].handler = &i8259A_irq_type;
}
......
......@@ -147,7 +147,7 @@ static void padzero(unsigned long elf_bss)
nbyte = elf_bss & (PAGE_SIZE-1);
if (nbyte) {
nbyte = PAGE_SIZE - nbyte;
clear_user((void *) elf_bss, nbyte);
clear_user((void __user *) elf_bss, nbyte);
}
}
......@@ -878,10 +878,10 @@ static int load_irix_library(struct file *file)
* phdrs there are in the USER_PHDRP array. We return the vaddr the
* first phdr was successfully mapped to.
*/
unsigned long irix_mapelf(int fd, struct elf_phdr *user_phdrp, int cnt)
unsigned long irix_mapelf(int fd, struct elf_phdr __user *user_phdrp, int cnt)
{
unsigned long type, vaddr, filesz, offset, flags;
struct elf_phdr *hp;
struct elf_phdr __user *hp;
struct file *filp;
int i, retval;
......@@ -968,9 +968,9 @@ unsigned long irix_mapelf(int fd, struct elf_phdr *user_phdrp, int cnt)
/* These are the only things you should do on a core-file: use only these
* functions to write out all the necessary info.
*/
static int dump_write(struct file *file, const void *addr, int nr)
static int dump_write(struct file *file, const void __user *addr, int nr)
{
return file->f_op->write(file, (const char *) addr, nr, &file->f_pos) == nr;
return file->f_op->write(file, (const char __user *) addr, nr, &file->f_pos) == nr;
}
static int dump_seek(struct file *file, off_t off)
......@@ -1204,7 +1204,7 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
len = current->mm->arg_end - current->mm->arg_start;
len = len >= ELF_PRARGSZ ? ELF_PRARGSZ : len;
(void *) copy_from_user(&psinfo.pr_psargs,
(const char *)current->mm->arg_start, len);
(const char __user *)current->mm->arg_start, len);
for (i = 0; i < len; i++)
if (psinfo.pr_psargs[i] == 0)
psinfo.pr_psargs[i] = ' ';
......@@ -1301,7 +1301,7 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
#ifdef DEBUG
printk("elf_core_dump: writing %08lx %lx\n", addr, len);
#endif
DUMP_WRITE((void *)addr, len);
DUMP_WRITE((void __user *)addr, len);
}
if ((off_t) file->f_pos != offset) {
......
......@@ -30,10 +30,10 @@ void add_to_inventory (int class, int type, int controller, int unit, int state)
inventory_items++;
}
int dump_inventory_to_user (void *userbuf, int size)
int dump_inventory_to_user (void __user *userbuf, int size)
{
inventory_t *inv = &inventory [0];
inventory_t *user = userbuf;
inventory_t __user *user = userbuf;
int v;
if (!access_ok(VERIFY_WRITE, userbuf, size))
......@@ -41,7 +41,8 @@ int dump_inventory_to_user (void *userbuf, int size)
for (v = 0; v < inventory_items; v++){
inv = &inventory [v];
copy_to_user (user, inv, sizeof (inventory_t));
if (copy_to_user (user, inv, sizeof (inventory_t)))
return -EFAULT;
user++;
}
return inventory_items * sizeof (inventory_t);
......
This diff is collapsed.
......@@ -38,14 +38,6 @@
#include <asm/isadep.h>
#include <asm/inst.h>
/*
* We use this if we don't have any better idle routine..
* (This to kill: kernel/platform.c.
*/
void default_idle (void)
{
}
/*
* The idle thread. There's no useful work to be done, so just try to conserve
* power and have a low exit latency (ie sit in a loop waiting for somebody to
......
......@@ -103,7 +103,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
ret = -EIO;
if (copied != sizeof(tmp))
break;
ret = put_user(tmp,(unsigned long *) data);
ret = put_user(tmp,(unsigned long __user *) data);
break;
}
......@@ -180,7 +180,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
ret = -EIO;
goto out_tsk;
}
ret = put_user(tmp, (unsigned long *) data);
ret = put_user(tmp, (unsigned long __user *) data);
break;
}
......
......@@ -47,9 +47,10 @@ save_static_function(sys_sigsuspend);
__attribute_used__ noinline static int
_sys_sigsuspend(nabi_no_regargs struct pt_regs regs)
{
sigset_t *uset, saveset, newset;
sigset_t saveset, newset;
sigset_t __user *uset;
uset = (sigset_t *) regs.regs[4];
uset = (sigset_t __user *) regs.regs[4];
if (copy_from_user(&newset, uset, sizeof(sigset_t)))
return -EFAULT;
sigdelsetmask(&newset, ~_BLOCKABLE);
......@@ -75,7 +76,8 @@ save_static_function(sys_rt_sigsuspend);
__attribute_used__ noinline static int
_sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
{
sigset_t *unewset, saveset, newset;
sigset_t saveset, newset;
sigset_t __user *unewset;
size_t sigsetsize;
/* XXX Don't preclude handling different sized sigset_t's. */
......@@ -83,7 +85,7 @@ _sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
if (sigsetsize != sizeof(sigset_t))
return -EINVAL;
unewset = (sigset_t *) regs.regs[4];
unewset = (sigset_t __user *) regs.regs[4];
if (copy_from_user(&newset, unewset, sizeof(newset)))
return -EFAULT;
sigdelsetmask(&newset, ~_BLOCKABLE);
......@@ -147,8 +149,8 @@ asmlinkage int sys_sigaction(int sig, const struct sigaction *act,
asmlinkage int sys_sigaltstack(nabi_no_regargs struct pt_regs regs)
{
const stack_t *uss = (const stack_t *) regs.regs[4];
stack_t *uoss = (stack_t *) regs.regs[5];
const stack_t __user *uss = (const stack_t __user *) regs.regs[4];
stack_t __user *uoss = (stack_t __user *) regs.regs[5];
unsigned long usp = regs.regs[29];
return do_sigaltstack(uss, uoss, usp);
......
This diff is collapsed.
......@@ -339,9 +339,9 @@ asmlinkage void do_be(struct pt_regs *regs)
static inline int get_insn_opcode(struct pt_regs *regs, unsigned int *opcode)
{
unsigned int *epc;
unsigned int __user *epc;
epc = (unsigned int *) regs->cp0_epc +
epc = (unsigned int __user *) regs->cp0_epc +
((regs->cp0_cause & CAUSEF_BD) != 0);
if (!get_user(*opcode, epc))
return 0;
......@@ -371,7 +371,7 @@ static struct task_struct *ll_task = NULL;
static inline void simulate_ll(struct pt_regs *regs, unsigned int opcode)
{
unsigned long value, *vaddr;
unsigned long value, __user *vaddr;
long offset;
int signal = 0;
......@@ -385,7 +385,8 @@ static inline void simulate_ll(struct pt_regs *regs, unsigned int opcode)
offset <<= 16;
offset >>= 16;
vaddr = (unsigned long *)((long)(regs->regs[(opcode & BASE) >> 21]) + offset);
vaddr = (unsigned long __user *)
((unsigned long)(regs->regs[(opcode & BASE) >> 21]) + offset);
if ((unsigned long)vaddr & 3) {
signal = SIGBUS;
......@@ -418,7 +419,8 @@ static inline void simulate_ll(struct pt_regs *regs, unsigned int opcode)
static inline void simulate_sc(struct pt_regs *regs, unsigned int opcode)
{
unsigned long *vaddr, reg;
unsigned long __user *vaddr;
unsigned long reg;
long offset;
int signal = 0;
......@@ -432,7 +434,8 @@ static inline void simulate_sc(struct pt_regs *regs, unsigned int opcode)
offset <<= 16;
offset >>= 16;
vaddr = (unsigned long *)((long)(regs->regs[(opcode & BASE) >> 21]) + offset);
vaddr = (unsigned long __user *)
((unsigned long)(regs->regs[(opcode & BASE) >> 21]) + offset);
reg = (opcode & RT) >> 16;
if ((unsigned long)vaddr & 3) {
......@@ -498,7 +501,7 @@ asmlinkage void do_ov(struct pt_regs *regs)
info.si_code = FPE_INTOVF;
info.si_signo = SIGFPE;
info.si_errno = 0;
info.si_addr = (void *)regs->cp0_epc;
info.si_addr = (void __user *) regs->cp0_epc;
force_sig_info(SIGFPE, &info, current);
}
......@@ -584,7 +587,7 @@ asmlinkage void do_bp(struct pt_regs *regs)
info.si_code = FPE_INTOVF;
info.si_signo = SIGFPE;
info.si_errno = 0;
info.si_addr = (void *)regs->cp0_epc;
info.si_addr = (void __user *) regs->cp0_epc;
force_sig_info(SIGFPE, &info, current);
break;
default:
......@@ -621,7 +624,7 @@ asmlinkage void do_tr(struct pt_regs *regs)
info.si_code = FPE_INTOVF;
info.si_signo = SIGFPE;
info.si_errno = 0;
info.si_addr = (void *)regs->cp0_epc;
info.si_addr = (void __user *) regs->cp0_epc;
force_sig_info(SIGFPE, &info, current);
break;
default:
......
......@@ -94,7 +94,7 @@ unsigned long unaligned_instructions;
#endif
static inline int emulate_load_store_insn(struct pt_regs *regs,
void *addr, unsigned long pc,
void __user *addr, unsigned int __user *pc,
unsigned long **regptr, unsigned long *newvalue)
{
union mips_instruction insn;
......@@ -107,7 +107,7 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
/*
* This load never faults.
*/
__get_user(insn.word, (unsigned int *)pc);
__get_user(insn.word, pc);
switch (insn.i_format.opcode) {
/*
......@@ -494,8 +494,8 @@ asmlinkage void do_ade(struct pt_regs *regs)
{
unsigned long *regptr, newval;
extern int do_dsemulret(struct pt_regs *);
unsigned int __user *pc;
mm_segment_t seg;
unsigned long pc;
/*
* Address errors may be deliberately induced by the FPU emulator to
......@@ -515,7 +515,7 @@ asmlinkage void do_ade(struct pt_regs *regs)
if ((regs->cp0_badvaddr == regs->cp0_epc) || (regs->cp0_epc & 0x1))
goto sigbus;
pc = exception_epc(regs);
pc = (unsigned int __user *) exception_epc(regs);
if ((current->thread.mflags & MF_FIXADE) == 0)
goto sigbus;
......@@ -526,7 +526,7 @@ asmlinkage void do_ade(struct pt_regs *regs)
seg = get_fs();
if (!user_mode(regs))
set_fs(KERNEL_DS);
if (!emulate_load_store_insn(regs, (void *)regs->cp0_badvaddr, pc,
if (!emulate_load_store_insn(regs, (void __user *)regs->cp0_badvaddr, pc,
&regptr, &newval)) {
compute_return_epc(regs);
/*
......
......@@ -33,7 +33,7 @@ unsigned int csum_partial_copy_nocheck(const unsigned char *src,
* Copy from userspace and compute checksum. If we catch an exception
* then zero the rest of the buffer.
*/
unsigned int csum_partial_copy_from_user (const unsigned char *src,
unsigned int csum_partial_copy_from_user (const unsigned char __user *src,
unsigned char *dst, int len, unsigned int sum, int *err_ptr)
{
int missing;
......
......@@ -456,8 +456,8 @@ static void r4k_flush_data_cache_page(unsigned long addr)
}
struct flush_icache_range_args {
unsigned long start;
unsigned long end;
unsigned long __user start;
unsigned long __user end;
};
static inline void local_r4k_flush_icache_range(void *args)
......@@ -519,7 +519,8 @@ static inline void local_r4k_flush_icache_range(void *args)
}
}
static void r4k_flush_icache_range(unsigned long start, unsigned long end)
static void r4k_flush_icache_range(unsigned long __user start,
unsigned long __user end)
{
struct flush_icache_range_args args;
......
......@@ -24,7 +24,8 @@ void (*flush_cache_mm)(struct mm_struct *mm);
void (*flush_cache_range)(struct vm_area_struct *vma, unsigned long start,
unsigned long end);
void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, unsigned long pfn);
void (*flush_icache_range)(unsigned long start, unsigned long end);
void (*flush_icache_range)(unsigned long __user start,
unsigned long __user end);
void (*flush_icache_page)(struct vm_area_struct *vma, struct page *page);
/* MIPS specific cache operations */
......@@ -49,10 +50,10 @@ EXPORT_SYMBOL(_dma_cache_inv);
* We could optimize the case where the cache argument is not BCACHE but
* that seems very atypical use ...
*/
asmlinkage int sys_cacheflush(unsigned long addr, unsigned long int bytes,
unsigned int cache)
asmlinkage int sys_cacheflush(unsigned long __user addr,
unsigned long bytes, unsigned int cache)
{
if (!access_ok(VERIFY_WRITE, (void *) addr, bytes))
if (!access_ok(VERIFY_WRITE, (void __user *) addr, bytes))
return -EFAULT;
flush_icache_range(addr, addr + bytes);
......
......@@ -141,7 +141,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
info.si_signo = SIGSEGV;
info.si_errno = 0;
/* info.si_code has been set above */
info.si_addr = (void *) address;
info.si_addr = (void __user *) address;
force_sig_info(SIGSEGV, &info, tsk);
return;
}
......@@ -197,7 +197,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
info.si_signo = SIGBUS;
info.si_errno = 0;
info.si_code = BUS_ADRERR;
info.si_addr = (void *) address;
info.si_addr = (void __user *) address;
force_sig_info(SIGBUS, &info, tsk);
return;
......
......@@ -49,7 +49,8 @@ static inline void flush_dcache_page(struct page *page)
extern void (*flush_icache_page)(struct vm_area_struct *vma,
struct page *page);
extern void (*flush_icache_range)(unsigned long start, unsigned long end);
extern void (*flush_icache_range)(unsigned long __user start,
unsigned long __user end);
#define flush_cache_vmap(start, end) flush_cache_all()
#define flush_cache_vunmap(start, end) flush_cache_all()
......
......@@ -34,8 +34,9 @@ unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum);
* this is a new version of the above that records errors it finds in *errp,
* but continues and zeros the rest of the buffer.
*/
unsigned int csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, int len,
unsigned int sum, int *errp);
unsigned int csum_partial_copy_from_user(const unsigned char __user *src,
unsigned char *dst, int len,
unsigned int sum, int *errp);
/*
* Copy and checksum to user
......
......@@ -25,6 +25,7 @@
#include <asm/page.h>
#include <asm/pgtable-bits.h>
#include <asm/processor.h>
#include <asm/string.h>
#include <mangle-port.h>
......@@ -217,7 +218,7 @@ static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size,
*/
if (flags == _CACHE_UNCACHED)
base = (u64) IO_BASE;
return (void *) (unsigned long) (base + offset);
return (void __iomem *) (unsigned long) (base + offset);
}
return __ioremap(offset, size, flags);
......@@ -486,9 +487,18 @@ BUILDSTRING(q, u64)
/* Depends on MIPS II instruction set */
#define mmiowb() asm volatile ("sync" ::: "memory")
#define memset_io(a,b,c) memset((void *)(a),(b),(c))
#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
{
memset((void __force *) addr, val, count);
}
static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count)
{
memcpy(dst, (void __force *) src, count);
}
static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count)
{
memcpy((void __force *) dst, src, count);
}
/*
* Memory Mapped I/O
......
......@@ -24,11 +24,9 @@ static inline int irq_canonicalize(int irq)
struct pt_regs;
#ifdef CONFIG_PREEMPT
extern asmlinkage unsigned int do_IRQ(unsigned int irq, struct pt_regs *regs);
#else
#ifdef CONFIG_PREEMPT
/*
* do_IRQ handles all normal device IRQ's (the special
......
......@@ -58,6 +58,6 @@ extern void prom_printf(char *fmt, ...);
#endif
#define IOADDR(a) ((void *)(IO_BASE + (a)))
#define IOADDR(a) ((volatile void __iomem *)(IO_BASE + (a)))
#endif
This diff is collapsed.
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