xref: /linux/arch/hexagon/include/asm/syscall.h (revision b9398a84590be3a828c168ed25bf1fd3d637988a)
1*b9398a84SRichard Kuo /*
2*b9398a84SRichard Kuo  * Syscall support for the Hexagon architecture
3*b9398a84SRichard Kuo  *
4*b9398a84SRichard Kuo  * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
5*b9398a84SRichard Kuo  *
6*b9398a84SRichard Kuo  * This program is free software; you can redistribute it and/or modify
7*b9398a84SRichard Kuo  * it under the terms of the GNU General Public License version 2 and
8*b9398a84SRichard Kuo  * only version 2 as published by the Free Software Foundation.
9*b9398a84SRichard Kuo  *
10*b9398a84SRichard Kuo  * This program is distributed in the hope that it will be useful,
11*b9398a84SRichard Kuo  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*b9398a84SRichard Kuo  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*b9398a84SRichard Kuo  * GNU General Public License for more details.
14*b9398a84SRichard Kuo  *
15*b9398a84SRichard Kuo  * You should have received a copy of the GNU General Public License
16*b9398a84SRichard Kuo  * along with this program; if not, write to the Free Software
17*b9398a84SRichard Kuo  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18*b9398a84SRichard Kuo  * 02110-1301, USA.
19*b9398a84SRichard Kuo  */
20*b9398a84SRichard Kuo 
21*b9398a84SRichard Kuo #ifndef _ASM_HEXAGON_SYSCALL_H
22*b9398a84SRichard Kuo #define _ASM_HEXAGON_SYSCALL_H
23*b9398a84SRichard Kuo 
24*b9398a84SRichard Kuo typedef long (*syscall_fn)(unsigned long, unsigned long,
25*b9398a84SRichard Kuo 	unsigned long, unsigned long,
26*b9398a84SRichard Kuo 	unsigned long, unsigned long);
27*b9398a84SRichard Kuo 
28*b9398a84SRichard Kuo asmlinkage int sys_execve(char __user *ufilename, char __user * __user *argv,
29*b9398a84SRichard Kuo 			  char __user * __user *envp);
30*b9398a84SRichard Kuo asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
31*b9398a84SRichard Kuo 			 unsigned long parent_tidp, unsigned long child_tidp);
32*b9398a84SRichard Kuo 
33*b9398a84SRichard Kuo #define sys_execve	sys_execve
34*b9398a84SRichard Kuo #define sys_clone	sys_clone
35*b9398a84SRichard Kuo 
36*b9398a84SRichard Kuo #include <asm-generic/syscalls.h>
37*b9398a84SRichard Kuo 
38*b9398a84SRichard Kuo extern void *sys_call_table[];
39*b9398a84SRichard Kuo 
40*b9398a84SRichard Kuo static inline long syscall_get_nr(struct task_struct *task,
41*b9398a84SRichard Kuo 				  struct pt_regs *regs)
42*b9398a84SRichard Kuo {
43*b9398a84SRichard Kuo 	return regs->r06;
44*b9398a84SRichard Kuo }
45*b9398a84SRichard Kuo 
46*b9398a84SRichard Kuo static inline void syscall_get_arguments(struct task_struct *task,
47*b9398a84SRichard Kuo 					 struct pt_regs *regs,
48*b9398a84SRichard Kuo 					 unsigned int i, unsigned int n,
49*b9398a84SRichard Kuo 					 unsigned long *args)
50*b9398a84SRichard Kuo {
51*b9398a84SRichard Kuo 	BUG_ON(i + n > 6);
52*b9398a84SRichard Kuo 	memcpy(args, &(&regs->r00)[i], n * sizeof(args[0]));
53*b9398a84SRichard Kuo }
54*b9398a84SRichard Kuo #endif
55