Skip to content

Commit

Permalink
Sparseify MIPS.
Browse files Browse the repository at this point in the history
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Ralf Baechle committed Oct 29, 2005
1 parent 14f18b7 commit fe00f94
Show file tree
Hide file tree
Showing 21 changed files with 607 additions and 585 deletions.
15 changes: 15 additions & 0 deletions arch/mips/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/i8259.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
14 changes: 7 additions & 7 deletions arch/mips/kernel/irixelf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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] = ' ';
Expand Down Expand Up @@ -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) {
Expand Down
7 changes: 4 additions & 3 deletions arch/mips/kernel/irixinv.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,19 @@ 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))
return -EFAULT;

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);
Expand Down
Loading

0 comments on commit fe00f94

Please sign in to comment.