Skip to content

Commit

Permalink
microblaze: use generic syscalls.h
Browse files Browse the repository at this point in the history
The prototypes in syscalls.h all make sense for
microblaze, but for some of them, the actual implementation
in sys_microblaze.c needs to be adapted.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Michal Simek <monstr@monstr.eu>
  • Loading branch information
Arnd Bergmann authored and Michal Simek committed Jul 6, 2009
1 parent 3183e06 commit e513588
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 62 deletions.
39 changes: 3 additions & 36 deletions arch/microblaze/include/asm/syscalls.h
Original file line number Diff line number Diff line change
@@ -1,41 +1,8 @@
#ifndef __ASM_MICROBLAZE_SYSCALLS_H
#define __ASM_MICROBLAZE_SYSCALLS_H
#ifdef __KERNEL__

#include <linux/compiler.h>
#include <linux/linkage.h>
#include <linux/types.h>
#include <linux/signal.h>
asmlinkage long sys_clone(int flags, unsigned long stack, struct pt_regs *regs);
#define sys_clone sys_clone

/* FIXME will be removed */
asmlinkage int sys_ipc(uint call, int first, int second,
int third, void *ptr, long fifth);
#include <asm-generic/syscalls.h>

struct pt_regs;
asmlinkage int sys_vfork(struct pt_regs *regs);
asmlinkage int sys_clone(int flags, unsigned long stack, struct pt_regs *regs);
asmlinkage int sys_execve(char __user *filenamei, char __user *__user *argv,
char __user *__user *envp, struct pt_regs *regs);

asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len,
unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff);

asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
unsigned long prot, unsigned long flags,
unsigned long fd, off_t offset);

/* from signal.c */
asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize,
struct pt_regs *regs);

asmlinkage long sys_rt_sigaction(int sig, const struct sigaction __user *act,
struct sigaction __user *oact, size_t sigsetsize);

asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
struct pt_regs *regs);

asmlinkage long sys_rt_sigreturn(struct pt_regs *regs);

#endif /* __KERNEL__ */
#endif /* __ASM_MICROBLAZE_SYSCALLS_H */
12 changes: 6 additions & 6 deletions arch/microblaze/kernel/entry-nommu.S
Original file line number Diff line number Diff line change
Expand Up @@ -551,16 +551,16 @@ no_work_pending:
rtid r14, 0
nop

sys_vfork_wrapper:
brid sys_vfork
sys_vfork:
brid microblaze_vfork
addk r5, r1, r0

sys_clone_wrapper:
brid sys_clone
sys_clone:
brid microblaze_clone
addk r7, r1, r0

sys_execve_wrapper:
brid sys_execve
sys_execve:
brid microblaze_execve
addk r8, r1, r0

sys_rt_sigreturn_wrapper:
Expand Down
11 changes: 5 additions & 6 deletions arch/microblaze/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -429,12 +429,11 @@ C_ENTRY(ret_from_fork):
brid ret_from_trap; /* Do normal trap return */
nop;

C_ENTRY(sys_vfork_wrapper):
C_ENTRY(sys_vfork):
brid microblaze_vfork /* Do real work (tail-call) */
la r5, r1, PTO
brid sys_vfork /* Do real work (tail-call) */
nop

C_ENTRY(sys_clone_wrapper):
C_ENTRY(sys_clone):
bnei r6, 1f; /* See if child SP arg (arg 1) is 0. */
lwi r6, r1, PTO+PT_R1; /* If so, use paret's stack ptr */
1: la r7, r1, PTO; /* Arg 2: parent context */
Expand All @@ -444,9 +443,9 @@ C_ENTRY(sys_clone_wrapper):
brid do_fork /* Do real work (tail-call) */
nop;

C_ENTRY(sys_execve_wrapper):
C_ENTRY(sys_execve):
la r8, r1, PTO; /* add user context as 4th arg */
brid sys_execve; /* Do real work (tail-call).*/
brid microblaze_execve; /* Do real work (tail-call).*/
nop;

C_ENTRY(sys_rt_sigsuspend_wrapper):
Expand Down
2 changes: 1 addition & 1 deletion arch/microblaze/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset, int in_sycall);


asmlinkage int
asmlinkage long
sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
struct pt_regs *regs)
{
Expand Down
20 changes: 10 additions & 10 deletions arch/microblaze/kernel/sys_microblaze.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*
* This is really horribly ugly. This will be remove with new toolchain.
*/
asmlinkage int
asmlinkage long
sys_ipc(uint call, int first, int second, int third, void *ptr, long fifth)
{
int version, ret;
Expand Down Expand Up @@ -134,20 +134,20 @@ sys_ipc(uint call, int first, int second, int third, void *ptr, long fifth)
return ret;
}

asmlinkage int sys_vfork(struct pt_regs *regs)
asmlinkage long microblaze_vfork(struct pt_regs *regs)
{
return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->r1,
regs, 0, NULL, NULL);
}

asmlinkage int sys_clone(int flags, unsigned long stack, struct pt_regs *regs)
asmlinkage long microblaze_clone(int flags, unsigned long stack, struct pt_regs *regs)
{
if (!stack)
stack = regs->r1;
return do_fork(flags, stack, regs, 0, NULL, NULL);
}

asmlinkage int sys_execve(char __user *filenamei, char __user *__user *argv,
asmlinkage long microblaze_execve(char __user *filenamei, char __user *__user *argv,
char __user *__user *envp, struct pt_regs *regs)
{
int error;
Expand All @@ -163,8 +163,8 @@ asmlinkage int sys_execve(char __user *filenamei, char __user *__user *argv,
return error;
}

asmlinkage unsigned long
sys_mmap2(unsigned long addr, size_t len,
asmlinkage long
sys_mmap2(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff)
{
Expand All @@ -189,18 +189,18 @@ sys_mmap2(unsigned long addr, size_t len,
return ret;
}

asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags,
unsigned long fd, off_t offset)
unsigned long fd, off_t pgoff)
{
int err = -EINVAL;

if (offset & ~PAGE_MASK) {
if (pgoff & ~PAGE_MASK) {
printk(KERN_INFO "no pagemask in mmap\r\n");
goto out;
}

err = sys_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
err = sys_mmap2(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
out:
return err;
}
Expand Down
6 changes: 3 additions & 3 deletions arch/microblaze/kernel/syscall_table.S
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ENTRY(sys_call_table)
.long sys_creat
.long sys_link
.long sys_unlink /* 10 */
.long sys_execve_wrapper
.long sys_execve
.long sys_chdir
.long sys_time
.long sys_mknod
Expand Down Expand Up @@ -124,7 +124,7 @@ ENTRY(sys_call_table)
.long sys_ipc
.long sys_fsync
.long sys_ni_syscall /* sys_sigreturn_wrapper */
.long sys_clone_wrapper /* 120 */
.long sys_clone /* 120 */
.long sys_setdomainname
.long sys_newuname
.long sys_ni_syscall /* modify_ldt */
Expand Down Expand Up @@ -194,7 +194,7 @@ ENTRY(sys_call_table)
.long sys_sendfile
.long sys_ni_syscall /* reserved for streams1 */
.long sys_ni_syscall /* reserved for streams2 */
.long sys_vfork_wrapper /* 190 */
.long sys_vfork /* 190 */
.long sys_getrlimit
.long sys_mmap2 /* mmap2 */
.long sys_truncate64
Expand Down

0 comments on commit e513588

Please sign in to comment.