Commit fa43972f authored by Paul Mundt's avatar Paul Mundt

sh: fixup many sparse errors.

Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 7d96169c
...@@ -191,7 +191,7 @@ long* stack_start = &user_stack[STACK_SIZE]; ...@@ -191,7 +191,7 @@ long* stack_start = &user_stack[STACK_SIZE];
void decompress_kernel(void) void decompress_kernel(void)
{ {
output_data = 0; output_data = NULL;
output_ptr = PHYSADDR((unsigned long)&_text+PAGE_SIZE); output_ptr = PHYSADDR((unsigned long)&_text+PAGE_SIZE);
#ifdef CONFIG_29BIT #ifdef CONFIG_29BIT
output_ptr |= P2SEG; output_ptr |= P2SEG;
......
...@@ -39,6 +39,7 @@ struct clk { ...@@ -39,6 +39,7 @@ struct clk {
/* Should be defined by processor-specific code */ /* Should be defined by processor-specific code */
void arch_init_clk_ops(struct clk_ops **, int type); void arch_init_clk_ops(struct clk_ops **, int type);
int __init arch_clk_init(void);
/* arch/sh/kernel/cpu/clock.c */ /* arch/sh/kernel/cpu/clock.c */
int clk_init(void); int clk_init(void);
......
...@@ -194,6 +194,8 @@ __BUILD_MEMORY_STRING(w, u16) ...@@ -194,6 +194,8 @@ __BUILD_MEMORY_STRING(w, u16)
#define IO_SPACE_LIMIT 0xffffffff #define IO_SPACE_LIMIT 0xffffffff
extern unsigned long generic_io_base;
/* /*
* This function provides a method for the generic case where a board-specific * This function provides a method for the generic case where a board-specific
* ioport_map simply needs to return the port + some arbitrary port base. * ioport_map simply needs to return the port + some arbitrary port base.
...@@ -203,8 +205,6 @@ __BUILD_MEMORY_STRING(w, u16) ...@@ -203,8 +205,6 @@ __BUILD_MEMORY_STRING(w, u16)
*/ */
static inline void __set_io_port_base(unsigned long pbase) static inline void __set_io_port_base(unsigned long pbase)
{ {
extern unsigned long generic_io_base;
generic_io_base = pbase; generic_io_base = pbase;
} }
......
...@@ -41,6 +41,9 @@ static inline int generic_irq_demux(int irq) ...@@ -41,6 +41,9 @@ static inline int generic_irq_demux(int irq)
#define irq_canonicalize(irq) (irq) #define irq_canonicalize(irq) (irq)
#define irq_demux(irq) sh_mv.mv_irq_demux(irq) #define irq_demux(irq) sh_mv.mv_irq_demux(irq)
void init_IRQ(void);
asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs);
#ifdef CONFIG_IRQSTACKS #ifdef CONFIG_IRQSTACKS
extern void irq_ctx_init(int cpu); extern void irq_ctx_init(int cpu);
extern void irq_ctx_exit(int cpu); extern void irq_ctx_exit(int cpu);
......
...@@ -45,9 +45,13 @@ enum cpu_type { ...@@ -45,9 +45,13 @@ enum cpu_type {
/* Forward decl */ /* Forward decl */
struct sh_cpuinfo; struct sh_cpuinfo;
struct seq_operations;
extern struct pt_regs fake_swapper_regs;
/* arch/sh/kernel/setup.c */ /* arch/sh/kernel/setup.c */
const char *get_cpu_subtype(struct sh_cpuinfo *c); const char *get_cpu_subtype(struct sh_cpuinfo *c);
extern const struct seq_operations cpuinfo_op;
#ifdef CONFIG_VSYSCALL #ifdef CONFIG_VSYSCALL
int vsyscall_init(void); int vsyscall_init(void);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/linkage.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/types.h> #include <asm/types.h>
#include <asm/cache.h> #include <asm/cache.h>
...@@ -44,6 +45,8 @@ extern struct sh_cpuinfo cpu_data[]; ...@@ -44,6 +45,8 @@ extern struct sh_cpuinfo cpu_data[];
#define current_cpu_data cpu_data[smp_processor_id()] #define current_cpu_data cpu_data[smp_processor_id()]
#define raw_current_cpu_data cpu_data[raw_smp_processor_id()] #define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
asmlinkage void __init sh_cpu_init(void);
/* /*
* User space process size: 2GB. * User space process size: 2GB.
* *
......
...@@ -169,8 +169,6 @@ struct thread_struct { ...@@ -169,8 +169,6 @@ struct thread_struct {
#define INIT_MMAP \ #define INIT_MMAP \
{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } { &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
extern struct pt_regs fake_swapper_regs;
#define INIT_THREAD { \ #define INIT_THREAD { \
.sp = sizeof(init_stack) + \ .sp = sizeof(init_stack) + \
(long) &init_stack, \ (long) &init_stack, \
......
#ifndef _ASM_RTC_H #ifndef _ASM_RTC_H
#define _ASM_RTC_H #define _ASM_RTC_H
void time_init(void);
extern void (*board_time_init)(void); extern void (*board_time_init)(void);
extern void (*rtc_sh_get_time)(struct timespec *); extern void (*rtc_sh_get_time)(struct timespec *);
extern int (*rtc_sh_set_time)(const time_t); extern int (*rtc_sh_set_time)(const time_t);
......
#ifndef _SH_SETUP_H #ifndef _SH_SETUP_H
#define _SH_SETUP_H #define _SH_SETUP_H
#include <asm/mmzone.h>
#define COMMAND_LINE_SIZE 256 #define COMMAND_LINE_SIZE 256
#ifdef __KERNEL__ #ifdef __KERNEL__
......
#ifndef __ASM_SH_SYSCALLS_H
#define __ASM_SH_SYSCALLS_H
#ifdef __KERNEL__
struct old_utsname;
asmlinkage int old_mmap(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags,
int fd, unsigned long off);
asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff);
asmlinkage int sys_ipc(uint call, int first, int second,
int third, void __user *ptr, long fifth);
asmlinkage int sys_uname(struct old_utsname __user *name);
#ifdef CONFIG_SUPERH32
# include "syscalls_32.h"
#else
# include "syscalls_64.h"
#endif
#endif /* __KERNEL__ */
#endif /* __ASM_SH_SYSCALLS_H */
#ifndef __ASM_SH_SYSCALLS_32_H
#define __ASM_SH_SYSCALLS_32_H
#ifdef __KERNEL__
#include <linux/compiler.h>
#include <linux/linkage.h>
#include <linux/types.h>
struct pt_regs;
asmlinkage int sys_fork(unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7,
struct pt_regs __regs);
asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
unsigned long parent_tidptr,
unsigned long child_tidptr,
struct pt_regs __regs);
asmlinkage int sys_vfork(unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7,
struct pt_regs __regs);
asmlinkage int sys_execve(char __user *ufilename, char __user * __user *uargv,
char __user * __user *uenvp, unsigned long r7,
struct pt_regs __regs);
asmlinkage int sys_sigsuspend(old_sigset_t mask, unsigned long r5,
unsigned long r6, unsigned long r7,
struct pt_regs __regs);
asmlinkage int sys_sigaction(int sig, const struct old_sigaction __user *act,
struct old_sigaction __user *oact);
asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
unsigned long r6, unsigned long r7,
struct pt_regs __regs);
asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7,
struct pt_regs __regs);
asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7,
struct pt_regs __regs);
asmlinkage int sys_pipe(unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7,
struct pt_regs __regs);
asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char __user *buf,
size_t count, long dummy, loff_t pos);
asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char __user *buf,
size_t count, long dummy, loff_t pos);
asmlinkage int sys_fadvise64_64_wrapper(int fd, u32 offset0, u32 offset1,
u32 len0, u32 len1, int advice);
/* Misc syscall related bits */
asmlinkage long do_syscall_trace_enter(struct pt_regs *regs);
asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0,
unsigned long thread_info_flags);
#endif /* __KERNEL__ */
#endif /* __ASM_SH_SYSCALLS_32_H */
#ifndef __ASM_SH_SYSCALLS_64_H
#define __ASM_SH_SYSCALLS_64_H
#ifdef __KERNEL__
#include <linux/compiler.h>
#include <linux/linkage.h>
#include <linux/types.h>
struct pt_regs;
asmlinkage int sys_fork(unsigned long r2, unsigned long r3,
unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7,
struct pt_regs *pregs);
asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7,
struct pt_regs *pregs);
asmlinkage int sys_vfork(unsigned long r2, unsigned long r3,
unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7,
struct pt_regs *pregs);
asmlinkage int sys_execve(char *ufilename, char **uargv,
char **uenvp, unsigned long r5,
unsigned long r6, unsigned long r7,
struct pt_regs *pregs);
/* Misc syscall related bits */
asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs);
asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
#endif /* __KERNEL__ */
#endif /* __ASM_SH_SYSCALLS_64_H */
...@@ -127,6 +127,8 @@ static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old, ...@@ -127,6 +127,8 @@ static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
}) })
extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn)); extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn));
void free_initmem(void);
void free_initrd_mem(unsigned long start, unsigned long end);
extern void *set_exception_table_vec(unsigned int vec, void *handler); extern void *set_exception_table_vec(unsigned int vec, void *handler);
...@@ -179,8 +181,8 @@ BUILD_TRAP_HANDLER(fpu_state_restore); ...@@ -179,8 +181,8 @@ BUILD_TRAP_HANDLER(fpu_state_restore);
#define arch_align_stack(x) (x) #define arch_align_stack(x) (x)
struct mem_access { struct mem_access {
unsigned long (*from)(void *dst, const void *src, unsigned long cnt); unsigned long (*from)(void *dst, const void __user *src, unsigned long cnt);
unsigned long (*to)(void *dst, const void *src, unsigned long cnt); unsigned long (*to)(void __user *dst, const void *src, unsigned long cnt);
}; };
#ifdef CONFIG_SUPERH32 #ifdef CONFIG_SUPERH32
......
...@@ -99,4 +99,20 @@ do { \ ...@@ -99,4 +99,20 @@ do { \
int handle_unaligned_access(opcode_t instruction, struct pt_regs *regs, int handle_unaligned_access(opcode_t instruction, struct pt_regs *regs,
struct mem_access *ma); struct mem_access *ma);
asmlinkage void do_address_error(struct pt_regs *regs,
unsigned long writeaccess,
unsigned long address);
asmlinkage void do_divide_error(unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7,
struct pt_regs __regs);
asmlinkage void do_reserved_inst(unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7,
struct pt_regs __regs);
asmlinkage void do_illegal_slot_inst(unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7,
struct pt_regs __regs);
asmlinkage void do_exception_error(unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7,
struct pt_regs __regs);
#endif /* __ASM_SH_SYSTEM_32_H */ #endif /* __ASM_SH_SYSTEM_32_H */
...@@ -294,9 +294,10 @@ arch_init_clk_ops(struct clk_ops **ops, int type) ...@@ -294,9 +294,10 @@ arch_init_clk_ops(struct clk_ops **ops, int type)
{ {
} }
void __init __attribute__ ((weak)) int __init __attribute__ ((weak))
arch_clk_init(void) arch_clk_init(void)
{ {
return 0;
} }
static int show_clocks(char *buf, char **start, off_t off, static int show_clocks(char *buf, char **start, off_t off,
...@@ -331,7 +332,7 @@ int __init clk_init(void) ...@@ -331,7 +332,7 @@ int __init clk_init(void)
ret |= clk_register(clk); ret |= clk_register(clk);
} }
arch_clk_init(); ret |= arch_clk_init();
/* Kick the child clocks.. */ /* Kick the child clocks.. */
propagate_rate(&master_clk); propagate_rate(&master_clk);
......
...@@ -81,7 +81,7 @@ void generic_insb(unsigned long port, void *dst, unsigned long count) ...@@ -81,7 +81,7 @@ void generic_insb(unsigned long port, void *dst, unsigned long count)
volatile u8 *port_addr; volatile u8 *port_addr;
u8 *buf = dst; u8 *buf = dst;
port_addr = (volatile u8 *)__ioport_map(port, 1); port_addr = (volatile u8 __force *)__ioport_map(port, 1);
while (count--) while (count--)
*buf++ = *port_addr; *buf++ = *port_addr;
} }
...@@ -91,7 +91,7 @@ void generic_insw(unsigned long port, void *dst, unsigned long count) ...@@ -91,7 +91,7 @@ void generic_insw(unsigned long port, void *dst, unsigned long count)
volatile u16 *port_addr; volatile u16 *port_addr;
u16 *buf = dst; u16 *buf = dst;
port_addr = (volatile u16 *)__ioport_map(port, 2); port_addr = (volatile u16 __force *)__ioport_map(port, 2);
while (count--) while (count--)
*buf++ = *port_addr; *buf++ = *port_addr;
...@@ -103,7 +103,7 @@ void generic_insl(unsigned long port, void *dst, unsigned long count) ...@@ -103,7 +103,7 @@ void generic_insl(unsigned long port, void *dst, unsigned long count)
volatile u32 *port_addr; volatile u32 *port_addr;
u32 *buf = dst; u32 *buf = dst;
port_addr = (volatile u32 *)__ioport_map(port, 4); port_addr = (volatile u32 __force *)__ioport_map(port, 4);
while (count--) while (count--)
*buf++ = *port_addr; *buf++ = *port_addr;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <asm/machvec.h> #include <asm/machvec.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/setup.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/ubc.h> #include <asm/ubc.h>
#include <asm/fpu.h> #include <asm/fpu.h>
#include <asm/syscalls.h>
static int hlt_counter; static int hlt_counter;
int ubc_usercnt = 0; int ubc_usercnt = 0;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/syscalls.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
#include <asm/syscalls.h>
/* /*
* does not yet catch signals sent when the child dies. * does not yet catch signals sent when the child dies.
...@@ -105,6 +106,7 @@ void ptrace_disable(struct task_struct *child) ...@@ -105,6 +106,7 @@ void ptrace_disable(struct task_struct *child)
long arch_ptrace(struct task_struct *child, long request, long addr, long data) long arch_ptrace(struct task_struct *child, long request, long addr, long data)
{ {
struct user * dummy = NULL; struct user * dummy = NULL;
unsigned long __user *datap = (unsigned long __user *)data;
int ret; int ret;
switch (request) { switch (request) {
...@@ -133,7 +135,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -133,7 +135,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
tmp = !!tsk_used_math(child); tmp = !!tsk_used_math(child);
else else
tmp = 0; tmp = 0;
ret = put_user(tmp, (unsigned long __user *)data); ret = put_user(tmp, datap);
break; break;
} }
...@@ -202,7 +204,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -202,7 +204,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
} }
ret = 0; ret = 0;
if (put_user(tmp, (unsigned long *) data)) { if (put_user(tmp, datap)) {
ret = -EFAULT; ret = -EFAULT;
break; break;
} }
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
#include <asm/syscalls.h>
#include <asm/fpu.h> #include <asm/fpu.h>
/* This mask defines the bits of the SR which the user is not allowed to /* This mask defines the bits of the SR which the user is not allowed to
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/crash_dump.h> #include <linux/crash_dump.h>
#include <linux/mmzone.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/page.h> #include <asm/page.h>
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/syscalls.h>
#include <asm/fpu.h> #include <asm/fpu.h>
#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
...@@ -247,7 +248,6 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5, ...@@ -247,7 +248,6 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
struct pt_regs *regs = RELOC_HIDE(&__regs, 0); struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs->regs[15]; struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs->regs[15];
sigset_t set; sigset_t set;
stack_t st;
int r0; int r0;
if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
...@@ -265,11 +265,9 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5, ...@@ -265,11 +265,9 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0)) if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0))
goto badframe; goto badframe;
if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st))) if (do_sigaltstack(&frame->uc.uc_stack, NULL,
regs->regs[15]) == -EFAULT)
goto badframe; goto badframe;
/* It is more difficult to avoid calling this function than to
call it and ignore errors. */
do_sigaltstack((const stack_t __user *)&st, NULL, (unsigned long)frame);
return r0; return r0;
...@@ -429,7 +427,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -429,7 +427,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
/* Create the ucontext. */ /* Create the ucontext. */
err |= __put_user(0, &frame->uc.uc_flags); err |= __put_user(0, &frame->uc.uc_flags);
err |= __put_user(0, &frame->uc.uc_link); err |= __put_user(NULL, &frame->uc.uc_link);
err |= __put_user((void *)current->sas_ss_sp, err |= __put_user((void *)current->sas_ss_sp,
&frame->uc.uc_stack.ss_sp); &frame->uc.uc_stack.ss_sp);
err |= __put_user(sas_ss_flags(regs->regs[15]), err |= __put_user(sas_ss_flags(regs->regs[15]),
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/ipc.h> #include <linux/ipc.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/syscalls.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/unistd.h> #include <asm/unistd.h>
...@@ -186,7 +187,7 @@ asmlinkage int sys_ipc(uint call, int first, int second, ...@@ -186,7 +187,7 @@ asmlinkage int sys_ipc(uint call, int first, int second,
union semun fourth; union semun fourth;
if (!ptr) if (!ptr)
return -EINVAL; return -EINVAL;
if (get_user(fourth.__pad, (void * __user *) ptr)) if (get_user(fourth.__pad, (void __user * __user *) ptr))
return -EFAULT; return -EFAULT;
return sys_semctl (first, second, third, fourth); return sys_semctl (first, second, third, fourth);
} }
...@@ -261,13 +262,13 @@ asmlinkage int sys_ipc(uint call, int first, int second, ...@@ -261,13 +262,13 @@ asmlinkage int sys_ipc(uint call, int first, int second,
return -EINVAL; return -EINVAL;
} }
asmlinkage int sys_uname(struct old_utsname * name) asmlinkage int sys_uname(struct old_utsname __user *name)
{ {
int err; int err;
if (!name) if (!name)
return -EFAULT; return -EFAULT;
down_read(&uts_sem); down_read(&uts_sem);
err = copy_to_user(name, utsname(), sizeof (*name)); err = copy_to_user(name, utsname(), sizeof(*name));
up_read(&uts_sem); up_read(&uts_sem);
return err?-EFAULT:0; return err?-EFAULT:0;
} }
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/unistd.h> #include <asm/unistd.h>
#include <asm/syscalls.h>
/* /*
* sys_pipe() is the normal C calling standard for creating * sys_pipe() is the normal C calling standard for creating
...@@ -37,13 +38,13 @@ asmlinkage int sys_pipe(unsigned long r4, unsigned long r5, ...@@ -37,13 +38,13 @@ asmlinkage int sys_pipe(unsigned long r4, unsigned long r5,
return error; return error;
} }
asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char * buf, asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char __user *buf,
size_t count, long dummy, loff_t pos) size_t count, long dummy, loff_t pos)
{ {
return sys_pread64(fd, buf, count, pos); return sys_pread64(fd, buf, count, pos);
} }
asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char * buf, asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char __user *buf,
size_t count, long dummy, loff_t pos) size_t count, long dummy, loff_t pos)
{ {
return sys_pwrite64(fd, buf, count, pos); return sys_pwrite64(fd, buf, count, pos);
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/timex.h> #include <linux/timex.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/clockchips.h> #include <linux/clockchips.h>
#include <linux/mc146818rtc.h> /* for rtc_lock */
#include <linux/smp.h> #include <linux/smp.h>
#include <asm/clock.h> #include <asm/clock.h>
#include <asm/rtc.h> #include <asm/rtc.h>
......
...@@ -174,7 +174,7 @@ static int cmt_timer_init(void) ...@@ -174,7 +174,7 @@ static int cmt_timer_init(void)
return 0; return 0;
} }
struct sys_timer_ops cmt_timer_ops = { static struct sys_timer_ops cmt_timer_ops = {
.init = cmt_timer_init, .init = cmt_timer_init,
.start = cmt_timer_start, .start = cmt_timer_start,
.stop = cmt_timer_stop, .stop = cmt_timer_stop,
......
...@@ -192,6 +192,7 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs, ...@@ -192,6 +192,7 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs,
int ret, index, count; int ret, index, count;
unsigned long *rm, *rn; unsigned long *rm, *rn;
unsigned char *src, *dst; unsigned char *src, *dst;
unsigned char __user *srcu, *dstu;
index = (instruction>>8)&15; /* 0x0F00 */ index = (instruction>>8)&15; /* 0x0F00 */
rn = &regs->regs[index]; rn = &regs->regs[index];
...@@ -206,28 +207,28 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs, ...@@ -206,28 +207,28 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs,
case 0: /* mov.[bwl] to/from memory via r0+rn */ case 0: /* mov.[bwl] to/from memory via r0+rn */
if (instruction & 8) { if (instruction & 8) {
/* from memory */ /* from memory */
src = (unsigned char*) *rm; srcu = (unsigned char __user *)*rm;
src += regs->regs[0]; srcu += regs->regs[0];
dst = (unsigned char*) rn; dst = (unsigned char *)rn;
*(unsigned long*)dst = 0; *(unsigned long *)dst = 0;
#if !defined(__LITTLE_ENDIAN__) #if !defined(__LITTLE_ENDIAN__)
dst += 4-count; dst += 4-count;
#endif #endif
if (ma->from(dst, src, count)) if (ma->from(dst, srcu, count))
goto fetch_fault; goto fetch_fault;
sign_extend(count, dst); sign_extend(count, dst);
} else { } else {
/* to memory */ /* to memory */
src = (unsigned char*) rm; src = (unsigned char *)rm;
#if !defined(__LITTLE_ENDIAN__) #if !defined(__LITTLE_ENDIAN__)
src += 4-count; src += 4-count;
#endif #endif
dst = (unsigned char*) *rn; dstu = (unsigned char __user *)*rn;
dst += regs->regs[0]; dstu += regs->regs[0];
if (ma->to(dst, src, count)) if (ma->to(dstu, src, count))
goto fetch_fault; goto fetch_fault;
} }
ret = 0; ret = 0;
...@@ -235,10 +236,10 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs, ...@@ -235,10 +236,10 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs,
case 1: /* mov.l Rm,@(disp,Rn) */ case 1: /* mov.l Rm,@(disp,Rn) */
src = (unsigned char*) rm; src = (unsigned char*) rm;
dst = (unsigned char*) *rn; dstu = (unsigned char __user *)*rn;
dst += (instruction&0x000F)<<2; dstu += (instruction&0x000F)<<2;
if (ma->to(dst, src, 4)) if (ma->to(dstu, src, 4))
goto fetch_fault; goto fetch_fault;
ret = 0; ret = 0;
break; break;
...@@ -247,28 +248,28 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs, ...@@ -247,28 +248,28 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs,
if (instruction & 4) if (instruction & 4)
*rn -= count; *rn -= count;
src = (unsigned char*) rm; src = (unsigned char*) rm;
dst = (unsigned char*) *rn; dstu = (unsigned char __user *)*rn;
#if !defined(__LITTLE_ENDIAN__) #if !defined(__LITTLE_ENDIAN__)
src += 4-count; src += 4-count;
#endif #endif
if (ma->to(dst, src, count)) if (ma->to(dstu, src, count))
goto fetch_fault; goto fetch_fault;
ret = 0; ret = 0;
break; break;
case 5: /* mov.l @(disp,Rm),Rn */ case 5: /* mov.l @(disp,Rm),Rn */
src = (unsigned char*) *rm; srcu = (unsigned char __user *)*rm;
src += (instruction&0x000F)<<2; srcu += (instruction & 0x000F) << 2;
dst = (unsigned char*) rn; dst = (unsigned char *)rn;
*(unsigned long*)dst = 0; *(unsigned long *)dst = 0;
if (ma->from(dst, src, 4)) if (ma->from(dst, srcu, 4))
goto fetch_fault; goto fetch_fault;
ret = 0; ret = 0;
break; break;
case 6: /* mov.[bwl] from memory, possibly with post-increment */ case 6: /* mov.[bwl] from memory, possibly with post-increment */
src = (unsigned char*) *rm; srcu = (unsigned char __user *)*rm;
if (instruction & 4) if (instruction & 4)
*rm += count; *rm += count;
dst = (unsigned char*) rn; dst = (unsigned char*) rn;
...@@ -277,7 +278,7 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs, ...@@ -277,7 +278,7 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs,
#if !defined(__LITTLE_ENDIAN__) #if !defined(__LITTLE_ENDIAN__)
dst += 4-count; dst += 4-count;
#endif #endif
if (ma->from(dst, src, count)) if (ma->from(dst, srcu, count))
goto fetch_fault; goto fetch_fault;
sign_extend(count, dst); sign_extend(count, dst);
ret = 0; ret = 0;
...@@ -286,28 +287,28 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs, ...@@ -286,28 +287,28 @@ static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs,
case 8: case 8:
switch ((instruction&0xFF00)>>8) { switch ((instruction&0xFF00)>>8) {
case 0x81: /* mov.w R0,@(disp,Rn) */ case 0x81: /* mov.w R0,@(disp,Rn) */
src = (unsigned char*) &regs->regs[0]; src = (unsigned char *) &regs->regs[0];
#if !defined(__LITTLE_ENDIAN__) #if !defined(__LITTLE_ENDIAN__)
src += 2; src += 2;
#endif #endif
dst = (unsigned char*) *rm; /* called Rn in the spec */ dstu = (unsigned char __user *)*rm; /* called Rn in the spec */
dst += (instruction&0x000F)<<1; dstu += (instruction & 0x000F) << 1;
if (ma->to(dst, src, 2)) if (ma->to(dstu, src, 2))
goto fetch_fault; goto fetch_fault;
ret = 0; ret = 0;
break; break;
case 0x85: /* mov.w @(disp,Rm),R0 */ case 0x85: /* mov.w @(disp,Rm),R0 */
src = (unsigned char*) *rm; srcu = (unsigned char __user *)*rm;
src += (instruction&0x000F)<<1; srcu += (instruction & 0x000F) << 1;
dst = (unsigned char*) &regs->regs[0]; dst = (unsigned char *) &regs->regs[0];
*(unsigned long*)dst = 0; *(unsigned long *)dst = 0;
#if !defined(__LITTLE_ENDIAN__) #if !defined(__LITTLE_ENDIAN__)
dst += 2; dst += 2;
#endif #endif
if (ma->from(dst, src, 2)) if (ma->from(dst, srcu, 2))
goto fetch_fault; goto fetch_fault;
sign_extend(2, dst); sign_extend(2, dst);
ret = 0; ret = 0;
...@@ -333,7 +334,8 @@ static inline int handle_delayslot(struct pt_regs *regs, ...@@ -333,7 +334,8 @@ static inline int handle_delayslot(struct pt_regs *regs,
struct mem_access *ma) struct mem_access *ma)
{ {
opcode_t instruction; opcode_t instruction;
void *addr = (void *)(regs->pc + instruction_size(old_instruction)); void __user *addr = (void __user *)(regs->pc +
instruction_size(old_instruction));
if (copy_from_user(&instruction, addr, sizeof(instruction))) { if (copy_from_user(&instruction, addr, sizeof(instruction))) {
/* the instruction-fetch faulted */ /* the instruction-fetch faulted */
...@@ -559,7 +561,7 @@ asmlinkage void do_address_error(struct pt_regs *regs, ...@@ -559,7 +561,7 @@ asmlinkage void do_address_error(struct pt_regs *regs,
} }
set_fs(USER_DS); set_fs(USER_DS);
if (copy_from_user(&instruction, (void *)(regs->pc), if (copy_from_user(&instruction, (void __user *)(regs->pc),
sizeof(instruction))) { sizeof(instruction))) {
/* Argh. Fault on the instruction itself. /* Argh. Fault on the instruction itself.
This should never happen non-SMP This should never happen non-SMP
...@@ -589,7 +591,7 @@ asmlinkage void do_address_error(struct pt_regs *regs, ...@@ -589,7 +591,7 @@ asmlinkage void do_address_error(struct pt_regs *regs,
die("unaligned program counter", regs, error_code); die("unaligned program counter", regs, error_code);
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
if (copy_from_user(&instruction, (void *)(regs->pc), if (copy_from_user(&instruction, (void __user *)(regs->pc),
sizeof(instruction))) { sizeof(instruction))) {
/* Argh. Fault on the instruction itself. /* Argh. Fault on the instruction itself.
This should never happen non-SMP This should never happen non-SMP
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <asm/div64.h>
extern uint64_t __xdiv64_32(u64 n, u32 d); extern uint64_t __xdiv64_32(u64 n, u32 d);
......
...@@ -44,7 +44,7 @@ void *dma_alloc_coherent(struct device *dev, size_t size, ...@@ -44,7 +44,7 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
*/ */
dma_cache_sync(dev, ret, size, DMA_BIDIRECTIONAL); dma_cache_sync(dev, ret, size, DMA_BIDIRECTIONAL);
ret_nocache = ioremap_nocache(virt_to_phys(ret), size); ret_nocache = (void __force *)ioremap_nocache(virt_to_phys(ret), size);
if (!ret_nocache) { if (!ret_nocache) {
free_pages((unsigned long)ret, order); free_pages((unsigned long)ret, order);
return NULL; return NULL;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/uaccess.h>
void copy_page(void *to, void *from) void copy_page(void *to, void *from)
{ {
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/tlbflush.h>
/* /*
* Nothing too terribly exciting here .. * Nothing too terribly exciting here ..
......
...@@ -1113,7 +1113,7 @@ static const char *sci_type(struct uart_port *port) ...@@ -1113,7 +1113,7 @@ static const char *sci_type(struct uart_port *port)
case PORT_IRDA: return "irda"; case PORT_IRDA: return "irda";
} }
return 0; return NULL;
} }
static void sci_release_port(struct uart_port *port) static void sci_release_port(struct uart_port *port)
......
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