2 * Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu>
3 * Copyright (C) 2007-2009 PetaLogix
4 * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
6 * Copyright (C) 2006 Atmark Techno, Inc.
7 * Yasushi SHOJI <yashi@atmark-techno.com>
8 * Tetsuya OHKAWA <tetsuya@atmark-techno.com>
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
15 #include <linux/errno.h>
17 #include <linux/smp.h>
18 #include <linux/syscalls.h>
19 #include <linux/sem.h>
20 #include <linux/msg.h>
21 #include <linux/shm.h>
22 #include <linux/stat.h>
23 #include <linux/mman.h>
24 #include <linux/sys.h>
25 #include <linux/ipc.h>
26 #include <linux/file.h>
27 #include <linux/module.h>
28 #include <linux/err.h>
30 #include <linux/semaphore.h>
31 #include <linux/uaccess.h>
32 #include <linux/unistd.h>
34 #include <asm/syscalls.h>
36 asmlinkage long microblaze_vfork(struct pt_regs *regs)
38 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->r1,
42 asmlinkage long microblaze_clone(int flags, unsigned long stack, struct pt_regs *regs)
46 return do_fork(flags, stack, regs, 0, NULL, NULL);
49 asmlinkage long microblaze_execve(char __user *filenamei, char __user *__user *argv,
50 char __user *__user *envp, struct pt_regs *regs)
55 filename = getname(filenamei);
56 error = PTR_ERR(filename);
59 error = do_execve(filename, argv, envp, regs);
65 asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
66 unsigned long prot, unsigned long flags,
67 unsigned long fd, off_t pgoff)
69 if (pgoff & ~PAGE_MASK)
72 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
76 * Do a system call from kernel instead of calling sys_execve so we
77 * end up with proper pt_regs.
79 int kernel_execve(const char *filename, char *const argv[], char *const envp[])
81 register const char *__a __asm__("r5") = filename;
82 register const void *__b __asm__("r6") = argv;
83 register const void *__c __asm__("r7") = envp;
84 register unsigned long __syscall __asm__("r12") = __NR_execve;
85 register unsigned long __ret __asm__("r3");
86 __asm__ __volatile__ ("brki r14, 0x8"
87 : "=r" (__ret), "=r" (__syscall)
88 : "1" (__syscall), "r" (__a), "r" (__b), "r" (__c)
90 "r10", "r11", "r14", "cc", "memory");