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 <asm/cachectl.h>
36#include <asm/byteorder.h>
37#include <arch/chip.h>
38
39SYSCALL_DEFINE3(cacheflush, unsigned long, addr, unsigned long, len,
40 unsigned long, flags)
41{
42
43 if (flags & DCACHE)
44 homecache_evict(cpumask_of(raw_smp_processor_id()));
45
46 if (flags & ICACHE)
47 flush_remote(0, HV_FLUSH_EVICT_L1I, mm_cpumask(current->mm),
48 0, 0, 0, NULL, NULL, 0);
49 return 0;
50}
51
52
53
54
55
56
57
58
59
60
61#if !defined(__tilegx__) || defined(CONFIG_COMPAT)
62
63#ifdef __BIG_ENDIAN
64#define SYSCALL_PAIR(name) u32 name ## _hi, u32 name ## _lo
65#else
66#define SYSCALL_PAIR(name) u32 name ## _lo, u32 name ## _hi
67#endif
68
69ssize_t sys32_readahead(int fd, SYSCALL_PAIR(offset), u32 count)
70{
71 return sys_readahead(fd, ((loff_t)offset_hi << 32) | offset_lo, count);
72}
73
74int sys32_fadvise64_64(int fd, SYSCALL_PAIR(offset),
75 SYSCALL_PAIR(len), int advice)
76{
77 return sys_fadvise64_64(fd, ((loff_t)offset_hi << 32) | offset_lo,
78 ((loff_t)len_hi << 32) | len_lo, advice);
79}
80
81#endif
82
83
84SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
85 unsigned long, prot, unsigned long, flags,
86 unsigned long, fd, unsigned long, off_4k)
87{
88#define PAGE_ADJUST (PAGE_SHIFT - 12)
89 if (off_4k & ((1 << PAGE_ADJUST) - 1))
90 return -EINVAL;
91 return sys_mmap_pgoff(addr, len, prot, flags, fd,
92 off_4k >> PAGE_ADJUST);
93}
94
95#ifdef __tilegx__
96SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
97 unsigned long, prot, unsigned long, flags,
98 unsigned long, fd, off_t, offset)
99{
100 if (offset & ((1 << PAGE_SHIFT) - 1))
101 return -EINVAL;
102 return sys_mmap_pgoff(addr, len, prot, flags, fd,
103 offset >> PAGE_SHIFT);
104}
105#endif
106
107
108
109#undef __SYSCALL
110#define __SYSCALL(nr, call) [nr] = (call),
111
112#ifndef __tilegx__
113
114#define sys_fadvise64_64 sys32_fadvise64_64
115#define sys_readahead sys32_readahead
116#endif
117
118
119#undef sys_rt_sigreturn
120#define sys_rt_sigreturn _sys_rt_sigreturn
121#define sys_clone _sys_clone
122
123
124
125
126
127void *sys_call_table[__NR_syscalls] = {
128 [0 ... __NR_syscalls-1] = sys_ni_syscall,
129#include <asm/unistd.h>
130};
131