--- zzzz-none-000/linux-2.4.17/arch/mips/kernel/syscall.c 2001-07-02 20:56:40.000000000 +0000 +++ sangam-fb-401/linux-2.4.17/arch/mips/kernel/syscall.c 2005-07-20 11:54:06.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. @@ -244,6 +281,16 @@ return syscall((void *)a0, a1, a2, a3, a4, a5, a6); } +/*------------------------------------------------------------------------------------------*\ +\*------------------------------------------------------------------------------------------*/ +#if defined(CONFIG_LOG_SYSTEM_TIMES) +asmlinkage void dummy_syscall_update(void) { + void update_one_process(struct task_struct *p, unsigned long user, unsigned long system, int cpu); + current->real_times_update_only = 1; + /*--- im schedule fuerren einen Syscall aus sind also USER ---*/ + update_one_process(current, 1, 0, current->processor); +} +#endif /*--- #if defined(CONFIG_LOG_SYSTEM_TIMES) ---*/ /* * If we ever come here the user sp is bad. Zap the process right away. * Due to the bad stack signaling wouldn't work.