2 * linux/arch/sh/kernel/sys_sh.c
4 * This file contains various random system calls that
5 * have a non-standard calling sequence on the Linux/SuperH
8 * Taken from i386 version.
10 #include <linux/errno.h>
11 #include <linux/sched.h>
13 #include <linux/smp.h>
14 #include <linux/sem.h>
15 #include <linux/msg.h>
16 #include <linux/shm.h>
17 #include <linux/stat.h>
18 #include <linux/syscalls.h>
19 #include <linux/mman.h>
20 #include <linux/file.h>
21 #include <linux/utsname.h>
22 #include <linux/module.h>
24 #include <linux/ipc.h>
25 #include <asm/syscalls.h>
26 #include <asm/uaccess.h>
27 #include <asm/unistd.h>
28 #include <asm/cacheflush.h>
29 #include <asm/cachectl.h>
31 asmlinkage
int old_mmap(unsigned long addr
, unsigned long len
,
32 unsigned long prot
, unsigned long flags
,
33 int fd
, unsigned long off
)
37 return sys_mmap_pgoff(addr
, len
, prot
, flags
, fd
, off
>>PAGE_SHIFT
);
40 asmlinkage
long sys_mmap2(unsigned long addr
, unsigned long len
,
41 unsigned long prot
, unsigned long flags
,
42 unsigned long fd
, unsigned long pgoff
)
45 * The shift for mmap2 is constant, regardless of PAGE_SIZE
48 if (pgoff
& ((1 << (PAGE_SHIFT
- 12)) - 1))
51 pgoff
>>= PAGE_SHIFT
- 12;
53 return sys_mmap_pgoff(addr
, len
, prot
, flags
, fd
, pgoff
);
56 /* sys_cacheflush -- flush (part of) the processor cache. */
57 asmlinkage
int sys_cacheflush(unsigned long addr
, unsigned long len
, int op
)
59 struct vm_area_struct
*vma
;
61 if ((op
<= 0) || (op
> (CACHEFLUSH_D_PURGE
|CACHEFLUSH_I
)))
65 * Verify that the specified address region actually belongs
68 if (addr
+ len
< addr
)
71 down_read(¤t
->mm
->mmap_sem
);
72 vma
= find_vma (current
->mm
, addr
);
73 if (vma
== NULL
|| addr
< vma
->vm_start
|| addr
+ len
> vma
->vm_end
) {
74 up_read(¤t
->mm
->mmap_sem
);
78 switch (op
& CACHEFLUSH_D_PURGE
) {
79 case CACHEFLUSH_D_INVAL
:
80 __flush_invalidate_region((void *)addr
, len
);
83 __flush_wback_region((void *)addr
, len
);
85 case CACHEFLUSH_D_PURGE
:
86 __flush_purge_region((void *)addr
, len
);
90 if (op
& CACHEFLUSH_I
)
93 up_read(¤t
->mm
->mmap_sem
);