diff options
author | Chris Zankel <czankel@tensilica.com> | 2006-12-10 05:18:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-10 12:55:39 -0500 |
commit | fc4fb2adf944d45a7f3d4d38df991c79ffdb6a43 (patch) | |
tree | bee95910d719861e2a189f7464b6bd6de6f22d1c | |
parent | 173d6681380aa1d60dfc35ed7178bd7811ba2784 (diff) |
[PATCH] xtensa: fix system call interface
This is a long outstanding patch to finally fix the syscall interface. The
constants used for the system calls are those we have provided in our libc
patches. This patch also fixes the shmbuf and stat structure, and fcntl
definitions.
Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/xtensa/kernel/asm-offsets.c | 5 | ||||
-rw-r--r-- | arch/xtensa/kernel/entry.S | 228 | ||||
-rw-r--r-- | arch/xtensa/kernel/process.c | 71 | ||||
-rw-r--r-- | arch/xtensa/kernel/ptrace.c | 26 | ||||
-rw-r--r-- | arch/xtensa/kernel/signal.c | 12 | ||||
-rw-r--r-- | arch/xtensa/kernel/syscall.c | 95 | ||||
-rw-r--r-- | arch/xtensa/kernel/syscalls.c | 288 | ||||
-rw-r--r-- | arch/xtensa/kernel/syscalls.h | 247 | ||||
-rw-r--r-- | include/asm-xtensa/fcntl.h | 98 | ||||
-rw-r--r-- | include/asm-xtensa/posix_types.h | 2 | ||||
-rw-r--r-- | include/asm-xtensa/shmbuf.h | 21 | ||||
-rw-r--r-- | include/asm-xtensa/stat.h | 112 | ||||
-rw-r--r-- | include/asm-xtensa/syscall.h | 20 | ||||
-rw-r--r-- | include/asm-xtensa/unistd.h | 795 |
14 files changed, 1053 insertions, 967 deletions
diff --git a/arch/xtensa/kernel/asm-offsets.c b/arch/xtensa/kernel/asm-offsets.c index 7cd1d7f8f608..b256cfbef344 100644 --- a/arch/xtensa/kernel/asm-offsets.c +++ b/arch/xtensa/kernel/asm-offsets.c | |||
@@ -87,6 +87,11 @@ int main(void) | |||
87 | DEFINE(MM_CONTEXT, offsetof (struct mm_struct, context)); | 87 | DEFINE(MM_CONTEXT, offsetof (struct mm_struct, context)); |
88 | BLANK(); | 88 | BLANK(); |
89 | DEFINE(PT_SINGLESTEP_BIT, PT_SINGLESTEP_BIT); | 89 | DEFINE(PT_SINGLESTEP_BIT, PT_SINGLESTEP_BIT); |
90 | |||
91 | /* constants */ | ||
92 | DEFINE(_CLONE_VM, CLONE_VM); | ||
93 | DEFINE(_CLONE_UNTRACED, CLONE_UNTRACED); | ||
94 | |||
90 | return 0; | 95 | return 0; |
91 | } | 96 | } |
92 | 97 | ||
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S index c0b56b17927f..9e271ba009bf 100644 --- a/arch/xtensa/kernel/entry.S +++ b/arch/xtensa/kernel/entry.S | |||
@@ -1004,13 +1004,10 @@ ENTRY(fast_syscall_kernel) | |||
1004 | 1004 | ||
1005 | rsr a0, DEPC # get syscall-nr | 1005 | rsr a0, DEPC # get syscall-nr |
1006 | _beqz a0, fast_syscall_spill_registers | 1006 | _beqz a0, fast_syscall_spill_registers |
1007 | 1007 | _beqi a0, __NR_xtensa, fast_syscall_xtensa | |
1008 | addi a0, a0, -__NR_sysxtensa | ||
1009 | _beqz a0, fast_syscall_sysxtensa | ||
1010 | 1008 | ||
1011 | j kernel_exception | 1009 | j kernel_exception |
1012 | 1010 | ||
1013 | |||
1014 | ENTRY(fast_syscall_user) | 1011 | ENTRY(fast_syscall_user) |
1015 | 1012 | ||
1016 | /* Skip syscall. */ | 1013 | /* Skip syscall. */ |
@@ -1024,9 +1021,7 @@ ENTRY(fast_syscall_user) | |||
1024 | 1021 | ||
1025 | rsr a0, DEPC # get syscall-nr | 1022 | rsr a0, DEPC # get syscall-nr |
1026 | _beqz a0, fast_syscall_spill_registers | 1023 | _beqz a0, fast_syscall_spill_registers |
1027 | 1024 | _beqi a0, __NR_xtensa, fast_syscall_xtensa | |
1028 | addi a0, a0, -__NR_sysxtensa | ||
1029 | _beqz a0, fast_syscall_sysxtensa | ||
1030 | 1025 | ||
1031 | j user_exception | 1026 | j user_exception |
1032 | 1027 | ||
@@ -1047,18 +1042,19 @@ ENTRY(fast_syscall_unrecoverable) | |||
1047 | /* | 1042 | /* |
1048 | * sysxtensa syscall handler | 1043 | * sysxtensa syscall handler |
1049 | * | 1044 | * |
1050 | * int sysxtensa (XTENSA_ATOMIC_SET, ptr, val, unused); | 1045 | * int sysxtensa (SYS_XTENSA_ATOMIC_SET, ptr, val, unused); |
1051 | * int sysxtensa (XTENSA_ATOMIC_ADD, ptr, val, unused); | 1046 | * int sysxtensa (SYS_XTENSA_ATOMIC_ADD, ptr, val, unused); |
1052 | * int sysxtensa (XTENSA_ATOMIC_EXG_ADD, ptr, val, unused); | 1047 | * int sysxtensa (SYS_XTENSA_ATOMIC_EXG_ADD, ptr, val, unused); |
1053 | * int sysxtensa (XTENSA_ATOMIC_CMP_SWP, ptr, oldval, newval); | 1048 | * int sysxtensa (SYS_XTENSA_ATOMIC_CMP_SWP, ptr, oldval, newval); |
1054 | * a2 a6 a3 a4 a5 | 1049 | * a2 a6 a3 a4 a5 |
1055 | * | 1050 | * |
1056 | * Entry condition: | 1051 | * Entry condition: |
1057 | * | 1052 | * |
1058 | * a0: trashed, original value saved on stack (PT_AREG0) | 1053 | * a0: a2 (syscall-nr), original value saved on stack (PT_AREG0) |
1059 | * a1: a1 | 1054 | * a1: a1 |
1060 | * a2: new stack pointer, original in DEPC | 1055 | * a2: new stack pointer, original in a0 and DEPC |
1061 | * a3: dispatch table | 1056 | * a3: dispatch table, original in excsave_1 |
1057 | * a4..a15: unchanged | ||
1062 | * depc: a2, original value saved on stack (PT_DEPC) | 1058 | * depc: a2, original value saved on stack (PT_DEPC) |
1063 | * excsave_1: a3 | 1059 | * excsave_1: a3 |
1064 | * | 1060 | * |
@@ -1091,59 +1087,62 @@ ENTRY(fast_syscall_unrecoverable) | |||
1091 | #define CATCH \ | 1087 | #define CATCH \ |
1092 | 67: | 1088 | 67: |
1093 | 1089 | ||
1094 | ENTRY(fast_syscall_sysxtensa) | 1090 | ENTRY(fast_syscall_xtensa) |
1095 | |||
1096 | _beqz a6, 1f | ||
1097 | _blti a6, SYSXTENSA_COUNT, 2f | ||
1098 | 1091 | ||
1099 | 1: j user_exception | 1092 | xsr a3, EXCSAVE_1 # restore a3, excsave1 |
1100 | |||
1101 | 2: xsr a3, EXCSAVE_1 # restore a3, excsave1 | ||
1102 | s32i a7, a2, PT_AREG7 | ||
1103 | 1093 | ||
1094 | s32i a7, a2, PT_AREG7 # we need an additional register | ||
1104 | movi a7, 4 # sizeof(unsigned int) | 1095 | movi a7, 4 # sizeof(unsigned int) |
1105 | access_ok a0, a3, a7, a2, .Leac | 1096 | access_ok a3, a7, a0, a2, .Leac # a0: scratch reg, a2: sp |
1106 | 1097 | ||
1107 | _beqi a6, SYSXTENSA_ATOMIC_SET, .Lset | 1098 | addi a6, a6, -1 # assuming SYS_XTENSA_ATOMIC_SET = 1 |
1108 | _beqi a6, SYSXTENSA_ATOMIC_EXG_ADD, .Lexg | 1099 | _bgeui a6, SYS_XTENSA_COUNT - 1, .Lill |
1109 | _beqi a6, SYSXTENSA_ATOMIC_ADD, .Ladd | 1100 | _bnei a6, SYS_XTENSA_ATOMIC_CMP_SWP - 1, .Lnswp |
1110 | 1101 | ||
1111 | /* Fall through for SYSXTENSA_ATOMIC_CMP_SWP */ | 1102 | /* Fall through for ATOMIC_CMP_SWP. */ |
1112 | 1103 | ||
1113 | .Lswp: /* Atomic compare and swap */ | 1104 | .Lswp: /* Atomic compare and swap */ |
1114 | 1105 | ||
1115 | TRY l32i a7, a3, 0 # read old value | 1106 | TRY l32i a0, a3, 0 # read old value |
1116 | bne a7, a4, 1f # same as old value? jump | 1107 | bne a0, a4, 1f # same as old value? jump |
1117 | s32i a5, a3, 0 # different, modify value | 1108 | TRY s32i a5, a3, 0 # different, modify value |
1118 | movi a7, 1 # and return 1 | 1109 | l32i a7, a2, PT_AREG7 # restore a7 |
1119 | j .Lret | 1110 | l32i a0, a2, PT_AREG0 # restore a0 |
1120 | 1111 | movi a2, 1 # and return 1 | |
1121 | 1: movi a7, 0 # same values: return 0 | 1112 | addi a6, a6, 1 # restore a6 (really necessary?) |
1122 | j .Lret | 1113 | rfe |
1123 | |||
1124 | .Ladd: /* Atomic add */ | ||
1125 | .Lexg: /* Atomic (exchange) add */ | ||
1126 | 1114 | ||
1127 | TRY l32i a7, a3, 0 | 1115 | 1: l32i a7, a2, PT_AREG7 # restore a7 |
1128 | add a4, a4, a7 | 1116 | l32i a0, a2, PT_AREG0 # restore a0 |
1129 | s32i a4, a3, 0 | 1117 | movi a2, 0 # return 0 (note that we cannot set |
1130 | j .Lret | 1118 | addi a6, a6, 1 # restore a6 (really necessary?) |
1119 | rfe | ||
1131 | 1120 | ||
1132 | .Lset: /* Atomic set */ | 1121 | .Lnswp: /* Atomic set, add, and exg_add. */ |
1133 | 1122 | ||
1134 | TRY l32i a7, a3, 0 # read old value as return value | 1123 | TRY l32i a7, a3, 0 # orig |
1135 | s32i a4, a3, 0 # write new value | 1124 | add a0, a4, a7 # + arg |
1125 | moveqz a0, a4, a6 # set | ||
1126 | TRY s32i a0, a3, 0 # write new value | ||
1136 | 1127 | ||
1137 | .Lret: mov a0, a2 | 1128 | mov a0, a2 |
1138 | mov a2, a7 | 1129 | mov a2, a7 |
1139 | l32i a7, a0, PT_AREG7 | 1130 | l32i a7, a0, PT_AREG7 # restore a7 |
1140 | l32i a3, a0, PT_AREG3 | 1131 | l32i a0, a0, PT_AREG0 # restore a0 |
1141 | l32i a0, a0, PT_AREG0 | 1132 | addi a6, a6, 1 # restore a6 (really necessary?) |
1142 | rfe | 1133 | rfe |
1143 | 1134 | ||
1144 | CATCH | 1135 | CATCH |
1145 | .Leac: movi a7, -EFAULT | 1136 | .Leac: l32i a7, a2, PT_AREG7 # restore a7 |
1146 | j .Lret | 1137 | l32i a0, a2, PT_AREG0 # restore a0 |
1138 | movi a2, -EFAULT | ||
1139 | rfe | ||
1140 | |||
1141 | .Lill: l32i a7, a2, PT_AREG0 # restore a7 | ||
1142 | l32i a0, a2, PT_AREG0 # restore a0 | ||
1143 | movi a2, -EINVAL | ||
1144 | rfe | ||
1145 | |||
1147 | 1146 | ||
1148 | 1147 | ||
1149 | 1148 | ||
@@ -1907,6 +1906,103 @@ ENTRY(fast_coprocessor) | |||
1907 | #endif /* XCHAL_EXTRA_SA_SIZE */ | 1906 | #endif /* XCHAL_EXTRA_SA_SIZE */ |
1908 | 1907 | ||
1909 | /* | 1908 | /* |
1909 | * System Calls. | ||
1910 | * | ||
1911 | * void system_call (struct pt_regs* regs, int exccause) | ||
1912 | * a2 a3 | ||
1913 | */ | ||
1914 | |||
1915 | ENTRY(system_call) | ||
1916 | entry a1, 32 | ||
1917 | |||
1918 | /* regs->syscall = regs->areg[2] */ | ||
1919 | |||
1920 | l32i a3, a2, PT_AREG2 | ||
1921 | mov a6, a2 | ||
1922 | movi a4, do_syscall_trace_enter | ||
1923 | s32i a3, a2, PT_SYSCALL | ||
1924 | callx4 a4 | ||
1925 | |||
1926 | /* syscall = sys_call_table[syscall_nr] */ | ||
1927 | |||
1928 | movi a4, sys_call_table; | ||
1929 | movi a5, __NR_syscall_count | ||
1930 | movi a6, -ENOSYS | ||
1931 | bgeu a3, a5, 1f | ||
1932 | |||
1933 | addx4 a4, a3, a4 | ||
1934 | l32i a4, a4, 0 | ||
1935 | movi a5, sys_ni_syscall; | ||
1936 | beq a4, a5, 1f | ||
1937 | |||
1938 | /* Load args: arg0 - arg5 are passed via regs. */ | ||
1939 | |||
1940 | l32i a6, a2, PT_AREG6 | ||
1941 | l32i a7, a2, PT_AREG3 | ||
1942 | l32i a8, a2, PT_AREG4 | ||
1943 | l32i a9, a2, PT_AREG5 | ||
1944 | l32i a10, a2, PT_AREG8 | ||
1945 | l32i a11, a2, PT_AREG9 | ||
1946 | |||
1947 | /* Pass one additional argument to the syscall: pt_regs (on stack) */ | ||
1948 | s32i a2, a1, 0 | ||
1949 | |||
1950 | callx4 a4 | ||
1951 | |||
1952 | 1: /* regs->areg[2] = return_value */ | ||
1953 | |||
1954 | s32i a6, a2, PT_AREG2 | ||
1955 | movi a4, do_syscall_trace_leave | ||
1956 | mov a6, a2 | ||
1957 | callx4 a4 | ||
1958 | retw | ||
1959 | |||
1960 | |||
1961 | /* | ||
1962 | * Create a kernel thread | ||
1963 | * | ||
1964 | * int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) | ||
1965 | * a2 a2 a3 a4 | ||
1966 | */ | ||
1967 | |||
1968 | ENTRY(kernel_thread) | ||
1969 | entry a1, 16 | ||
1970 | |||
1971 | mov a5, a2 # preserve fn over syscall | ||
1972 | mov a7, a3 # preserve args over syscall | ||
1973 | |||
1974 | movi a3, _CLONE_VM | _CLONE_UNTRACED | ||
1975 | movi a2, __NR_clone | ||
1976 | or a6, a4, a3 # arg0: flags | ||
1977 | mov a3, a1 # arg1: sp | ||
1978 | syscall | ||
1979 | |||
1980 | beq a3, a1, 1f # branch if parent | ||
1981 | mov a6, a7 # args | ||
1982 | callx4 a5 # fn(args) | ||
1983 | |||
1984 | movi a2, __NR_exit | ||
1985 | syscall # return value of fn(args) still in a6 | ||
1986 | |||
1987 | 1: retw | ||
1988 | |||
1989 | /* | ||
1990 | * Do a system call from kernel instead of calling sys_execve, so we end up | ||
1991 | * with proper pt_regs. | ||
1992 | * | ||
1993 | * int kernel_execve(const char *fname, char *const argv[], charg *const envp[]) | ||
1994 | * a2 a2 a3 a4 | ||
1995 | */ | ||
1996 | |||
1997 | ENTRY(kernel_execve) | ||
1998 | entry a1, 16 | ||
1999 | mov a6, a2 # arg0 is in a6 | ||
2000 | movi a2, __NR_execve | ||
2001 | syscall | ||
2002 | |||
2003 | retw | ||
2004 | |||
2005 | /* | ||
1910 | * Task switch. | 2006 | * Task switch. |
1911 | * | 2007 | * |
1912 | * struct task* _switch_to (struct task* prev, struct task* next) | 2008 | * struct task* _switch_to (struct task* prev, struct task* next) |
@@ -1964,33 +2060,9 @@ ENTRY(ret_from_fork) | |||
1964 | movi a4, schedule_tail | 2060 | movi a4, schedule_tail |
1965 | callx4 a4 | 2061 | callx4 a4 |
1966 | 2062 | ||
1967 | movi a4, do_syscall_trace | 2063 | movi a4, do_syscall_trace_leave |
2064 | mov a6, a1 | ||
1968 | callx4 a4 | 2065 | callx4 a4 |
1969 | 2066 | ||
1970 | j common_exception_return | 2067 | j common_exception_return |
1971 | 2068 | ||
1972 | |||
1973 | |||
1974 | /* | ||
1975 | * Table of syscalls | ||
1976 | */ | ||
1977 | |||
1978 | .data | ||
1979 | .align 4 | ||
1980 | .global sys_call_table | ||
1981 | sys_call_table: | ||
1982 | |||
1983 | #define SYSCALL(call, narg) .word call | ||
1984 | #include "syscalls.h" | ||
1985 | |||
1986 | /* | ||
1987 | * Number of arguments of each syscall | ||
1988 | */ | ||
1989 | |||
1990 | .global sys_narg_table | ||
1991 | sys_narg_table: | ||
1992 | |||
1993 | #undef SYSCALL | ||
1994 | #define SYSCALL(call, narg) .byte narg | ||
1995 | #include "syscalls.h" | ||
1996 | |||
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c index 3785f3481d71..795bd5ac6f4c 100644 --- a/arch/xtensa/kernel/process.c +++ b/arch/xtensa/kernel/process.c | |||
@@ -161,36 +161,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, | |||
161 | 161 | ||
162 | 162 | ||
163 | /* | 163 | /* |
164 | * Create a kernel thread | ||
165 | */ | ||
166 | |||
167 | int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) | ||
168 | { | ||
169 | long retval; | ||
170 | __asm__ __volatile__ | ||
171 | ("mov a5, %4\n\t" /* preserve fn in a5 */ | ||
172 | "mov a6, %3\n\t" /* preserve and setup arg in a6 */ | ||
173 | "movi a2, %1\n\t" /* load __NR_clone for syscall*/ | ||
174 | "mov a3, sp\n\t" /* sp check and sys_clone */ | ||
175 | "mov a4, %5\n\t" /* load flags for syscall */ | ||
176 | "syscall\n\t" | ||
177 | "beq a3, sp, 1f\n\t" /* branch if parent */ | ||
178 | "callx4 a5\n\t" /* call fn */ | ||
179 | "movi a2, %2\n\t" /* load __NR_exit for syscall */ | ||
180 | "mov a3, a6\n\t" /* load fn return value */ | ||
181 | "syscall\n" | ||
182 | "1:\n\t" | ||
183 | "mov %0, a2\n\t" /* parent returns zero */ | ||
184 | :"=r" (retval) | ||
185 | :"i" (__NR_clone), "i" (__NR_exit), | ||
186 | "r" (arg), "r" (fn), | ||
187 | "r" (flags | CLONE_VM) | ||
188 | : "a2", "a3", "a4", "a5", "a6" ); | ||
189 | return retval; | ||
190 | } | ||
191 | |||
192 | |||
193 | /* | ||
194 | * These bracket the sleeping functions.. | 164 | * These bracket the sleeping functions.. |
195 | */ | 165 | */ |
196 | 166 | ||
@@ -452,3 +422,44 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *r) | |||
452 | { | 422 | { |
453 | return dump_task_fpu(regs, current, r); | 423 | return dump_task_fpu(regs, current, r); |
454 | } | 424 | } |
425 | |||
426 | asmlinkage | ||
427 | long xtensa_clone(unsigned long clone_flags, unsigned long newsp, | ||
428 | void __user *parent_tid, void *child_tls, | ||
429 | void __user *child_tid, long a5, | ||
430 | struct pt_regs *regs) | ||
431 | { | ||
432 | if (!newsp) | ||
433 | newsp = regs->areg[1]; | ||
434 | return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid); | ||
435 | } | ||
436 | |||
437 | /* | ||
438 | * * xtensa_execve() executes a new program. | ||
439 | * */ | ||
440 | |||
441 | asmlinkage | ||
442 | long xtensa_execve(char __user *name, char __user * __user *argv, | ||
443 | char __user * __user *envp, | ||
444 | long a3, long a4, long a5, | ||
445 | struct pt_regs *regs) | ||
446 | { | ||
447 | long error; | ||
448 | char * filename; | ||
449 | |||
450 | filename = getname(name); | ||
451 | error = PTR_ERR(filename); | ||
452 | if (IS_ERR(filename)) | ||
453 | goto out; | ||
454 | // FIXME: release coprocessor?? | ||
455 | error = do_execve(filename, argv, envp, regs); | ||
456 | if (error == 0) { | ||
457 | task_lock(current); | ||
458 | current->ptrace &= ~PT_DTRACE; | ||
459 | task_unlock(current); | ||
460 | } | ||
461 | putname(filename); | ||
462 | out: | ||
463 | return error; | ||
464 | } | ||
465 | |||
diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c index 604c3c3c6759..8b6d3d0623b6 100644 --- a/arch/xtensa/kernel/ptrace.c +++ b/arch/xtensa/kernel/ptrace.c | |||
@@ -332,12 +332,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
332 | 332 | ||
333 | void do_syscall_trace(void) | 333 | void do_syscall_trace(void) |
334 | { | 334 | { |
335 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) | ||
336 | return; | ||
337 | |||
338 | if (!(current->ptrace & PT_PTRACED)) | ||
339 | return; | ||
340 | |||
341 | /* | 335 | /* |
342 | * The 0x80 provides a way for the tracing parent to distinguish | 336 | * The 0x80 provides a way for the tracing parent to distinguish |
343 | * between a syscall stop and SIGTRAP delivery | 337 | * between a syscall stop and SIGTRAP delivery |
@@ -354,3 +348,23 @@ void do_syscall_trace(void) | |||
354 | current->exit_code = 0; | 348 | current->exit_code = 0; |
355 | } | 349 | } |
356 | } | 350 | } |
351 | |||
352 | void do_syscall_trace_enter(struct pt_regs *regs) | ||
353 | { | ||
354 | if (test_thread_flag(TIF_SYSCALL_TRACE) | ||
355 | && (current->ptrace & PT_PTRACED)) | ||
356 | do_syscall_trace(); | ||
357 | |||
358 | #if 0 | ||
359 | if (unlikely(current->audit_context)) | ||
360 | audit_syscall_entry(current, AUDIT_ARCH_XTENSA..); | ||
361 | #endif | ||
362 | } | ||
363 | |||
364 | void do_syscall_trace_leave(struct pt_regs *regs) | ||
365 | { | ||
366 | if ((test_thread_flag(TIF_SYSCALL_TRACE)) | ||
367 | && (current->ptrace & PT_PTRACED)) | ||
368 | do_syscall_trace(); | ||
369 | } | ||
370 | |||
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c index 6af7f4145990..c6d9880a4cdb 100644 --- a/arch/xtensa/kernel/signal.c +++ b/arch/xtensa/kernel/signal.c | |||
@@ -46,7 +46,7 @@ extern struct task_struct *coproc_owners[]; | |||
46 | * Atomically swap in the new signal mask, and wait for a signal. | 46 | * Atomically swap in the new signal mask, and wait for a signal. |
47 | */ | 47 | */ |
48 | 48 | ||
49 | int sys_sigsuspend(struct pt_regs *regs) | 49 | int xtensa_sigsuspend(struct pt_regs *regs) |
50 | { | 50 | { |
51 | old_sigset_t mask = (old_sigset_t) regs->areg[3]; | 51 | old_sigset_t mask = (old_sigset_t) regs->areg[3]; |
52 | sigset_t saveset; | 52 | sigset_t saveset; |
@@ -68,7 +68,7 @@ int sys_sigsuspend(struct pt_regs *regs) | |||
68 | } | 68 | } |
69 | 69 | ||
70 | asmlinkage int | 70 | asmlinkage int |
71 | sys_rt_sigsuspend(struct pt_regs *regs) | 71 | xtensa_rt_sigsuspend(struct pt_regs *regs) |
72 | { | 72 | { |
73 | sigset_t *unewset = (sigset_t *) regs->areg[4]; | 73 | sigset_t *unewset = (sigset_t *) regs->areg[4]; |
74 | size_t sigsetsize = (size_t) regs->areg[3]; | 74 | size_t sigsetsize = (size_t) regs->areg[3]; |
@@ -96,7 +96,7 @@ sys_rt_sigsuspend(struct pt_regs *regs) | |||
96 | } | 96 | } |
97 | 97 | ||
98 | asmlinkage int | 98 | asmlinkage int |
99 | sys_sigaction(int sig, const struct old_sigaction *act, | 99 | xtensa_sigaction(int sig, const struct old_sigaction *act, |
100 | struct old_sigaction *oact) | 100 | struct old_sigaction *oact) |
101 | { | 101 | { |
102 | struct k_sigaction new_ka, old_ka; | 102 | struct k_sigaction new_ka, old_ka; |
@@ -128,7 +128,7 @@ sys_sigaction(int sig, const struct old_sigaction *act, | |||
128 | } | 128 | } |
129 | 129 | ||
130 | asmlinkage int | 130 | asmlinkage int |
131 | sys_sigaltstack(struct pt_regs *regs) | 131 | xtensa_sigaltstack(struct pt_regs *regs) |
132 | { | 132 | { |
133 | const stack_t *uss = (stack_t *) regs->areg[4]; | 133 | const stack_t *uss = (stack_t *) regs->areg[4]; |
134 | stack_t *uoss = (stack_t *) regs->areg[3]; | 134 | stack_t *uoss = (stack_t *) regs->areg[3]; |
@@ -350,7 +350,7 @@ setup_sigcontext(struct sigcontext *sc, struct _cpstate *cpstate, | |||
350 | return err; | 350 | return err; |
351 | } | 351 | } |
352 | 352 | ||
353 | asmlinkage int sys_sigreturn(struct pt_regs *regs) | 353 | asmlinkage int xtensa_sigreturn(struct pt_regs *regs) |
354 | { | 354 | { |
355 | struct sigframe *frame = (struct sigframe *)regs->areg[1]; | 355 | struct sigframe *frame = (struct sigframe *)regs->areg[1]; |
356 | sigset_t set; | 356 | sigset_t set; |
@@ -382,7 +382,7 @@ badframe: | |||
382 | return 0; | 382 | return 0; |
383 | } | 383 | } |
384 | 384 | ||
385 | asmlinkage int sys_rt_sigreturn(struct pt_regs *regs) | 385 | asmlinkage int xtensa_rt_sigreturn(struct pt_regs *regs) |
386 | { | 386 | { |
387 | struct rt_sigframe *frame = (struct rt_sigframe *)regs->areg[1]; | 387 | struct rt_sigframe *frame = (struct rt_sigframe *)regs->areg[1]; |
388 | sigset_t set; | 388 | sigset_t set; |
diff --git a/arch/xtensa/kernel/syscall.c b/arch/xtensa/kernel/syscall.c new file mode 100644 index 000000000000..418268f49766 --- /dev/null +++ b/arch/xtensa/kernel/syscall.c | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * arch/xtensa/kernel/syscall.c | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | * Copyright (C) 2000 Silicon Graphics, Inc. | ||
10 | * Copyright (C) 1995 - 2000 by Ralf Baechle | ||
11 | * | ||
12 | * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com> | ||
13 | * Marc Gauthier <marc@tensilica.com, marc@alumni.uwaterloo.ca> | ||
14 | * Chris Zankel <chris@zankel.net> | ||
15 | * Kevin Chea | ||
16 | * | ||
17 | */ | ||
18 | #include <asm/uaccess.h> | ||
19 | #include <asm/syscalls.h> | ||
20 | #include <asm/unistd.h> | ||
21 | #include <linux/linkage.h> | ||
22 | #include <linux/stringify.h> | ||
23 | #include <linux/errno.h> | ||
24 | #include <linux/syscalls.h> | ||
25 | #include <linux/file.h> | ||
26 | #include <linux/fs.h> | ||
27 | #include <linux/mman.h> | ||
28 | #include <linux/shm.h> | ||
29 | |||
30 | typedef void (*syscall_t)(void); | ||
31 | |||
32 | syscall_t sys_call_table[__NR_syscall_count] /* FIXME __cacheline_aligned */= { | ||
33 | [0 ... __NR_syscall_count - 1] = (syscall_t)&sys_ni_syscall, | ||
34 | |||
35 | #undef __SYSCALL | ||
36 | #define __SYSCALL(nr,symbol,nargs) [ nr ] = (syscall_t)symbol, | ||
37 | #undef _XTENSA_UNISTD_H | ||
38 | #undef __KERNEL_SYSCALLS__ | ||
39 | #include <asm/unistd.h> | ||
40 | }; | ||
41 | |||
42 | /* | ||
43 | * xtensa_pipe() is the normal C calling standard for creating a pipe. It's not | ||
44 | * the way unix traditional does this, though. | ||
45 | */ | ||
46 | |||
47 | asmlinkage long xtensa_pipe(int __user *userfds) | ||
48 | { | ||
49 | int fd[2]; | ||
50 | int error; | ||
51 | |||
52 | error = do_pipe(fd); | ||
53 | if (!error) { | ||
54 | if (copy_to_user(userfds, fd, 2 * sizeof(int))) | ||
55 | error = -EFAULT; | ||
56 | } | ||
57 | return error; | ||
58 | } | ||
59 | |||
60 | |||
61 | asmlinkage long xtensa_mmap2(unsigned long addr, unsigned long len, | ||
62 | unsigned long prot, unsigned long flags, | ||
63 | unsigned long fd, unsigned long pgoff) | ||
64 | { | ||
65 | int error = -EBADF; | ||
66 | struct file * file = NULL; | ||
67 | |||
68 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
69 | if (!(flags & MAP_ANONYMOUS)) { | ||
70 | file = fget(fd); | ||
71 | if (!file) | ||
72 | goto out; | ||
73 | } | ||
74 | |||
75 | down_write(¤t->mm->mmap_sem); | ||
76 | error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
77 | up_write(¤t->mm->mmap_sem); | ||
78 | |||
79 | if (file) | ||
80 | fput(file); | ||
81 | out: | ||
82 | return error; | ||
83 | } | ||
84 | |||
85 | asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg) | ||
86 | { | ||
87 | unsigned long ret; | ||
88 | long err; | ||
89 | |||
90 | err = do_shmat(shmid, shmaddr, shmflg, &ret); | ||
91 | if (err) | ||
92 | return err; | ||
93 | return (long)ret; | ||
94 | } | ||
95 | |||
diff --git a/arch/xtensa/kernel/syscalls.c b/arch/xtensa/kernel/syscalls.c deleted file mode 100644 index f9a5a752ca69..000000000000 --- a/arch/xtensa/kernel/syscalls.c +++ /dev/null | |||
@@ -1,288 +0,0 @@ | |||
1 | /* | ||
2 | * arch/xtensa/kernel/syscalls.c | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | * Copyright (C) 2000 Silicon Graphics, Inc. | ||
10 | * Copyright (C) 1995 - 2000 by Ralf Baechle | ||
11 | * | ||
12 | * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com> | ||
13 | * Marc Gauthier <marc@tensilica.com, marc@alumni.uwaterloo.ca> | ||
14 | * Chris Zankel <chris@zankel.net> | ||
15 | * Kevin Chea | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #define DEBUG 0 | ||
20 | |||
21 | #include <linux/linkage.h> | ||
22 | #include <linux/mm.h> | ||
23 | #include <linux/smp.h> | ||
24 | #include <linux/smp_lock.h> | ||
25 | #include <linux/mman.h> | ||
26 | #include <linux/sched.h> | ||
27 | #include <linux/file.h> | ||
28 | #include <linux/slab.h> | ||
29 | #include <linux/utsname.h> | ||
30 | #include <linux/unistd.h> | ||
31 | #include <linux/stringify.h> | ||
32 | #include <linux/syscalls.h> | ||
33 | #include <linux/sem.h> | ||
34 | #include <linux/msg.h> | ||
35 | #include <linux/shm.h> | ||
36 | #include <linux/errno.h> | ||
37 | #include <asm/ptrace.h> | ||
38 | #include <asm/signal.h> | ||
39 | #include <asm/uaccess.h> | ||
40 | #include <asm/hardirq.h> | ||
41 | #include <asm/mman.h> | ||
42 | #include <asm/shmparam.h> | ||
43 | #include <asm/page.h> | ||
44 | |||
45 | extern void do_syscall_trace(void); | ||
46 | typedef int (*syscall_t)(void *a0,...); | ||
47 | extern syscall_t sys_call_table[]; | ||
48 | extern unsigned char sys_narg_table[]; | ||
49 | |||
50 | /* | ||
51 | * sys_pipe() is the normal C calling standard for creating a pipe. It's not | ||
52 | * the way unix traditional does this, though. | ||
53 | */ | ||
54 | |||
55 | int sys_pipe(int __user *userfds) | ||
56 | { | ||
57 | int fd[2]; | ||
58 | int error; | ||
59 | |||
60 | error = do_pipe(fd); | ||
61 | if (!error) { | ||
62 | if (copy_to_user(userfds, fd, 2 * sizeof(int))) | ||
63 | error = -EFAULT; | ||
64 | } | ||
65 | return error; | ||
66 | } | ||
67 | |||
68 | /* | ||
69 | * Common code for old and new mmaps. | ||
70 | */ | ||
71 | long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, | ||
72 | unsigned long flags, unsigned long fd, unsigned long pgoff) | ||
73 | { | ||
74 | int error = -EBADF; | ||
75 | struct file * file = NULL; | ||
76 | |||
77 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
78 | if (!(flags & MAP_ANONYMOUS)) { | ||
79 | file = fget(fd); | ||
80 | if (!file) | ||
81 | goto out; | ||
82 | } | ||
83 | |||
84 | down_write(¤t->mm->mmap_sem); | ||
85 | error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
86 | up_write(¤t->mm->mmap_sem); | ||
87 | |||
88 | if (file) | ||
89 | fput(file); | ||
90 | out: | ||
91 | return error; | ||
92 | } | ||
93 | |||
94 | int sys_clone(struct pt_regs *regs) | ||
95 | { | ||
96 | unsigned long clone_flags; | ||
97 | unsigned long newsp; | ||
98 | int __user *parent_tidptr, *child_tidptr; | ||
99 | clone_flags = regs->areg[4]; | ||
100 | newsp = regs->areg[3]; | ||
101 | parent_tidptr = (int __user *)regs->areg[5]; | ||
102 | child_tidptr = (int __user *)regs->areg[6]; | ||
103 | if (!newsp) | ||
104 | newsp = regs->areg[1]; | ||
105 | return do_fork(clone_flags,newsp,regs,0,parent_tidptr,child_tidptr); | ||
106 | } | ||
107 | |||
108 | /* | ||
109 | * sys_execve() executes a new program. | ||
110 | */ | ||
111 | |||
112 | int sys_execve(struct pt_regs *regs) | ||
113 | { | ||
114 | int error; | ||
115 | char * filename; | ||
116 | |||
117 | filename = getname((char *) (long)regs->areg[5]); | ||
118 | error = PTR_ERR(filename); | ||
119 | if (IS_ERR(filename)) | ||
120 | goto out; | ||
121 | error = do_execve(filename, (char **) (long)regs->areg[3], | ||
122 | (char **) (long)regs->areg[4], regs); | ||
123 | putname(filename); | ||
124 | |||
125 | out: | ||
126 | return error; | ||
127 | } | ||
128 | |||
129 | int sys_uname(struct old_utsname * name) | ||
130 | { | ||
131 | if (name && !copy_to_user(name, utsname(), sizeof (*name))) | ||
132 | return 0; | ||
133 | return -EFAULT; | ||
134 | } | ||
135 | |||
136 | /* | ||
137 | * Build the string table for the builtin "poor man's strace". | ||
138 | */ | ||
139 | |||
140 | #if DEBUG | ||
141 | #define SYSCALL(fun, narg) #fun, | ||
142 | static char *sfnames[] = { | ||
143 | #include "syscalls.h" | ||
144 | }; | ||
145 | #undef SYS | ||
146 | #endif | ||
147 | |||
148 | void system_call (struct pt_regs *regs) | ||
149 | { | ||
150 | syscall_t syscall; | ||
151 | unsigned long parm0, parm1, parm2, parm3, parm4, parm5; | ||
152 | int nargs, res; | ||
153 | unsigned int syscallnr; | ||
154 | int ps; | ||
155 | |||
156 | #if DEBUG | ||
157 | int i; | ||
158 | unsigned long parms[6]; | ||
159 | char *sysname; | ||
160 | #endif | ||
161 | |||
162 | regs->syscall = regs->areg[2]; | ||
163 | |||
164 | do_syscall_trace(); | ||
165 | |||
166 | /* Have to load after syscall_trace because strace | ||
167 | * sometimes changes regs->syscall. | ||
168 | */ | ||
169 | syscallnr = regs->syscall; | ||
170 | |||
171 | parm0 = parm1 = parm2 = parm3 = parm4 = parm5 = 0; | ||
172 | |||
173 | /* Restore interrupt level to syscall invoker's. | ||
174 | * If this were in assembly, we wouldn't disable | ||
175 | * interrupts in the first place: | ||
176 | */ | ||
177 | local_save_flags (ps); | ||
178 | local_irq_restore((ps & ~PS_INTLEVEL_MASK) | | ||
179 | (regs->ps & PS_INTLEVEL_MASK) ); | ||
180 | |||
181 | if (syscallnr > __NR_Linux_syscalls) { | ||
182 | regs->areg[2] = -ENOSYS; | ||
183 | return; | ||
184 | } | ||
185 | |||
186 | syscall = sys_call_table[syscallnr]; | ||
187 | nargs = sys_narg_table[syscallnr]; | ||
188 | |||
189 | if (syscall == NULL) { | ||
190 | regs->areg[2] = -ENOSYS; | ||
191 | return; | ||
192 | } | ||
193 | |||
194 | /* There shouldn't be more than six arguments in the table! */ | ||
195 | |||
196 | if (nargs > 6) | ||
197 | panic("Internal error - too many syscall arguments (%d)!\n", | ||
198 | nargs); | ||
199 | |||
200 | /* Linux takes system-call arguments in registers. The ABI | ||
201 | * and Xtensa software conventions require the system-call | ||
202 | * number in a2. If an argument exists in a2, we move it to | ||
203 | * the next available register. Note that for improved | ||
204 | * efficiency, we do NOT shift all parameters down one | ||
205 | * register to maintain the original order. | ||
206 | * | ||
207 | * At best case (zero arguments), we just write the syscall | ||
208 | * number to a2. At worst case (1 to 6 arguments), we move | ||
209 | * the argument in a2 to the next available register, then | ||
210 | * write the syscall number to a2. | ||
211 | * | ||
212 | * For clarity, the following truth table enumerates all | ||
213 | * possibilities. | ||
214 | * | ||
215 | * arguments syscall number arg0, arg1, arg2, arg3, arg4, arg5 | ||
216 | * --------- -------------- ---------------------------------- | ||
217 | * 0 a2 | ||
218 | * 1 a2 a3 | ||
219 | * 2 a2 a4, a3 | ||
220 | * 3 a2 a5, a3, a4 | ||
221 | * 4 a2 a6, a3, a4, a5 | ||
222 | * 5 a2 a7, a3, a4, a5, a6 | ||
223 | * 6 a2 a8, a3, a4, a5, a6, a7 | ||
224 | */ | ||
225 | if (nargs) { | ||
226 | parm0 = regs->areg[nargs+2]; | ||
227 | parm1 = regs->areg[3]; | ||
228 | parm2 = regs->areg[4]; | ||
229 | parm3 = regs->areg[5]; | ||
230 | parm4 = regs->areg[6]; | ||
231 | parm5 = regs->areg[7]; | ||
232 | } else /* nargs == 0 */ | ||
233 | parm0 = (unsigned long) regs; | ||
234 | |||
235 | #if DEBUG | ||
236 | parms[0] = parm0; | ||
237 | parms[1] = parm1; | ||
238 | parms[2] = parm2; | ||
239 | parms[3] = parm3; | ||
240 | parms[4] = parm4; | ||
241 | parms[5] = parm5; | ||
242 | |||
243 | sysname = sfnames[syscallnr]; | ||
244 | if (strncmp(sysname, "sys_", 4) == 0) | ||
245 | sysname = sysname + 4; | ||
246 | |||
247 | printk("\017SYSCALL:I:%x:%d:%s %s(", regs->pc, current->pid, | ||
248 | current->comm, sysname); | ||
249 | for (i = 0; i < nargs; i++) | ||
250 | printk((i>0) ? ", %#lx" : "%#lx", parms[i]); | ||
251 | printk(")\n"); | ||
252 | #endif | ||
253 | |||
254 | res = syscall((void *)parm0, parm1, parm2, parm3, parm4, parm5); | ||
255 | |||
256 | #if DEBUG | ||
257 | printk("\017SYSCALL:O:%d:%s %s(",current->pid, current->comm, sysname); | ||
258 | for (i = 0; i < nargs; i++) | ||
259 | printk((i>0) ? ", %#lx" : "%#lx", parms[i]); | ||
260 | if (res < 4096) | ||
261 | printk(") = %d\n", res); | ||
262 | else | ||
263 | printk(") = %#x\n", res); | ||
264 | #endif /* DEBUG */ | ||
265 | |||
266 | regs->areg[2] = res; | ||
267 | do_syscall_trace(); | ||
268 | } | ||
269 | |||
270 | /* | ||
271 | * Do a system call from kernel instead of calling sys_execve so we | ||
272 | * end up with proper pt_regs. | ||
273 | */ | ||
274 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | ||
275 | { | ||
276 | long __res; | ||
277 | asm volatile ( | ||
278 | " mov a5, %2 \n" | ||
279 | " mov a4, %4 \n" | ||
280 | " mov a3, %3 \n" | ||
281 | " movi a2, %1 \n" | ||
282 | " syscall \n" | ||
283 | " mov %0, a2 \n" | ||
284 | : "=a" (__res) | ||
285 | : "i" (__NR_execve), "a" (filename), "a" (argv), "a" (envp) | ||
286 | : "a2", "a3", "a4", "a5"); | ||
287 | return __res; | ||
288 | } | ||
diff --git a/arch/xtensa/kernel/syscalls.h b/arch/xtensa/kernel/syscalls.h deleted file mode 100644 index 216c10a31501..000000000000 --- a/arch/xtensa/kernel/syscalls.h +++ /dev/null | |||
@@ -1,247 +0,0 @@ | |||
1 | /* | ||
2 | * arch/xtensa/kernel/syscalls.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 1995, 1996, 1997, 1998 by Ralf Baechle | ||
9 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
10 | * | ||
11 | * Changes by Joe Taylor <joe@tensilica.com> | ||
12 | */ | ||
13 | |||
14 | /* | ||
15 | * This file is being included twice - once to build a list of all | ||
16 | * syscalls and once to build a table of how many arguments each syscall | ||
17 | * accepts. Syscalls that receive a pointer to the saved registers are | ||
18 | * marked as having zero arguments. | ||
19 | * | ||
20 | * The binary compatibility calls are in a separate list. | ||
21 | * | ||
22 | * Entry '0' used to be system_call. It's removed to disable indirect | ||
23 | * system calls for now so user tasks can't recurse. See mips' | ||
24 | * sys_syscall for a comparable example. | ||
25 | */ | ||
26 | |||
27 | SYSCALL(0, 0) /* 00 */ | ||
28 | SYSCALL(sys_exit, 1) | ||
29 | SYSCALL(sys_ni_syscall, 0) | ||
30 | SYSCALL(sys_read, 3) | ||
31 | SYSCALL(sys_write, 3) | ||
32 | SYSCALL(sys_open, 3) /* 05 */ | ||
33 | SYSCALL(sys_close, 1) | ||
34 | SYSCALL(sys_ni_syscall, 3) | ||
35 | SYSCALL(sys_creat, 2) | ||
36 | SYSCALL(sys_link, 2) | ||
37 | SYSCALL(sys_unlink, 1) /* 10 */ | ||
38 | SYSCALL(sys_execve, 0) | ||
39 | SYSCALL(sys_chdir, 1) | ||
40 | SYSCALL(sys_ni_syscall, 1) | ||
41 | SYSCALL(sys_mknod, 3) | ||
42 | SYSCALL(sys_chmod, 2) /* 15 */ | ||
43 | SYSCALL(sys_lchown, 3) | ||
44 | SYSCALL(sys_ni_syscall, 0) | ||
45 | SYSCALL(sys_newstat, 2) | ||
46 | SYSCALL(sys_lseek, 3) | ||
47 | SYSCALL(sys_getpid, 0) /* 20 */ | ||
48 | SYSCALL(sys_mount, 5) | ||
49 | SYSCALL(sys_ni_syscall, 1) | ||
50 | SYSCALL(sys_setuid, 1) | ||
51 | SYSCALL(sys_getuid, 0) | ||
52 | SYSCALL(sys_ni_syscall, 1) /* 25 */ | ||
53 | SYSCALL(sys_ptrace, 4) | ||
54 | SYSCALL(sys_ni_syscall, 1) | ||
55 | SYSCALL(sys_newfstat, 2) | ||
56 | SYSCALL(sys_ni_syscall, 0) | ||
57 | SYSCALL(sys_utime, 2) /* 30 */ | ||
58 | SYSCALL(sys_ni_syscall, 0) | ||
59 | SYSCALL(sys_ni_syscall, 0) | ||
60 | SYSCALL(sys_access, 2) | ||
61 | SYSCALL(sys_ni_syscall, 1) | ||
62 | SYSCALL(sys_ni_syscall, 0) /* 35 */ | ||
63 | SYSCALL(sys_sync, 0) | ||
64 | SYSCALL(sys_kill, 2) | ||
65 | SYSCALL(sys_rename, 2) | ||
66 | SYSCALL(sys_mkdir, 2) | ||
67 | SYSCALL(sys_rmdir, 1) /* 40 */ | ||
68 | SYSCALL(sys_dup, 1) | ||
69 | SYSCALL(sys_pipe, 1) | ||
70 | SYSCALL(sys_times, 1) | ||
71 | SYSCALL(sys_ni_syscall, 0) | ||
72 | SYSCALL(sys_brk, 1) /* 45 */ | ||
73 | SYSCALL(sys_setgid, 1) | ||
74 | SYSCALL(sys_getgid, 0) | ||
75 | SYSCALL(sys_ni_syscall, 0) | ||
76 | SYSCALL(sys_geteuid, 0) | ||
77 | SYSCALL(sys_getegid, 0) /* 50 */ | ||
78 | SYSCALL(sys_acct, 1) | ||
79 | SYSCALL(sys_umount, 2) | ||
80 | SYSCALL(sys_ni_syscall, 0) | ||
81 | SYSCALL(sys_ioctl, 3) | ||
82 | SYSCALL(sys_fcntl, 3) /* 55 */ | ||
83 | SYSCALL(sys_ni_syscall, 2) | ||
84 | SYSCALL(sys_setpgid, 2) | ||
85 | SYSCALL(sys_ni_syscall, 0) | ||
86 | SYSCALL(sys_ni_syscall, 0) | ||
87 | SYSCALL(sys_umask, 1) /* 60 */ | ||
88 | SYSCALL(sys_chroot, 1) | ||
89 | SYSCALL(sys_ustat, 2) | ||
90 | SYSCALL(sys_dup2, 2) | ||
91 | SYSCALL(sys_getppid, 0) | ||
92 | SYSCALL(sys_ni_syscall, 0) /* 65 */ | ||
93 | SYSCALL(sys_setsid, 0) | ||
94 | SYSCALL(sys_sigaction, 3) | ||
95 | SYSCALL(sys_ni_syscall, 0) | ||
96 | SYSCALL(sys_ni_syscall, 1) | ||
97 | SYSCALL(sys_setreuid, 2) /* 70 */ | ||
98 | SYSCALL(sys_setregid, 2) | ||
99 | SYSCALL(sys_sigsuspend, 0) | ||
100 | SYSCALL(sys_ni_syscall, 1) | ||
101 | SYSCALL(sys_sethostname, 2) | ||
102 | SYSCALL(sys_setrlimit, 2) /* 75 */ | ||
103 | SYSCALL(sys_getrlimit, 2) | ||
104 | SYSCALL(sys_getrusage, 2) | ||
105 | SYSCALL(sys_gettimeofday, 2) | ||
106 | SYSCALL(sys_settimeofday, 2) | ||
107 | SYSCALL(sys_getgroups, 2) /* 80 */ | ||
108 | SYSCALL(sys_setgroups, 2) | ||
109 | SYSCALL(sys_ni_syscall, 0) | ||
110 | SYSCALL(sys_symlink, 2) | ||
111 | SYSCALL(sys_newlstat, 2) | ||
112 | SYSCALL(sys_readlink, 3) /* 85 */ | ||
113 | SYSCALL(sys_uselib, 1) | ||
114 | SYSCALL(sys_swapon, 2) | ||
115 | SYSCALL(sys_reboot, 3) | ||
116 | SYSCALL(sys_ni_syscall, 3) | ||
117 | SYSCALL(sys_ni_syscall, 6) /* 90 */ | ||
118 | SYSCALL(sys_munmap, 2) | ||
119 | SYSCALL(sys_truncate, 2) | ||
120 | SYSCALL(sys_ftruncate, 2) | ||
121 | SYSCALL(sys_fchmod, 2) | ||
122 | SYSCALL(sys_fchown, 3) /* 95 */ | ||
123 | SYSCALL(sys_getpriority, 2) | ||
124 | SYSCALL(sys_setpriority, 3) | ||
125 | SYSCALL(sys_ni_syscall, 0) | ||
126 | SYSCALL(sys_statfs, 2) | ||
127 | SYSCALL(sys_fstatfs, 2) /* 100 */ | ||
128 | SYSCALL(sys_ni_syscall, 3) | ||
129 | SYSCALL(sys_ni_syscall, 2) | ||
130 | SYSCALL(sys_syslog, 3) | ||
131 | SYSCALL(sys_setitimer, 3) | ||
132 | SYSCALL(sys_getitimer, 2) /* 105 */ | ||
133 | SYSCALL(sys_newstat, 2) | ||
134 | SYSCALL(sys_newlstat, 2) | ||
135 | SYSCALL(sys_newfstat, 2) | ||
136 | SYSCALL(sys_uname, 1) | ||
137 | SYSCALL(sys_ni_syscall, 0) /* 110 */ | ||
138 | SYSCALL(sys_vhangup, 0) | ||
139 | SYSCALL(sys_ni_syscall, 0) | ||
140 | SYSCALL(sys_ni_syscall, 0) | ||
141 | SYSCALL(sys_wait4, 4) | ||
142 | SYSCALL(sys_swapoff, 1) /* 115 */ | ||
143 | SYSCALL(sys_sysinfo, 1) | ||
144 | SYSCALL(sys_ni_syscall, 0) | ||
145 | SYSCALL(sys_fsync, 1) | ||
146 | SYSCALL(sys_sigreturn, 0) | ||
147 | SYSCALL(sys_clone, 0) /* 120 */ | ||
148 | SYSCALL(sys_setdomainname, 2) | ||
149 | SYSCALL(sys_newuname, 1) | ||
150 | SYSCALL(sys_ni_syscall, 0) | ||
151 | SYSCALL(sys_adjtimex, 1) | ||
152 | SYSCALL(sys_mprotect, 3) /* 125 */ | ||
153 | SYSCALL(sys_ni_syscall, 3) | ||
154 | SYSCALL(sys_ni_syscall, 2) | ||
155 | SYSCALL(sys_init_module, 2) | ||
156 | SYSCALL(sys_delete_module, 1) | ||
157 | SYSCALL(sys_ni_syscall, 1) /* 130 */ | ||
158 | SYSCALL(sys_quotactl, 0) | ||
159 | SYSCALL(sys_getpgid, 1) | ||
160 | SYSCALL(sys_fchdir, 1) | ||
161 | SYSCALL(sys_bdflush, 2) | ||
162 | SYSCALL(sys_sysfs, 3) /* 135 */ | ||
163 | SYSCALL(sys_personality, 1) | ||
164 | SYSCALL(sys_ni_syscall, 0) | ||
165 | SYSCALL(sys_setfsuid, 1) | ||
166 | SYSCALL(sys_setfsgid, 1) | ||
167 | SYSCALL(sys_llseek, 5) /* 140 */ | ||
168 | SYSCALL(sys_getdents, 3) | ||
169 | SYSCALL(sys_select, 5) | ||
170 | SYSCALL(sys_flock, 2) | ||
171 | SYSCALL(sys_msync, 3) | ||
172 | SYSCALL(sys_readv, 3) /* 145 */ | ||
173 | SYSCALL(sys_writev, 3) | ||
174 | SYSCALL(sys_ni_syscall, 3) | ||
175 | SYSCALL(sys_ni_syscall, 3) | ||
176 | SYSCALL(sys_ni_syscall, 4) /* handled in fast syscall handler. */ | ||
177 | SYSCALL(sys_ni_syscall, 0) /* 150 */ | ||
178 | SYSCALL(sys_getsid, 1) | ||
179 | SYSCALL(sys_fdatasync, 1) | ||
180 | SYSCALL(sys_sysctl, 1) | ||
181 | SYSCALL(sys_mlock, 2) | ||
182 | SYSCALL(sys_munlock, 2) /* 155 */ | ||
183 | SYSCALL(sys_mlockall, 1) | ||
184 | SYSCALL(sys_munlockall, 0) | ||
185 | SYSCALL(sys_sched_setparam,2) | ||
186 | SYSCALL(sys_sched_getparam,2) | ||
187 | SYSCALL(sys_sched_setscheduler,3) /* 160 */ | ||
188 | SYSCALL(sys_sched_getscheduler,1) | ||
189 | SYSCALL(sys_sched_yield,0) | ||
190 | SYSCALL(sys_sched_get_priority_max,1) | ||
191 | SYSCALL(sys_sched_get_priority_min,1) | ||
192 | SYSCALL(sys_sched_rr_get_interval,2) /* 165 */ | ||
193 | SYSCALL(sys_nanosleep,2) | ||
194 | SYSCALL(sys_mremap,4) | ||
195 | SYSCALL(sys_accept, 3) | ||
196 | SYSCALL(sys_bind, 3) | ||
197 | SYSCALL(sys_connect, 3) /* 170 */ | ||
198 | SYSCALL(sys_getpeername, 3) | ||
199 | SYSCALL(sys_getsockname, 3) | ||
200 | SYSCALL(sys_getsockopt, 5) | ||
201 | SYSCALL(sys_listen, 2) | ||
202 | SYSCALL(sys_recv, 4) /* 175 */ | ||
203 | SYSCALL(sys_recvfrom, 6) | ||
204 | SYSCALL(sys_recvmsg, 3) | ||
205 | SYSCALL(sys_send, 4) | ||
206 | SYSCALL(sys_sendmsg, 3) | ||
207 | SYSCALL(sys_sendto, 6) /* 180 */ | ||
208 | SYSCALL(sys_setsockopt, 5) | ||
209 | SYSCALL(sys_shutdown, 2) | ||
210 | SYSCALL(sys_socket, 3) | ||
211 | SYSCALL(sys_socketpair, 4) | ||
212 | SYSCALL(sys_setresuid, 3) /* 185 */ | ||
213 | SYSCALL(sys_getresuid, 3) | ||
214 | SYSCALL(sys_ni_syscall, 5) | ||
215 | SYSCALL(sys_poll, 3) | ||
216 | SYSCALL(sys_nfsservctl, 3) | ||
217 | SYSCALL(sys_setresgid, 3) /* 190 */ | ||
218 | SYSCALL(sys_getresgid, 3) | ||
219 | SYSCALL(sys_prctl, 5) | ||
220 | SYSCALL(sys_rt_sigreturn, 0) | ||
221 | SYSCALL(sys_rt_sigaction, 4) | ||
222 | SYSCALL(sys_rt_sigprocmask, 4) /* 195 */ | ||
223 | SYSCALL(sys_rt_sigpending, 2) | ||
224 | SYSCALL(sys_rt_sigtimedwait, 4) | ||
225 | SYSCALL(sys_rt_sigqueueinfo, 3) | ||
226 | SYSCALL(sys_rt_sigsuspend, 0) | ||
227 | SYSCALL(sys_pread64, 5) /* 200 */ | ||
228 | SYSCALL(sys_pwrite64, 5) | ||
229 | SYSCALL(sys_chown, 3) | ||
230 | SYSCALL(sys_getcwd, 2) | ||
231 | SYSCALL(sys_capget, 2) | ||
232 | SYSCALL(sys_capset, 2) /* 205 */ | ||
233 | SYSCALL(sys_sigaltstack, 0) | ||
234 | SYSCALL(sys_sendfile, 4) | ||
235 | SYSCALL(sys_ni_syscall, 0) | ||
236 | SYSCALL(sys_ni_syscall, 0) | ||
237 | SYSCALL(sys_mmap, 6) /* 210 */ | ||
238 | SYSCALL(sys_truncate64, 2) | ||
239 | SYSCALL(sys_ftruncate64, 2) | ||
240 | SYSCALL(sys_stat64, 2) | ||
241 | SYSCALL(sys_lstat64, 2) | ||
242 | SYSCALL(sys_fstat64, 2) /* 215 */ | ||
243 | SYSCALL(sys_pivot_root, 2) | ||
244 | SYSCALL(sys_mincore, 3) | ||
245 | SYSCALL(sys_madvise, 3) | ||
246 | SYSCALL(sys_getdents64, 3) | ||
247 | SYSCALL(sys_ni_syscall, 0) /* 220 */ | ||
diff --git a/include/asm-xtensa/fcntl.h b/include/asm-xtensa/fcntl.h index ec066ae96caf..0609fc691b72 100644 --- a/include/asm-xtensa/fcntl.h +++ b/include/asm-xtensa/fcntl.h | |||
@@ -14,48 +14,86 @@ | |||
14 | 14 | ||
15 | /* open/fcntl - O_SYNC is only implemented on blocks devices and on files | 15 | /* open/fcntl - O_SYNC is only implemented on blocks devices and on files |
16 | located on an ext2 file system */ | 16 | located on an ext2 file system */ |
17 | #define O_APPEND 0x0008 | 17 | #define O_ACCMODE 0003 |
18 | #define O_SYNC 0x0010 | 18 | #define O_RDONLY 00 |
19 | #define O_NONBLOCK 0x0080 | 19 | #define O_WRONLY 01 |
20 | #define O_CREAT 0x0100 /* not fcntl */ | 20 | #define O_RDWR 02 |
21 | #define O_EXCL 0x0400 /* not fcntl */ | 21 | #define O_CREAT 0100 /* not fcntl */ |
22 | #define O_NOCTTY 0x0800 /* not fcntl */ | 22 | #define O_EXCL 0200 /* not fcntl */ |
23 | #define FASYNC 0x1000 /* fcntl, for BSD compatibility */ | 23 | #define O_NOCTTY 0400 /* not fcntl */ |
24 | #define O_LARGEFILE 0x2000 /* allow large file opens - currently ignored */ | 24 | #define O_TRUNC 01000 /* not fcntl */ |
25 | #define O_DIRECT 0x8000 /* direct disk access hint - currently ignored*/ | 25 | #define O_APPEND 02000 |
26 | #define O_NOATIME 0x100000 | 26 | #define O_NONBLOCK 04000 |
27 | 27 | #define O_NDELAY O_NONBLOCK | |
28 | #define F_GETLK 14 | 28 | #define O_SYNC 010000 |
29 | #define F_GETLK64 15 | 29 | #define FASYNC 020000 /* fcntl, for BSD compatibility */ |
30 | #define O_DIRECT 040000 /* direct disk access hint */ | ||
31 | #define O_LARGEFILE 0100000 | ||
32 | #define O_DIRECTORY 0200000 /* must be a directory */ | ||
33 | #define O_NOFOLLOW 0400000 /* don't follow links */ | ||
34 | #define O_NOATIME 01000000 | ||
35 | |||
36 | #define F_DUPFD 0 /* dup */ | ||
37 | #define F_GETFD 1 /* get close_on_exec */ | ||
38 | #define F_SETFD 2 /* set/clear close_on_exec */ | ||
39 | #define F_GETFL 3 /* get file->f_flags */ | ||
40 | #define F_SETFL 4 /* set file->f_flags */ | ||
41 | #define F_GETLK 5 | ||
30 | #define F_SETLK 6 | 42 | #define F_SETLK 6 |
31 | #define F_SETLKW 7 | 43 | #define F_SETLKW 7 |
32 | #define F_SETLK64 16 | ||
33 | #define F_SETLKW64 17 | ||
34 | 44 | ||
35 | #define F_SETOWN 24 /* for sockets. */ | 45 | #define F_SETOWN 8 /* for sockets. */ |
36 | #define F_GETOWN 23 /* for sockets. */ | 46 | #define F_GETOWN 9 /* for sockets. */ |
47 | #define F_SETSIG 10 /* for sockets. */ | ||
48 | #define F_GETSIG 11 /* for sockets. */ | ||
49 | |||
50 | #define F_GETLK64 12 /* using 'struct flock64' */ | ||
51 | #define F_SETLK64 13 | ||
52 | #define F_SETLKW64 14 | ||
53 | |||
54 | /* for F_[GET|SET]FL */ | ||
55 | #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ | ||
56 | |||
57 | /* for posix fcntl() and lockf() */ | ||
58 | #define F_RDLCK 0 | ||
59 | #define F_WRLCK 1 | ||
60 | #define F_UNLCK 2 | ||
61 | |||
62 | /* for old implementation of bsd flock () */ | ||
63 | #define F_EXLCK 4 /* or 3 */ | ||
64 | #define F_SHLCK 8 /* or 4 */ | ||
37 | 65 | ||
38 | typedef struct flock { | 66 | /* for leases */ |
67 | #define F_INPROGRESS 16 | ||
68 | |||
69 | /* operations for bsd flock(), also used by the kernel implementation */ | ||
70 | #define LOCK_SH 1 /* shared lock */ | ||
71 | #define LOCK_EX 2 /* exclusive lock */ | ||
72 | #define LOCK_NB 4 /* or'd with one of the above to prevent | ||
73 | blocking */ | ||
74 | #define LOCK_UN 8 /* remove lock */ | ||
75 | |||
76 | #define LOCK_MAND 32 /* This is a mandatory flock */ | ||
77 | #define LOCK_READ 64 /* ... Which allows concurrent read operations */ | ||
78 | #define LOCK_WRITE 128 /* ... Which allows concurrent write operations */ | ||
79 | #define LOCK_RW 192 /* ... Which allows concurrent read & write ops */ | ||
80 | |||
81 | struct flock { | ||
39 | short l_type; | 82 | short l_type; |
40 | short l_whence; | 83 | short l_whence; |
41 | __kernel_off_t l_start; | 84 | off_t l_start; |
42 | __kernel_off_t l_len; | 85 | off_t l_len; |
43 | long l_sysid; | 86 | pid_t l_pid; |
44 | __kernel_pid_t l_pid; | 87 | }; |
45 | long pad[4]; | ||
46 | } flock_t; | ||
47 | 88 | ||
48 | struct flock64 { | 89 | struct flock64 { |
49 | short l_type; | 90 | short l_type; |
50 | short l_whence; | 91 | short l_whence; |
51 | __kernel_off_t l_start; | 92 | loff_t l_start; |
52 | __kernel_off_t l_len; | 93 | loff_t l_len; |
53 | pid_t l_pid; | 94 | pid_t l_pid; |
54 | }; | 95 | }; |
55 | 96 | ||
56 | #define HAVE_ARCH_STRUCT_FLOCK | 97 | #define F_LINUX_SPECIFIC_BASE 1024 |
57 | #define HAVE_ARCH_STRUCT_FLOCK64 | ||
58 | |||
59 | #include <asm-generic/fcntl.h> | ||
60 | 98 | ||
61 | #endif /* _XTENSA_FCNTL_H */ | 99 | #endif /* _XTENSA_FCNTL_H */ |
diff --git a/include/asm-xtensa/posix_types.h b/include/asm-xtensa/posix_types.h index 2c816b0e7762..3470b44c12ce 100644 --- a/include/asm-xtensa/posix_types.h +++ b/include/asm-xtensa/posix_types.h | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | typedef unsigned long __kernel_ino_t; | 22 | typedef unsigned long __kernel_ino_t; |
23 | typedef unsigned int __kernel_mode_t; | 23 | typedef unsigned int __kernel_mode_t; |
24 | typedef unsigned short __kernel_nlink_t; | 24 | typedef unsigned long __kernel_nlink_t; |
25 | typedef long __kernel_off_t; | 25 | typedef long __kernel_off_t; |
26 | typedef int __kernel_pid_t; | 26 | typedef int __kernel_pid_t; |
27 | typedef unsigned short __kernel_ipc_pid_t; | 27 | typedef unsigned short __kernel_ipc_pid_t; |
diff --git a/include/asm-xtensa/shmbuf.h b/include/asm-xtensa/shmbuf.h index a30b81a4b933..ad4b0121782c 100644 --- a/include/asm-xtensa/shmbuf.h +++ b/include/asm-xtensa/shmbuf.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #ifndef _XTENSA_SHMBUF_H | 19 | #ifndef _XTENSA_SHMBUF_H |
20 | #define _XTENSA_SHMBUF_H | 20 | #define _XTENSA_SHMBUF_H |
21 | 21 | ||
22 | #if defined (__XTENSA_EL__) | ||
22 | struct shmid64_ds { | 23 | struct shmid64_ds { |
23 | struct ipc64_perm shm_perm; /* operation perms */ | 24 | struct ipc64_perm shm_perm; /* operation perms */ |
24 | size_t shm_segsz; /* size of segment (bytes) */ | 25 | size_t shm_segsz; /* size of segment (bytes) */ |
@@ -34,6 +35,26 @@ struct shmid64_ds { | |||
34 | unsigned long __unused4; | 35 | unsigned long __unused4; |
35 | unsigned long __unused5; | 36 | unsigned long __unused5; |
36 | }; | 37 | }; |
38 | #elif defined (__XTENSA_EB__) | ||
39 | struct shmid64_ds { | ||
40 | struct ipc64_perm shm_perm; /* operation perms */ | ||
41 | size_t shm_segsz; /* size of segment (bytes) */ | ||
42 | __kernel_time_t shm_atime; /* last attach time */ | ||
43 | unsigned long __unused1; | ||
44 | __kernel_time_t shm_dtime; /* last detach time */ | ||
45 | unsigned long __unused2; | ||
46 | __kernel_time_t shm_ctime; /* last change time */ | ||
47 | unsigned long __unused3; | ||
48 | __kernel_pid_t shm_cpid; /* pid of creator */ | ||
49 | __kernel_pid_t shm_lpid; /* pid of last operator */ | ||
50 | unsigned long shm_nattch; /* no. of current attaches */ | ||
51 | unsigned long __unused4; | ||
52 | unsigned long __unused5; | ||
53 | }; | ||
54 | #else | ||
55 | # error endian order not defined | ||
56 | #endif | ||
57 | |||
37 | 58 | ||
38 | struct shminfo64 { | 59 | struct shminfo64 { |
39 | unsigned long shmmax; | 60 | unsigned long shmmax; |
diff --git a/include/asm-xtensa/stat.h b/include/asm-xtensa/stat.h index 2f4662ff6c3a..149f4bce092f 100644 --- a/include/asm-xtensa/stat.h +++ b/include/asm-xtensa/stat.h | |||
@@ -13,93 +13,57 @@ | |||
13 | 13 | ||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | 15 | ||
16 | struct __old_kernel_stat { | ||
17 | unsigned short st_dev; | ||
18 | unsigned short st_ino; | ||
19 | unsigned short st_mode; | ||
20 | unsigned short st_nlink; | ||
21 | unsigned short st_uid; | ||
22 | unsigned short st_gid; | ||
23 | unsigned short st_rdev; | ||
24 | unsigned long st_size; | ||
25 | unsigned long st_atime; | ||
26 | unsigned long st_mtime; | ||
27 | unsigned long st_ctime; | ||
28 | }; | ||
29 | |||
30 | #define STAT_HAVE_NSEC 1 | 16 | #define STAT_HAVE_NSEC 1 |
31 | 17 | ||
32 | struct stat { | 18 | struct stat { |
33 | unsigned short st_dev; | 19 | unsigned long st_dev; |
34 | unsigned short __pad1; | 20 | ino_t st_ino; |
35 | unsigned long st_ino; | 21 | mode_t st_mode; |
36 | unsigned short st_mode; | 22 | nlink_t st_nlink; |
37 | unsigned short st_nlink; | 23 | uid_t st_uid; |
38 | unsigned short st_uid; | 24 | gid_t st_gid; |
39 | unsigned short st_gid; | 25 | unsigned int st_rdev; |
40 | unsigned short st_rdev; | 26 | off_t st_size; |
41 | unsigned short __pad2; | 27 | unsigned long st_blksize; |
42 | unsigned long st_size; | 28 | unsigned long st_blocks; |
43 | unsigned long st_blksize; | 29 | unsigned long st_atime; |
44 | unsigned long st_blocks; | 30 | unsigned long st_atime_nsec; |
45 | unsigned long st_atime; | 31 | unsigned long st_mtime; |
46 | unsigned long st_atime_nsec; | 32 | unsigned long st_mtime_nsec; |
47 | unsigned long st_mtime; | 33 | unsigned long st_ctime; |
48 | unsigned long st_mtime_nsec; | 34 | unsigned long st_ctime_nsec; |
49 | unsigned long st_ctime; | 35 | unsigned long __unused4; |
50 | unsigned long st_ctime_nsec; | 36 | unsigned long __unused5; |
51 | unsigned long __unused4; | ||
52 | unsigned long __unused5; | ||
53 | }; | 37 | }; |
54 | 38 | ||
55 | /* This matches struct stat64 in glibc-2.2.3. */ | 39 | /* This matches struct stat64 in glibc-2.3 */ |
56 | 40 | ||
57 | struct stat64 { | 41 | struct stat64 { |
58 | #ifdef __XTENSA_EL__ | 42 | unsigned long long st_dev; /* Device */ |
59 | unsigned short st_dev; /* Device */ | 43 | unsigned long long st_ino; /* File serial number */ |
60 | unsigned char __pad0[10]; | ||
61 | #else | ||
62 | unsigned char __pad0[6]; | ||
63 | unsigned short st_dev; | ||
64 | unsigned char __pad1[2]; | ||
65 | #endif | ||
66 | |||
67 | #define STAT64_HAS_BROKEN_ST_INO 1 | ||
68 | unsigned long __st_ino; /* 32bit file serial number. */ | ||
69 | |||
70 | unsigned int st_mode; /* File mode. */ | 44 | unsigned int st_mode; /* File mode. */ |
71 | unsigned int st_nlink; /* Link count. */ | 45 | unsigned int st_nlink; /* Link count. */ |
72 | unsigned int st_uid; /* User ID of the file's owner. */ | 46 | unsigned int st_uid; /* User ID of the file's owner. */ |
73 | unsigned int st_gid; /* Group ID of the file's group. */ | 47 | unsigned int st_gid; /* Group ID of the file's group. */ |
74 | 48 | unsigned long long st_rdev; /* Device number, if device. */ | |
75 | #ifdef __XTENSA_EL__ | 49 | long long st_size; /* Size of file, in bytes. */ |
76 | unsigned short st_rdev; /* Device number, if device. */ | 50 | long st_blksize; /* Optimal block size for I/O. */ |
77 | unsigned char __pad3[10]; | 51 | unsigned long __unused2; |
78 | #else | 52 | #ifdef __XTENSA_EB__ |
79 | unsigned char __pad2[6]; | 53 | unsigned long __unused3; |
80 | unsigned short st_rdev; | 54 | long st_blocks; /* Number 512-byte blocks allocated. */ |
81 | unsigned char __pad3[2]; | ||
82 | #endif | ||
83 | |||
84 | long long int st_size; /* Size of file, in bytes. */ | ||
85 | long int st_blksize; /* Optimal block size for I/O. */ | ||
86 | |||
87 | #ifdef __XTENSA_EL__ | ||
88 | unsigned long st_blocks; /* Number 512-byte blocks allocated. */ | ||
89 | unsigned long __pad4; | ||
90 | #else | 55 | #else |
91 | unsigned long __pad4; | 56 | long st_blocks; /* Number 512-byte blocks allocated. */ |
92 | unsigned long st_blocks; | 57 | unsigned long __unused3; |
93 | #endif | 58 | #endif |
94 | 59 | long st_atime; /* Time of last access. */ | |
95 | unsigned long __pad5; | 60 | unsigned long st_atime_nsec; |
96 | long int st_atime; /* Time of last access. */ | 61 | long st_mtime; /* Time of last modification. */ |
97 | unsigned long st_atime_nsec; | 62 | unsigned long st_mtime_nsec; |
98 | long int st_mtime; /* Time of last modification. */ | 63 | long st_ctime; /* Time of last status change. */ |
99 | unsigned long st_mtime_nsec; | 64 | unsigned long st_ctime_nsec; |
100 | long int st_ctime; /* Time of last status change. */ | 65 | unsigned long __unused4; |
101 | unsigned long st_ctime_nsec; | 66 | unsigned long __unused5; |
102 | unsigned long long int st_ino; /* File serial number. */ | ||
103 | }; | 67 | }; |
104 | 68 | ||
105 | #endif /* _XTENSA_STAT_H */ | 69 | #endif /* _XTENSA_STAT_H */ |
diff --git a/include/asm-xtensa/syscall.h b/include/asm-xtensa/syscall.h new file mode 100644 index 000000000000..6cb0d42f11c8 --- /dev/null +++ b/include/asm-xtensa/syscall.h | |||
@@ -0,0 +1,20 @@ | |||
1 | struct pt_regs; | ||
2 | struct sigaction; | ||
3 | asmlinkage long xtensa_execve(char*, char**, char**, struct pt_regs*); | ||
4 | asmlinkage long xtensa_clone(unsigned long, unsigned long, struct pt_regs*); | ||
5 | asmlinkage long xtensa_pipe(int __user *); | ||
6 | asmlinkage long xtensa_mmap2(unsigned long, unsigned long, unsigned long, | ||
7 | unsigned long, unsigned long, unsigned long); | ||
8 | asmlinkage long xtensa_ptrace(long, long, long, long); | ||
9 | asmlinkage long xtensa_sigreturn(struct pt_regs*); | ||
10 | asmlinkage long xtensa_rt_sigreturn(struct pt_regs*); | ||
11 | asmlinkage long xtensa_sigsuspend(struct pt_regs*); | ||
12 | asmlinkage long xtensa_rt_sigsuspend(struct pt_regs*); | ||
13 | asmlinkage long xtensa_sigaction(int, const struct old_sigaction*, | ||
14 | struct old_sigaction*); | ||
15 | asmlinkage long xtensa_sigaltstack(struct pt_regs *regs); | ||
16 | asmlinkage long sys_rt_sigaction(int, | ||
17 | const struct sigaction __user *, | ||
18 | struct sigaction __user *, | ||
19 | size_t); | ||
20 | asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg); | ||
diff --git a/include/asm-xtensa/unistd.h b/include/asm-xtensa/unistd.h index 15b0932523d5..8a7fb6964ce1 100644 --- a/include/asm-xtensa/unistd.h +++ b/include/asm-xtensa/unistd.h | |||
@@ -11,212 +11,591 @@ | |||
11 | #ifndef _XTENSA_UNISTD_H | 11 | #ifndef _XTENSA_UNISTD_H |
12 | #define _XTENSA_UNISTD_H | 12 | #define _XTENSA_UNISTD_H |
13 | 13 | ||
14 | #define __NR_spill 0 | 14 | #ifndef __SYSCALL |
15 | #define __NR_exit 1 | 15 | # define __SYSCALL(nr,func,nargs) |
16 | #define __NR_read 3 | 16 | #endif |
17 | #define __NR_write 4 | 17 | |
18 | #define __NR_open 5 | 18 | #define __NR_spill 0 |
19 | #define __NR_close 6 | 19 | __SYSCALL( 0, sys_ni_syscall, 0) |
20 | #define __NR_creat 8 | 20 | #define __NR_xtensa 1 |
21 | #define __NR_link 9 | 21 | __SYSCALL( 1, sys_ni_syscall, 0) |
22 | #define __NR_unlink 10 | 22 | #define __NR_available4 2 |
23 | #define __NR_execve 11 | 23 | __SYSCALL( 2, sys_ni_syscall, 0) |
24 | #define __NR_chdir 12 | 24 | #define __NR_available5 3 |
25 | #define __NR_mknod 14 | 25 | __SYSCALL( 3, sys_ni_syscall, 0) |
26 | #define __NR_chmod 15 | 26 | #define __NR_available6 4 |
27 | #define __NR_lchown 16 | 27 | __SYSCALL( 4, sys_ni_syscall, 0) |
28 | #define __NR_break 17 | 28 | #define __NR_available7 5 |
29 | #define __NR_lseek 19 | 29 | __SYSCALL( 5, sys_ni_syscall, 0) |
30 | #define __NR_getpid 20 | 30 | #define __NR_available8 6 |
31 | #define __NR_mount 21 | 31 | __SYSCALL( 6, sys_ni_syscall, 0) |
32 | #define __NR_setuid 23 | 32 | #define __NR_available9 7 |
33 | #define __NR_getuid 24 | 33 | __SYSCALL( 7, sys_ni_syscall, 0) |
34 | #define __NR_ptrace 26 | 34 | |
35 | #define __NR_utime 30 | 35 | /* File Operations */ |
36 | #define __NR_stty 31 | 36 | |
37 | #define __NR_gtty 32 | 37 | #define __NR_open 8 |
38 | #define __NR_access 33 | 38 | __SYSCALL( 8, sys_open, 3) |
39 | #define __NR_ftime 35 | 39 | #define __NR_close 9 |
40 | #define __NR_sync 36 | 40 | __SYSCALL( 9, sys_close, 1) |
41 | #define __NR_kill 37 | 41 | #define __NR_dup 10 |
42 | #define __NR_rename 38 | 42 | __SYSCALL( 10, sys_dup, 1) |
43 | #define __NR_mkdir 39 | 43 | #define __NR_dup2 11 |
44 | #define __NR_rmdir 40 | 44 | __SYSCALL( 11, sys_dup2, 2) |
45 | #define __NR_dup 41 | 45 | #define __NR_read 12 |
46 | #define __NR_pipe 42 | 46 | __SYSCALL( 12, sys_read, 3) |
47 | #define __NR_times 43 | 47 | #define __NR_write 13 |
48 | #define __NR_prof 44 | 48 | __SYSCALL( 13, sys_write, 3) |
49 | #define __NR_brk 45 | 49 | #define __NR_select 14 |
50 | #define __NR_setgid 46 | 50 | __SYSCALL( 14, sys_select, 5) |
51 | #define __NR_getgid 47 | 51 | #define __NR_lseek 15 |
52 | #define __NR_signal 48 | 52 | __SYSCALL( 15, sys_lseek, 3) |
53 | #define __NR_geteuid 49 | 53 | #define __NR_poll 16 |
54 | #define __NR_getegid 50 | 54 | __SYSCALL( 16, sys_poll, 3) |
55 | #define __NR_acct 51 | 55 | #define __NR__llseek 17 |
56 | #define __NR_lock 53 | 56 | __SYSCALL( 17, sys_llseek, 5) |
57 | #define __NR_ioctl 54 | 57 | #define __NR_epoll_wait 18 |
58 | #define __NR_fcntl 55 | 58 | __SYSCALL( 18, sys_epoll_wait, 4) |
59 | #define __NR_setpgid 57 | 59 | #define __NR_epoll_ctl 19 |
60 | #define __NR_ulimit 58 | 60 | __SYSCALL( 19, sys_epoll_ctl, 4) |
61 | #define __NR_umask 60 | 61 | #define __NR_epoll_create 20 |
62 | #define __NR_chroot 61 | 62 | __SYSCALL( 20, sys_epoll_create, 1) |
63 | #define __NR_ustat 62 | 63 | #define __NR_creat 21 |
64 | #define __NR_dup2 63 | 64 | __SYSCALL( 21, sys_creat, 2) |
65 | #define __NR_getppid 64 | 65 | #define __NR_truncate 22 |
66 | #define __NR_setsid 66 | 66 | __SYSCALL( 22, sys_truncate, 2) |
67 | #define __NR_sigaction 67 | 67 | #define __NR_ftruncate 23 |
68 | #define __NR_setreuid 70 | 68 | __SYSCALL( 23, sys_ftruncate, 2) |
69 | #define __NR_setregid 71 | 69 | #define __NR_readv 24 |
70 | #define __NR_sigsuspend 72 | 70 | __SYSCALL( 24, sys_readv, 3) |
71 | #define __NR_sigpending 73 | 71 | #define __NR_writev 25 |
72 | #define __NR_sethostname 74 | 72 | __SYSCALL( 25, sys_writev, 3) |
73 | #define __NR_setrlimit 75 | 73 | #define __NR_fsync 26 |
74 | #define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ | 74 | __SYSCALL( 26, sys_fsync, 1) |
75 | #define __NR_getrusage 77 | 75 | #define __NR_fdatasync 27 |
76 | #define __NR_gettimeofday 78 | 76 | __SYSCALL( 27, sys_fdatasync, 1) |
77 | #define __NR_settimeofday 79 | 77 | #define __NR_truncate64 28 |
78 | #define __NR_getgroups 80 | 78 | __SYSCALL( 28, sys_truncate64, 2) |
79 | #define __NR_setgroups 81 | 79 | #define __NR_ftruncate64 29 |
80 | #define __NR_select 82 | 80 | __SYSCALL( 29, sys_ftruncate64, 2) |
81 | #define __NR_symlink 83 | 81 | #define __NR_pread64 30 |
82 | #define __NR_readlink 85 | 82 | __SYSCALL( 30, sys_pread64, 6) |
83 | #define __NR_uselib 86 | 83 | #define __NR_pwrite64 31 |
84 | #define __NR_swapon 87 | 84 | __SYSCALL( 31, sys_pwrite64, 6) |
85 | #define __NR_reboot 88 | 85 | |
86 | #define __NR_munmap 91 | 86 | #define __NR_link 32 |
87 | #define __NR_truncate 92 | 87 | __SYSCALL( 32, sys_link, 2) |
88 | #define __NR_ftruncate 93 | 88 | #define __NR_rename 33 |
89 | #define __NR_fchmod 94 | 89 | __SYSCALL( 33, sys_rename, 2) |
90 | #define __NR_fchown 95 | 90 | #define __NR_symlink 34 |
91 | #define __NR_getpriority 96 | 91 | __SYSCALL( 34, sys_symlink, 2) |
92 | #define __NR_setpriority 97 | 92 | #define __NR_readlink 35 |
93 | #define __NR_profil 98 | 93 | __SYSCALL( 35, sys_readlink, 3) |
94 | #define __NR_statfs 99 | 94 | #define __NR_mknod 36 |
95 | #define __NR_fstatfs 100 | 95 | __SYSCALL( 36, sys_mknod, 3) |
96 | #define __NR_ioperm 101 | 96 | #define __NR_pipe 37 |
97 | #define __NR_syslog 103 | 97 | __SYSCALL( 37, xtensa_pipe, 1) |
98 | #define __NR_setitimer 104 | 98 | #define __NR_unlink 38 |
99 | #define __NR_getitimer 105 | 99 | __SYSCALL( 38, sys_unlink, 1) |
100 | #define __NR_stat 106 | 100 | #define __NR_rmdir 39 |
101 | #define __NR_lstat 107 | 101 | __SYSCALL( 39, sys_rmdir, 1) |
102 | #define __NR_fstat 108 | 102 | |
103 | #define __NR_iopl 110 | 103 | #define __NR_mkdir 40 |
104 | #define __NR_vhangup 111 | 104 | __SYSCALL( 40, sys_mkdir, 2) |
105 | #define __NR_idle 112 | 105 | #define __NR_chdir 41 |
106 | #define __NR_wait4 114 | 106 | __SYSCALL( 41, sys_chdir, 1) |
107 | #define __NR_swapoff 115 | 107 | #define __NR_fchdir 42 |
108 | #define __NR_sysinfo 116 | 108 | __SYSCALL( 42, sys_fchdir, 1) |
109 | #define __NR_fsync 118 | 109 | #define __NR_getcwd 43 |
110 | #define __NR_sigreturn 119 | 110 | __SYSCALL( 43, sys_getcwd, 2) |
111 | #define __NR_clone 120 | 111 | |
112 | #define __NR_setdomainname 121 | 112 | #define __NR_chmod 44 |
113 | #define __NR_uname 122 | 113 | __SYSCALL( 44, sys_chmod, 2) |
114 | #define __NR_modify_ldt 123 | 114 | #define __NR_chown 45 |
115 | #define __NR_adjtimex 124 | 115 | __SYSCALL( 45, sys_chown, 3) |
116 | #define __NR_mprotect 125 | 116 | #define __NR_stat 46 |
117 | #define __NR_create_module 127 | 117 | __SYSCALL( 46, sys_newstat, 2) |
118 | #define __NR_init_module 128 | 118 | #define __NR_stat64 47 |
119 | #define __NR_delete_module 129 | 119 | __SYSCALL( 47, sys_stat64, 2) |
120 | #define __NR_quotactl 131 | 120 | |
121 | #define __NR_getpgid 132 | 121 | #define __NR_lchown 48 |
122 | #define __NR_fchdir 133 | 122 | __SYSCALL( 48, sys_lchown, 3) |
123 | #define __NR_bdflush 134 | 123 | #define __NR_lstat 49 |
124 | #define __NR_sysfs 135 | 124 | __SYSCALL( 49, sys_newlstat, 2) |
125 | #define __NR_personality 136 | 125 | #define __NR_lstat64 50 |
126 | #define __NR_setfsuid 138 | 126 | __SYSCALL( 50, sys_lstat64, 2) |
127 | #define __NR_setfsgid 139 | 127 | #define __NR_available51 51 |
128 | #define __NR__llseek 140 | 128 | __SYSCALL( 51, sys_ni_syscall, 0) |
129 | #define __NR_getdents 141 | 129 | |
130 | #define __NR__newselect 142 | 130 | #define __NR_fchmod 52 |
131 | #define __NR_flock 143 | 131 | __SYSCALL( 52, sys_fchmod, 2) |
132 | #define __NR_msync 144 | 132 | #define __NR_fchown 53 |
133 | #define __NR_readv 145 | 133 | __SYSCALL( 53, sys_fchown, 3) |
134 | #define __NR_writev 146 | 134 | #define __NR_fstat 54 |
135 | #define __NR_cacheflush 147 | 135 | __SYSCALL( 54, sys_newfstat, 2) |
136 | #define __NR_cachectl 148 | 136 | #define __NR_fstat64 55 |
137 | #define __NR_sysxtensa 149 | 137 | __SYSCALL( 55, sys_fstat64, 2) |
138 | #define __NR_sysdummy 150 | 138 | |
139 | #define __NR_getsid 151 | 139 | #define __NR_flock 56 |
140 | #define __NR_fdatasync 152 | 140 | __SYSCALL( 56, sys_flock, 2) |
141 | #define __NR__sysctl 153 | 141 | #define __NR_access 57 |
142 | #define __NR_mlock 154 | 142 | __SYSCALL( 57, sys_access, 2) |
143 | #define __NR_munlock 155 | 143 | #define __NR_umask 58 |
144 | #define __NR_mlockall 156 | 144 | __SYSCALL( 58, sys_umask, 1) |
145 | #define __NR_munlockall 157 | 145 | #define __NR_getdents 59 |
146 | #define __NR_sched_setparam 158 | 146 | __SYSCALL( 59, sys_getdents, 3) |
147 | #define __NR_sched_getparam 159 | 147 | #define __NR_getdents64 60 |
148 | #define __NR_sched_setscheduler 160 | 148 | __SYSCALL( 60, sys_getdents64, 3) |
149 | #define __NR_sched_getscheduler 161 | 149 | #define __NR_fcntl64 61 |
150 | #define __NR_sched_yield 162 | 150 | __SYSCALL( 61, sys_fcntl64, 3) |
151 | #define __NR_sched_get_priority_max 163 | 151 | #define __NR_available62 62 |
152 | #define __NR_sched_get_priority_min 164 | 152 | __SYSCALL( 62, sys_ni_syscall, 0) |
153 | #define __NR_sched_rr_get_interval 165 | 153 | #define __NR_fadvise64_64 63 |
154 | #define __NR_nanosleep 166 | 154 | __SYSCALL( 63, sys_fadvise64_64, 6) |
155 | #define __NR_mremap 167 | 155 | #define __NR_utime 64 /* glibc 2.3.3 ?? */ |
156 | #define __NR_accept 168 | 156 | __SYSCALL( 64, sys_utime, 2) |
157 | #define __NR_bind 169 | 157 | #define __NR_utimes 65 |
158 | #define __NR_connect 170 | 158 | __SYSCALL( 65, sys_utimes, 2) |
159 | #define __NR_getpeername 171 | 159 | #define __NR_ioctl 66 |
160 | #define __NR_getsockname 172 | 160 | __SYSCALL( 66, sys_ioctl, 3) |
161 | #define __NR_getsockopt 173 | 161 | #define __NR_fcntl 67 |
162 | #define __NR_listen 174 | 162 | __SYSCALL( 67, sys_fcntl, 3) |
163 | #define __NR_recv 175 | 163 | |
164 | #define __NR_recvfrom 176 | 164 | #define __NR_setxattr 68 |
165 | #define __NR_recvmsg 177 | 165 | __SYSCALL( 68, sys_setxattr, 5) |
166 | #define __NR_send 178 | 166 | #define __NR_getxattr 69 |
167 | #define __NR_sendmsg 179 | 167 | __SYSCALL( 69, sys_getxattr, 4) |
168 | #define __NR_sendto 180 | 168 | #define __NR_listxattr 70 |
169 | #define __NR_setsockopt 181 | 169 | __SYSCALL( 70, sys_listxattr, 3) |
170 | #define __NR_shutdown 182 | 170 | #define __NR_removexattr 71 |
171 | #define __NR_socket 183 | 171 | __SYSCALL( 71, sys_removexattr, 2) |
172 | #define __NR_socketpair 184 | 172 | #define __NR_lsetxattr 72 |
173 | #define __NR_setresuid 185 | 173 | __SYSCALL( 72, sys_lsetxattr, 5) |
174 | #define __NR_getresuid 186 | 174 | #define __NR_lgetxattr 73 |
175 | #define __NR_query_module 187 | 175 | __SYSCALL( 73, sys_lgetxattr, 4) |
176 | #define __NR_poll 188 | 176 | #define __NR_llistxattr 74 |
177 | #define __NR_nfsservctl 189 | 177 | __SYSCALL( 74, sys_llistxattr, 3) |
178 | #define __NR_setresgid 190 | 178 | #define __NR_lremovexattr 75 |
179 | #define __NR_getresgid 191 | 179 | __SYSCALL( 75, sys_lremovexattr, 2) |
180 | #define __NR_prctl 192 | 180 | #define __NR_fsetxattr 76 |
181 | #define __NR_rt_sigreturn 193 | 181 | __SYSCALL( 76, sys_fsetxattr, 5) |
182 | #define __NR_rt_sigaction 194 | 182 | #define __NR_fgetxattr 77 |
183 | #define __NR_rt_sigprocmask 195 | 183 | __SYSCALL( 77, sys_fgetxattr, 4) |
184 | #define __NR_rt_sigpending 196 | 184 | #define __NR_flistxattr 78 |
185 | #define __NR_rt_sigtimedwait 197 | 185 | __SYSCALL( 78, sys_flistxattr, 3) |
186 | #define __NR_rt_sigqueueinfo 198 | 186 | #define __NR_fremovexattr 79 |
187 | #define __NR_rt_sigsuspend 199 | 187 | __SYSCALL( 79, sys_fremovexattr, 2) |
188 | #define __NR_pread 200 | 188 | |
189 | #define __NR_pwrite 201 | 189 | /* File Map / Shared Memory Operations */ |
190 | #define __NR_chown 202 | 190 | |
191 | #define __NR_getcwd 203 | 191 | #define __NR_mmap2 80 |
192 | #define __NR_capget 204 | 192 | __SYSCALL( 80, xtensa_mmap2, 6) |
193 | #define __NR_capset 205 | 193 | #define __NR_munmap 81 |
194 | #define __NR_sigaltstack 206 | 194 | __SYSCALL( 81, sys_munmap, 2) |
195 | #define __NR_sendfile 207 | 195 | #define __NR_mprotect 82 |
196 | #define __NR_mmap2 210 | 196 | __SYSCALL( 82, sys_mprotect, 3) |
197 | #define __NR_truncate64 211 | 197 | #define __NR_brk 83 |
198 | #define __NR_ftruncate64 212 | 198 | __SYSCALL( 83, sys_brk, 1) |
199 | #define __NR_stat64 213 | 199 | #define __NR_mlock 84 |
200 | #define __NR_lstat64 214 | 200 | __SYSCALL( 84, sys_mlock, 2) |
201 | #define __NR_fstat64 215 | 201 | #define __NR_munlock 85 |
202 | #define __NR_pivot_root 216 | 202 | __SYSCALL( 85, sys_munlock, 2) |
203 | #define __NR_mincore 217 | 203 | #define __NR_mlockall 86 |
204 | #define __NR_madvise 218 | 204 | __SYSCALL( 86, sys_mlockall, 1) |
205 | #define __NR_getdents64 219 | 205 | #define __NR_munlockall 87 |
206 | 206 | __SYSCALL( 87, sys_munlockall, 0) | |
207 | /* Keep this last; should always equal the last valid call number. */ | 207 | #define __NR_mremap 88 |
208 | #define __NR_Linux_syscalls 220 | 208 | __SYSCALL( 88, sys_mremap, 4) |
209 | 209 | #define __NR_msync 89 | |
210 | /* user-visible error numbers are in the range -1 - -125: see | 210 | __SYSCALL( 89, sys_msync, 3) |
211 | * <asm-xtensa/errno.h> */ | 211 | #define __NR_mincore 90 |
212 | 212 | __SYSCALL( 90, sys_mincore, 3) | |
213 | #define SYSXTENSA_RESERVED 0 /* don't use this */ | 213 | #define __NR_madvise 91 |
214 | #define SYSXTENSA_ATOMIC_SET 1 /* set variable */ | 214 | __SYSCALL( 91, sys_madvise, 3) |
215 | #define SYSXTENSA_ATOMIC_EXG_ADD 2 /* exchange memory and add */ | 215 | #define __NR_shmget 92 |
216 | #define SYSXTENSA_ATOMIC_ADD 3 /* add to memory */ | 216 | __SYSCALL( 92, sys_shmget, 4) |
217 | #define SYSXTENSA_ATOMIC_CMP_SWP 4 /* compare and swap */ | 217 | #define __NR_shmat 93 |
218 | 218 | __SYSCALL( 93, xtensa_shmat, 4) | |
219 | #define SYSXTENSA_COUNT 5 /* count of syscall0 functions*/ | 219 | #define __NR_shmctl 94 |
220 | __SYSCALL( 94, sys_shmctl, 4) | ||
221 | #define __NR_shmdt 95 | ||
222 | __SYSCALL( 95, sys_shmdt, 4) | ||
223 | |||
224 | /* Socket Operations */ | ||
225 | |||
226 | #define __NR_socket 96 | ||
227 | __SYSCALL( 96, sys_socket, 3) | ||
228 | #define __NR_setsockopt 97 | ||
229 | __SYSCALL( 97, sys_setsockopt, 5) | ||
230 | #define __NR_getsockopt 98 | ||
231 | __SYSCALL( 98, sys_getsockopt, 5) | ||
232 | #define __NR_shutdown 99 | ||
233 | __SYSCALL( 99, sys_shutdown, 2) | ||
234 | |||
235 | #define __NR_bind 100 | ||
236 | __SYSCALL(100, sys_bind, 3) | ||
237 | #define __NR_connect 101 | ||
238 | __SYSCALL(101, sys_connect, 3) | ||
239 | #define __NR_listen 102 | ||
240 | __SYSCALL(102, sys_listen, 2) | ||
241 | #define __NR_accept 103 | ||
242 | __SYSCALL(103, sys_accept, 3) | ||
243 | |||
244 | #define __NR_getsockname 104 | ||
245 | __SYSCALL(104, sys_getsockname, 3) | ||
246 | #define __NR_getpeername 105 | ||
247 | __SYSCALL(105, sys_getpeername, 3) | ||
248 | #define __NR_sendmsg 106 | ||
249 | __SYSCALL(106, sys_sendmsg, 3) | ||
250 | #define __NR_recvmsg 107 | ||
251 | __SYSCALL(107, sys_recvmsg, 3) | ||
252 | #define __NR_send 108 | ||
253 | __SYSCALL(108, sys_send, 4) | ||
254 | #define __NR_recv 109 | ||
255 | __SYSCALL(109, sys_recv, 4) | ||
256 | #define __NR_sendto 110 | ||
257 | __SYSCALL(110, sys_sendto, 6) | ||
258 | #define __NR_recvfrom 111 | ||
259 | __SYSCALL(111, sys_recvfrom, 6) | ||
260 | |||
261 | #define __NR_socketpair 112 | ||
262 | __SYSCALL(112, sys_socketpair, 4) | ||
263 | #define __NR_sendfile 113 | ||
264 | __SYSCALL(113, sys_sendfile, 4) | ||
265 | #define __NR_sendfile64 114 | ||
266 | __SYSCALL(114, sys_sendfile64, 4) | ||
267 | #define __NR_available115 115 | ||
268 | __SYSCALL(115, sys_ni_syscall, 0) | ||
269 | |||
270 | /* Process Operations */ | ||
271 | |||
272 | #define __NR_clone 116 | ||
273 | __SYSCALL(116, xtensa_clone, 5) | ||
274 | #define __NR_execve 117 | ||
275 | __SYSCALL(117, xtensa_execve, 3) | ||
276 | #define __NR_exit 118 | ||
277 | __SYSCALL(118, sys_exit, 1) | ||
278 | #define __NR_exit_group 119 | ||
279 | __SYSCALL(119, sys_exit_group, 1) | ||
280 | #define __NR_getpid 120 | ||
281 | __SYSCALL(120, sys_getpid, 0) | ||
282 | #define __NR_wait4 121 | ||
283 | __SYSCALL(121, sys_wait4, 4) | ||
284 | #define __NR_waitid 122 | ||
285 | __SYSCALL(122, sys_waitid, 5) | ||
286 | #define __NR_kill 123 | ||
287 | __SYSCALL(123, sys_kill, 2) | ||
288 | #define __NR_tkill 124 | ||
289 | __SYSCALL(124, sys_tkill, 2) | ||
290 | #define __NR_tgkill 125 | ||
291 | __SYSCALL(125, sys_tgkill, 3) | ||
292 | #define __NR_set_tid_address 126 | ||
293 | __SYSCALL(126, sys_set_tid_address, 1) | ||
294 | #define __NR_gettid 127 | ||
295 | __SYSCALL(127, sys_gettid, 0) | ||
296 | #define __NR_setsid 128 | ||
297 | __SYSCALL(128, sys_setsid, 0) | ||
298 | #define __NR_getsid 129 | ||
299 | __SYSCALL(129, sys_getsid, 1) | ||
300 | #define __NR_prctl 130 | ||
301 | __SYSCALL(130, sys_prctl, 5) | ||
302 | #define __NR_personality 131 | ||
303 | __SYSCALL(131, sys_personality, 1) | ||
304 | #define __NR_getpriority 132 | ||
305 | __SYSCALL(132, sys_getpriority, 2) | ||
306 | #define __NR_setpriority 133 | ||
307 | __SYSCALL(133, sys_setpriority, 3) | ||
308 | #define __NR_setitimer 134 | ||
309 | __SYSCALL(134, sys_setitimer, 3) | ||
310 | #define __NR_getitimer 135 | ||
311 | __SYSCALL(135, sys_getitimer, 2) | ||
312 | #define __NR_setuid 136 | ||
313 | __SYSCALL(136, sys_setuid, 1) | ||
314 | #define __NR_getuid 137 | ||
315 | __SYSCALL(137, sys_getuid, 0) | ||
316 | #define __NR_setgid 138 | ||
317 | __SYSCALL(138, sys_setgid, 1) | ||
318 | #define __NR_getgid 139 | ||
319 | __SYSCALL(139, sys_getgid, 0) | ||
320 | #define __NR_geteuid 140 | ||
321 | __SYSCALL(140, sys_geteuid, 0) | ||
322 | #define __NR_getegid 141 | ||
323 | __SYSCALL(141, sys_getegid, 0) | ||
324 | #define __NR_setreuid 142 | ||
325 | __SYSCALL(142, sys_setreuid, 2) | ||
326 | #define __NR_setregid 143 | ||
327 | __SYSCALL(143, sys_setregid, 2) | ||
328 | #define __NR_setresuid 144 | ||
329 | __SYSCALL(144, sys_setresuid, 3) | ||
330 | #define __NR_getresuid 145 | ||
331 | __SYSCALL(145, sys_getresuid, 3) | ||
332 | #define __NR_setresgid 146 | ||
333 | __SYSCALL(146, sys_setresgid, 3) | ||
334 | #define __NR_getresgid 147 | ||
335 | __SYSCALL(147, sys_getresgid, 3) | ||
336 | #define __NR_setpgid 148 | ||
337 | __SYSCALL(148, sys_setpgid, 2) | ||
338 | #define __NR_getpgid 149 | ||
339 | __SYSCALL(149, sys_getpgid, 1) | ||
340 | #define __NR_getppid 150 | ||
341 | __SYSCALL(150, sys_getppid, 0) | ||
342 | #define __NR_available151 151 | ||
343 | __SYSCALL(151, sys_ni_syscall, 0) | ||
344 | |||
345 | #define __NR_reserved152 152 /* set_thread_area */ | ||
346 | __SYSCALL(152, sys_ni_syscall, 0) | ||
347 | #define __NR_reserved153 153 /* get_thread_area */ | ||
348 | __SYSCALL(153, sys_ni_syscall, 0) | ||
349 | #define __NR_times 154 | ||
350 | __SYSCALL(154, sys_times, 1) | ||
351 | #define __NR_acct 155 | ||
352 | __SYSCALL(155, sys_acct, 1) | ||
353 | #define __NR_sched_setaffinity 156 | ||
354 | __SYSCALL(156, sys_sched_setaffinity, 3) | ||
355 | #define __NR_sched_getaffinity 157 | ||
356 | __SYSCALL(157, sys_sched_getaffinity, 3) | ||
357 | #define __NR_capget 158 | ||
358 | __SYSCALL(158, sys_capget, 2) | ||
359 | #define __NR_capset 159 | ||
360 | __SYSCALL(159, sys_capset, 2) | ||
361 | #define __NR_ptrace 160 | ||
362 | __SYSCALL(160, sys_ptrace, 4) | ||
363 | #define __NR_semtimedop 161 | ||
364 | __SYSCALL(161, sys_semtimedop, 5) | ||
365 | #define __NR_semget 162 | ||
366 | __SYSCALL(162, sys_semget, 4) | ||
367 | #define __NR_semop 163 | ||
368 | __SYSCALL(163, sys_semop, 4) | ||
369 | #define __NR_semctl 164 | ||
370 | __SYSCALL(164, sys_semctl, 4) | ||
371 | #define __NR_available165 165 | ||
372 | __SYSCALL(165, sys_ni_syscall, 0) | ||
373 | #define __NR_msgget 166 | ||
374 | __SYSCALL(166, sys_msgget, 4) | ||
375 | #define __NR_msgsnd 167 | ||
376 | __SYSCALL(167, sys_msgsnd, 4) | ||
377 | #define __NR_msgrcv 168 | ||
378 | __SYSCALL(168, sys_msgrcv, 4) | ||
379 | #define __NR_msgctl 169 | ||
380 | __SYSCALL(169, sys_msgctl, 4) | ||
381 | #define __NR_available170 170 | ||
382 | __SYSCALL(170, sys_ni_syscall, 0) | ||
383 | #define __NR_available171 171 | ||
384 | __SYSCALL(171, sys_ni_syscall, 0) | ||
385 | |||
386 | /* File System */ | ||
387 | |||
388 | #define __NR_mount 172 | ||
389 | __SYSCALL(172, sys_mount, 5) | ||
390 | #define __NR_swapon 173 | ||
391 | __SYSCALL(173, sys_swapon, 2) | ||
392 | #define __NR_chroot 174 | ||
393 | __SYSCALL(174, sys_chroot, 1) | ||
394 | #define __NR_pivot_root 175 | ||
395 | __SYSCALL(175, sys_pivot_root, 2) | ||
396 | #define __NR_umount 176 | ||
397 | __SYSCALL(176, sys_umount, 2) | ||
398 | #define __NR_swapoff 177 | ||
399 | __SYSCALL(177, sys_swapoff, 1) | ||
400 | #define __NR_sync 178 | ||
401 | __SYSCALL(178, sys_sync, 0) | ||
402 | #define __NR_available179 179 | ||
403 | __SYSCALL(179, sys_ni_syscall, 0) | ||
404 | #define __NR_setfsuid 180 | ||
405 | __SYSCALL(180, sys_setfsuid, 1) | ||
406 | #define __NR_setfsgid 181 | ||
407 | __SYSCALL(181, sys_setfsgid, 1) | ||
408 | #define __NR_sysfs 182 | ||
409 | __SYSCALL(182, sys_sysfs, 3) | ||
410 | #define __NR_ustat 183 | ||
411 | __SYSCALL(183, sys_ustat, 2) | ||
412 | #define __NR_statfs 184 | ||
413 | __SYSCALL(184, sys_statfs, 2) | ||
414 | #define __NR_fstatfs 185 | ||
415 | __SYSCALL(185, sys_fstatfs, 2) | ||
416 | #define __NR_statfs64 186 | ||
417 | __SYSCALL(186, sys_statfs64, 3) | ||
418 | #define __NR_fstatfs64 187 | ||
419 | __SYSCALL(187, sys_fstatfs64, 3) | ||
420 | |||
421 | /* System */ | ||
422 | |||
423 | #define __NR_setrlimit 188 | ||
424 | __SYSCALL(188, sys_setrlimit, 2) | ||
425 | #define __NR_getrlimit 189 | ||
426 | __SYSCALL(189, sys_getrlimit, 2) | ||
427 | #define __NR_getrusage 190 | ||
428 | __SYSCALL(190, sys_getrusage, 2) | ||
429 | #define __NR_futex 191 | ||
430 | __SYSCALL(191, sys_futex, 5) | ||
431 | #define __NR_gettimeofday 192 | ||
432 | __SYSCALL(192, sys_gettimeofday, 2) | ||
433 | #define __NR_settimeofday 193 | ||
434 | __SYSCALL(193, sys_settimeofday, 2) | ||
435 | #define __NR_adjtimex 194 | ||
436 | __SYSCALL(194, sys_adjtimex, 1) | ||
437 | #define __NR_nanosleep 195 | ||
438 | __SYSCALL(195, sys_nanosleep, 2) | ||
439 | #define __NR_getgroups 196 | ||
440 | __SYSCALL(196, sys_getgroups, 2) | ||
441 | #define __NR_setgroups 197 | ||
442 | __SYSCALL(197, sys_setgroups, 2) | ||
443 | #define __NR_sethostname 198 | ||
444 | __SYSCALL(198, sys_sethostname, 2) | ||
445 | #define __NR_setdomainname 199 | ||
446 | __SYSCALL(199, sys_setdomainname, 2) | ||
447 | #define __NR_syslog 200 | ||
448 | __SYSCALL(200, sys_syslog, 3) | ||
449 | #define __NR_vhangup 201 | ||
450 | __SYSCALL(201, sys_vhangup, 0) | ||
451 | #define __NR_uselib 202 | ||
452 | __SYSCALL(202, sys_uselib, 1) | ||
453 | #define __NR_reboot 203 | ||
454 | __SYSCALL(203, sys_reboot, 3) | ||
455 | #define __NR_quotactl 204 | ||
456 | __SYSCALL(204, sys_quotactl, 4) | ||
457 | #define __NR_nfsservctl 205 | ||
458 | __SYSCALL(205, sys_nfsservctl, 3) | ||
459 | #define __NR__sysctl 206 | ||
460 | __SYSCALL(206, sys_sysctl, 1) | ||
461 | #define __NR_bdflush 207 | ||
462 | __SYSCALL(207, sys_bdflush, 2) | ||
463 | #define __NR_uname 208 | ||
464 | __SYSCALL(208, sys_newuname, 1) | ||
465 | #define __NR_sysinfo 209 | ||
466 | __SYSCALL(209, sys_sysinfo, 1) | ||
467 | #define __NR_init_module 210 | ||
468 | __SYSCALL(210, sys_init_module, 2) | ||
469 | #define __NR_delete_module 211 | ||
470 | __SYSCALL(211, sys_delete_module, 1) | ||
471 | |||
472 | #define __NR_sched_setparam 212 | ||
473 | __SYSCALL(212, sys_sched_setparam, 2) | ||
474 | #define __NR_sched_getparam 213 | ||
475 | __SYSCALL(213, sys_sched_getparam, 2) | ||
476 | #define __NR_sched_setscheduler 214 | ||
477 | __SYSCALL(214, sys_sched_setscheduler, 3) | ||
478 | #define __NR_sched_getscheduler 215 | ||
479 | __SYSCALL(215, sys_sched_getscheduler, 1) | ||
480 | #define __NR_sched_get_priority_max 216 | ||
481 | __SYSCALL(216, sys_sched_get_priority_max, 1) | ||
482 | #define __NR_sched_get_priority_min 217 | ||
483 | __SYSCALL(217, sys_sched_get_priority_min, 1) | ||
484 | #define __NR_sched_rr_get_interval 218 | ||
485 | __SYSCALL(218, sys_sched_rr_get_interval, 2) | ||
486 | #define __NR_sched_yield 219 | ||
487 | __SYSCALL(219, sys_sched_yield, 0) | ||
488 | #define __NR_sigreturn 222 | ||
489 | __SYSCALL(222, xtensa_sigreturn, 0) | ||
490 | |||
491 | /* Signal Handling */ | ||
492 | |||
493 | #define __NR_restart_syscall 223 | ||
494 | __SYSCALL(223, sys_restart_syscall, 0) | ||
495 | #define __NR_sigaltstack 224 | ||
496 | __SYSCALL(224, xtensa_sigaltstack, 2) | ||
497 | #define __NR_rt_sigreturn 225 | ||
498 | __SYSCALL(225, xtensa_rt_sigreturn, 1) | ||
499 | #define __NR_rt_sigaction 226 | ||
500 | __SYSCALL(226, sys_rt_sigaction, 4) | ||
501 | #define __NR_rt_sigprocmask 227 | ||
502 | __SYSCALL(227, sys_rt_sigprocmask, 4) | ||
503 | #define __NR_rt_sigpending 228 | ||
504 | __SYSCALL(228, sys_rt_sigpending, 2) | ||
505 | #define __NR_rt_sigtimedwait 229 | ||
506 | __SYSCALL(229, sys_rt_sigtimedwait, 4) | ||
507 | #define __NR_rt_sigqueueinfo 230 | ||
508 | __SYSCALL(230, sys_rt_sigqueueinfo, 3) | ||
509 | #define __NR_rt_sigsuspend 231 | ||
510 | __SYSCALL(231, xtensa_rt_sigsuspend, 2) | ||
511 | |||
512 | /* Message */ | ||
513 | |||
514 | #define __NR_mq_open 232 | ||
515 | __SYSCALL(232, sys_mq_open, 4) | ||
516 | #define __NR_mq_unlink 233 | ||
517 | __SYSCALL(233, sys_mq_unlink, 1) | ||
518 | #define __NR_mq_timedsend 234 | ||
519 | __SYSCALL(234, sys_mq_timedsend, 5) | ||
520 | #define __NR_mq_timedreceive 235 | ||
521 | __SYSCALL(235, sys_mq_timedreceive, 5) | ||
522 | #define __NR_mq_notify 236 | ||
523 | __SYSCALL(236, sys_mq_notify, 2) | ||
524 | #define __NR_mq_getsetattr 237 | ||
525 | __SYSCALL(237, sys_mq_getsetattr, 3) | ||
526 | #define __NR_available238 238 | ||
527 | __SYSCALL(238, sys_ni_syscall, 0) | ||
528 | |||
529 | /* IO */ | ||
530 | |||
531 | #define __NR_io_setup 239 | ||
532 | __SYSCALL(239, sys_io_setup, 2) | ||
533 | #define __NR_io_destroy 240 | ||
534 | __SYSCALL(240, sys_io_destroy, 1) | ||
535 | #define __NR_io_submit 241 | ||
536 | __SYSCALL(241, sys_io_submit, 3) | ||
537 | #define __NR_io_getevents 242 | ||
538 | __SYSCALL(242, sys_io_getevents, 5) | ||
539 | #define __NR_io_cancel 243 | ||
540 | __SYSCALL(243, sys_io_cancel, 3) | ||
541 | #define __NR_clock_settime 244 | ||
542 | __SYSCALL(244, sys_clock_settime, 2) | ||
543 | #define __NR_clock_gettime 245 | ||
544 | __SYSCALL(245, sys_clock_gettime, 2) | ||
545 | #define __NR_clock_getres 246 | ||
546 | __SYSCALL(246, sys_clock_getres, 2) | ||
547 | #define __NR_clock_nanosleep 247 | ||
548 | __SYSCALL(247, sys_clock_nanosleep, 4) | ||
549 | |||
550 | /* Timer */ | ||
551 | |||
552 | #define __NR_timer_create 248 | ||
553 | __SYSCALL(248, sys_timer_create, 3) | ||
554 | #define __NR_timer_delete 249 | ||
555 | __SYSCALL(249, sys_timer_delete, 1) | ||
556 | #define __NR_timer_settime 250 | ||
557 | __SYSCALL(250, sys_timer_settime, 4) | ||
558 | #define __NR_timer_gettime 251 | ||
559 | __SYSCALL(251, sys_timer_gettime, 2) | ||
560 | #define __NR_timer_getoverrun 252 | ||
561 | __SYSCALL(252, sys_timer_getoverrun, 1) | ||
562 | |||
563 | /* System */ | ||
564 | |||
565 | #define __NR_reserved244 253 | ||
566 | __SYSCALL(253, sys_ni_syscall, 0) | ||
567 | #define __NR_lookup_dcookie 254 | ||
568 | __SYSCALL(254, sys_lookup_dcookie, 4) | ||
569 | #define __NR_available255 255 | ||
570 | __SYSCALL(255, sys_ni_syscall, 0) | ||
571 | #define __NR_add_key 256 | ||
572 | __SYSCALL(256, sys_add_key, 5) | ||
573 | #define __NR_request_key 257 | ||
574 | __SYSCALL(257, sys_request_key, 5) | ||
575 | #define __NR_keyctl 258 | ||
576 | __SYSCALL(258, sys_keyctl, 5) | ||
577 | #define __NR_available259 259 | ||
578 | __SYSCALL(259, sys_ni_syscall, 0) | ||
579 | |||
580 | #define __NR_syscall_count 261 | ||
581 | |||
582 | /* | ||
583 | * sysxtensa syscall handler | ||
584 | * | ||
585 | * int sysxtensa (SYS_XTENSA_ATOMIC_SET, ptr, val, unused); | ||
586 | * int sysxtensa (SYS_XTENSA_ATOMIC_ADD, ptr, val, unused); | ||
587 | * int sysxtensa (SYS_XTENSA_ATOMIC_EXG_ADD, ptr, val, unused); | ||
588 | * int sysxtensa (SYS_XTENSA_ATOMIC_CMP_SWP, ptr, oldval, newval); | ||
589 | * a2 a6 a3 a4 a5 | ||
590 | */ | ||
591 | |||
592 | #define SYS_XTENSA_RESERVED 0 /* don't use this */ | ||
593 | #define SYS_XTENSA_ATOMIC_SET 1 /* set variable */ | ||
594 | #define SYS_XTENSA_ATOMIC_EXG_ADD 2 /* exchange memory and add */ | ||
595 | #define SYS_XTENSA_ATOMIC_ADD 3 /* add to memory */ | ||
596 | #define SYS_XTENSA_ATOMIC_CMP_SWP 4 /* compare and swap */ | ||
597 | |||
598 | #define SYS_XTENSA_COUNT 5 /* count */ | ||
220 | 599 | ||
221 | #ifdef __KERNEL__ | 600 | #ifdef __KERNEL__ |
222 | 601 | ||
@@ -232,7 +611,9 @@ | |||
232 | #define __ARCH_WANT_SYS_UTIME | 611 | #define __ARCH_WANT_SYS_UTIME |
233 | #define __ARCH_WANT_SYS_LLSEEK | 612 | #define __ARCH_WANT_SYS_LLSEEK |
234 | #define __ARCH_WANT_SYS_RT_SIGACTION | 613 | #define __ARCH_WANT_SYS_RT_SIGACTION |
614 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | ||
235 | 615 | ||
236 | #endif /* __KERNEL__ */ | 616 | #endif /* __KERNEL__ */ |
237 | 617 | ||
238 | #endif /* _XTENSA_UNISTD_H */ | 618 | #endif /* _XTENSA_UNISTD_H */ |
619 | |||