Blame view
arch/sh/kernel/sys_sh.c
2.26 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 6 7 8 9 |
/* * linux/arch/sh/kernel/sys_sh.c * * This file contains various random system calls that * have a non-standard calling sequence on the Linux/SuperH * platform. * * Taken from i386 version. */ |
1da177e4c Linux-2.6.12-rc2 |
10 11 12 13 |
#include <linux/errno.h> #include <linux/sched.h> #include <linux/mm.h> #include <linux/smp.h> |
1da177e4c Linux-2.6.12-rc2 |
14 15 16 17 18 19 20 21 |
#include <linux/sem.h> #include <linux/msg.h> #include <linux/shm.h> #include <linux/stat.h> #include <linux/syscalls.h> #include <linux/mman.h> #include <linux/file.h> #include <linux/utsname.h> |
f3c257581 sh: Calculate shm... |
22 |
#include <linux/module.h> |
e06c4e577 sh: Fix fs.h remo... |
23 |
#include <linux/fs.h> |
cba4fbbff remove include/as... |
24 |
#include <linux/ipc.h> |
fa43972fa sh: fixup many sp... |
25 |
#include <asm/syscalls.h> |
1da177e4c Linux-2.6.12-rc2 |
26 |
#include <asm/uaccess.h> |
fe74290d5 [PATCH] provide k... |
27 |
#include <asm/unistd.h> |
6d243dd37 sh: Add sys_cache... |
28 29 |
#include <asm/cacheflush.h> #include <asm/cachectl.h> |
1da177e4c Linux-2.6.12-rc2 |
30 |
|
1da177e4c Linux-2.6.12-rc2 |
31 32 33 34 35 36 |
asmlinkage int old_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, int fd, unsigned long off) { if (off & ~PAGE_MASK) return -EINVAL; |
f8b725609 Unify sys_mmap* |
37 |
return sys_mmap_pgoff(addr, len, prot, flags, fd, off>>PAGE_SHIFT); |
1da177e4c Linux-2.6.12-rc2 |
38 39 40 41 42 43 |
} asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff) { |
8c31813f3 sh: Fix mmap2 for... |
44 45 46 47 48 49 50 51 |
/* * The shift for mmap2 is constant, regardless of PAGE_SIZE * setting. */ if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1)) return -EINVAL; pgoff >>= PAGE_SHIFT - 12; |
f8b725609 Unify sys_mmap* |
52 |
return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff); |
1da177e4c Linux-2.6.12-rc2 |
53 |
} |
6d243dd37 sh: Add sys_cache... |
54 55 56 57 |
/* sys_cacheflush -- flush (part of) the processor cache. */ asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, int op) { struct vm_area_struct *vma; |
788e6af37 sh: fix sys_cache... |
58 |
if ((op <= 0) || (op > (CACHEFLUSH_D_PURGE|CACHEFLUSH_I))) |
6d243dd37 sh: Add sys_cache... |
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
return -EINVAL; /* * Verify that the specified address region actually belongs * to this process. */ if (addr + len < addr) return -EFAULT; down_read(¤t->mm->mmap_sem); vma = find_vma (current->mm, addr); if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end) { up_read(¤t->mm->mmap_sem); return -EFAULT; } switch (op & CACHEFLUSH_D_PURGE) { case CACHEFLUSH_D_INVAL: __flush_invalidate_region((void *)addr, len); break; case CACHEFLUSH_D_WB: __flush_wback_region((void *)addr, len); break; case CACHEFLUSH_D_PURGE: __flush_purge_region((void *)addr, len); break; } if (op & CACHEFLUSH_I) |
a6786fdad sh: avoid to flus... |
88 |
flush_icache_range(addr, addr+len); |
6d243dd37 sh: Add sys_cache... |
89 90 91 92 |
up_read(¤t->mm->mmap_sem); return 0; } |