--- zzzz-none-000/linux-2.4.17/arch/mips/kernel/syscall.c 2001-07-02 20:56:40.000000000 +0000 +++ sangam-fb-322/linux-2.4.17/arch/mips/kernel/syscall.c 2004-11-24 13:22:35.000000000 +0000 @@ -31,6 +31,10 @@ #include #include +#ifdef CONFIG_TI_CUSTOM_SYS_CALLS +#include +#endif + extern asmlinkage void syscall_trace(void); typedef asmlinkage int (*syscall_t)(void *a0,...); extern asmlinkage int (*do_syscalls)(struct pt_regs *regs, syscall_t fun, @@ -82,7 +86,16 @@ asmlinkage unsigned long old_mmap(unsigned long addr, size_t len, int prot, int flags, int fd, off_t offset) { - return do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); + int result; + + result = -EINVAL; + if (offset & ~PAGE_MASK) + goto out; + + result = do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); + +out: + return result; } asmlinkage long @@ -174,6 +187,30 @@ return error; } + +#ifdef CONFIG_TI_CUSTOM_SYS_CALLS +/* + MIPS has no standard implementation of syscall. In order to provide custom + syscall the ti_syscall function is implemented here +*/ +ti_syscall_t ti_syscalls[NR_TI_SYSCALLS]; + +asmlinkage int sys_ti_custom(int nfunc, void* param, int *ret_val) +{ + + if ((nfunc < 0)||(nfunc >= NR_TI_SYSCALLS)) + return -ENOSYS; + + if (ti_syscalls[nfunc] == NULL) + return -ENOSYS; + + *ret_val = (ti_syscalls[nfunc])(param); + + return *ret_val; +} +#endif + + /* * Do the indirect syscall syscall. * Don't care about kernel locking; the actual syscall will do it.