diff options
author | Jonas Bonn <jonas@southpole.se> | 2011-06-04 15:26:51 -0400 |
---|---|---|
committer | Jonas Bonn <jonas@southpole.se> | 2011-07-22 12:46:34 -0400 |
commit | 09abb90107202d3b18cf5a69076a1d05d11244e6 (patch) | |
tree | fc7ccb4421c4471cc24a8cdab7264ff13ba44b20 /arch/openrisc/kernel | |
parent | 816ebaa8b6ea8f97515a40e25076f297d0304611 (diff) |
OpenRISC: System calls
The OpenRISC Linux kernel conforms to the "generic" syscall interface which
contains only the reduced set of syscalls deemed necessary for new
architectures. Unfortunately, the uClibc port for OpenRISC does not fully
support this reduced set; as such, an additional patch available out-of-tree
needs to be applied to the kernel in order to use the current uClibc. This
is just a temporary measure until the libc port can be straightened out; it
is likely that OpenRISC will make the transition to glibc shortly where the
generic syscall interface is better supported.
Signed-off-by: Jonas Bonn <jonas@southpole.se>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/openrisc/kernel')
-rw-r--r-- | arch/openrisc/kernel/sys_call_table.c | 28 | ||||
-rw-r--r-- | arch/openrisc/kernel/sys_or32.c | 57 |
2 files changed, 85 insertions, 0 deletions
diff --git a/arch/openrisc/kernel/sys_call_table.c b/arch/openrisc/kernel/sys_call_table.c new file mode 100644 index 000000000000..e1f8ce8c72a8 --- /dev/null +++ b/arch/openrisc/kernel/sys_call_table.c | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * OpenRISC sys_call_table.c | ||
3 | * | ||
4 | * Linux architectural port borrowing liberally from similar works of | ||
5 | * others. All original copyrights apply as per the original source | ||
6 | * declaration. | ||
7 | * | ||
8 | * Modifications for the OpenRISC architecture: | ||
9 | * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version | ||
14 | * 2 of the License, or (at your option) any later version. | ||
15 | */ | ||
16 | |||
17 | #include <linux/syscalls.h> | ||
18 | #include <linux/signal.h> | ||
19 | #include <linux/unistd.h> | ||
20 | |||
21 | #include <asm/syscalls.h> | ||
22 | |||
23 | #undef __SYSCALL | ||
24 | #define __SYSCALL(nr, call) [nr] = (call), | ||
25 | |||
26 | void *sys_call_table[__NR_syscalls] = { | ||
27 | #include <asm/unistd.h> | ||
28 | }; | ||
diff --git a/arch/openrisc/kernel/sys_or32.c b/arch/openrisc/kernel/sys_or32.c new file mode 100644 index 000000000000..57060084c0cc --- /dev/null +++ b/arch/openrisc/kernel/sys_or32.c | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * OpenRISC sys_or32.c | ||
3 | * | ||
4 | * Linux architectural port borrowing liberally from similar works of | ||
5 | * others. All original copyrights apply as per the original source | ||
6 | * declaration. | ||
7 | * | ||
8 | * Modifications for the OpenRISC architecture: | ||
9 | * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com> | ||
10 | * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se> | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version | ||
15 | * 2 of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This file contains various random system calls that | ||
18 | * have a non-standard calling sequence on some platforms. | ||
19 | * Since we don't have to do any backwards compatibility, our | ||
20 | * versions are done in the most "normal" way possible. | ||
21 | */ | ||
22 | |||
23 | #include <linux/errno.h> | ||
24 | #include <linux/syscalls.h> | ||
25 | #include <linux/mm.h> | ||
26 | |||
27 | #include <asm/syscalls.h> | ||
28 | |||
29 | /* These are secondary entry points as the primary entry points are defined in | ||
30 | * entry.S where we add the 'regs' parameter value | ||
31 | */ | ||
32 | |||
33 | asmlinkage long _sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
34 | int __user *parent_tid, int __user *child_tid, | ||
35 | struct pt_regs *regs) | ||
36 | { | ||
37 | long ret; | ||
38 | |||
39 | /* FIXME: Is alignment necessary? */ | ||
40 | /* newsp = ALIGN(newsp, 4); */ | ||
41 | |||
42 | if (!newsp) | ||
43 | newsp = regs->sp; | ||
44 | |||
45 | ret = do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid); | ||
46 | |||
47 | return ret; | ||
48 | } | ||
49 | |||
50 | asmlinkage int _sys_fork(struct pt_regs *regs) | ||
51 | { | ||
52 | #ifdef CONFIG_MMU | ||
53 | return do_fork(SIGCHLD, regs->sp, regs, 0, NULL, NULL); | ||
54 | #else | ||
55 | return -EINVAL; | ||
56 | #endif | ||
57 | } | ||