1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#include <linux/errno.h>
20#include <linux/sched.h>
21#include <linux/mm.h>
22#include <linux/smp.h>
23#include <linux/syscalls.h>
24#include <linux/mman.h>
25#include <linux/file.h>
26#include <linux/mempolicy.h>
27#include <linux/binfmts.h>
28#include <linux/fs.h>
29#include <linux/compat.h>
30#include <linux/uaccess.h>
31#include <linux/signal.h>
32#include <asm/syscalls.h>
33#include <asm/pgtable.h>
34#include <asm/homecache.h>
35#include <arch/chip.h>
36
37SYSCALL_DEFINE0(flush_cache)
38{
39 homecache_evict(cpumask_of(smp_processor_id()));
40 return 0;
41}
42
43
44
45
46
47
48
49
50
51
52#if !defined(__tilegx__) || defined(CONFIG_COMPAT)
53
54ssize_t sys32_readahead(int fd, u32 offset_lo, u32 offset_hi, u32 count)
55{
56 return sys_readahead(fd, ((loff_t)offset_hi << 32) | offset_lo, count);
57}
58
59int sys32_fadvise64_64(int fd, u32 offset_lo, u32 offset_hi,
60 u32 len_lo, u32 len_hi, int advice)
61{
62 return sys_fadvise64_64(fd, ((loff_t)offset_hi << 32) | offset_lo,
63 ((loff_t)len_hi << 32) | len_lo, advice);
64}
65
66#endif
67
68
69SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
70 unsigned long, prot, unsigned long, flags,
71 unsigned long, fd, unsigned long, off_4k)
72{
73#define PAGE_ADJUST (PAGE_SHIFT - 12)
74 if (off_4k & ((1 << PAGE_ADJUST) - 1))
75 return -EINVAL;
76 return sys_mmap_pgoff(addr, len, prot, flags, fd,
77 off_4k >> PAGE_ADJUST);
78}
79
80#ifdef __tilegx__
81SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
82 unsigned long, prot, unsigned long, flags,
83 unsigned long, fd, off_t, offset)
84{
85 if (offset & ((1 << PAGE_SHIFT) - 1))
86 return -EINVAL;
87 return sys_mmap_pgoff(addr, len, prot, flags, fd,
88 offset >> PAGE_SHIFT);
89}
90#endif
91
92
93
94#undef __SYSCALL
95#define __SYSCALL(nr, call) [nr] = (call),
96
97#ifndef __tilegx__
98
99#define sys_fadvise64_64 sys32_fadvise64_64
100#define sys_readahead sys32_readahead
101#endif
102
103
104#define sys_execve _sys_execve
105#define sys_sigaltstack _sys_sigaltstack
106#define sys_rt_sigreturn _sys_rt_sigreturn
107#define sys_clone _sys_clone
108#ifndef __tilegx__
109#define sys_cmpxchg_badaddr _sys_cmpxchg_badaddr
110#endif
111
112
113
114
115
116void *sys_call_table[__NR_syscalls] = {
117 [0 ... __NR_syscalls-1] = sys_ni_syscall,
118#include <asm/unistd.h>
119};
120