2005-04-16 22:20:36 +00:00
|
|
|
/*
|
2007-11-20 06:50:59 +00:00
|
|
|
* arch/sh/kernel/sys_sh64.c
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2000, 2001 Paolo Alberelli
|
|
|
|
*
|
|
|
|
* This file contains various random system calls that
|
|
|
|
* have a non-standard calling sequence on the Linux/SH5
|
|
|
|
* platform.
|
|
|
|
*
|
2007-11-20 06:50:59 +00:00
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/rwsem.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/mm.h>
|
2007-07-31 04:03:02 +00:00
|
|
|
#include <linux/fs.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/smp.h>
|
|
|
|
#include <linux/sem.h>
|
|
|
|
#include <linux/msg.h>
|
|
|
|
#include <linux/shm.h>
|
|
|
|
#include <linux/stat.h>
|
|
|
|
#include <linux/mman.h>
|
|
|
|
#include <linux/file.h>
|
|
|
|
#include <linux/syscalls.h>
|
2007-10-17 06:29:24 +00:00
|
|
|
#include <linux/ipc.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <asm/uaccess.h>
|
|
|
|
#include <asm/ptrace.h>
|
2006-10-02 09:18:34 +00:00
|
|
|
#include <asm/unistd.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-10-02 09:18:34 +00:00
|
|
|
/*
|
|
|
|
* Do a system call from kernel instead of calling sys_execve so we
|
|
|
|
* end up with proper pt_regs.
|
|
|
|
*/
|
|
|
|
int kernel_execve(const char *filename, char *const argv[], char *const envp[])
|
|
|
|
{
|
|
|
|
register unsigned long __sc0 __asm__ ("r9") = ((0x13 << 16) | __NR_execve);
|
|
|
|
register unsigned long __sc2 __asm__ ("r2") = (unsigned long) filename;
|
|
|
|
register unsigned long __sc3 __asm__ ("r3") = (unsigned long) argv;
|
|
|
|
register unsigned long __sc4 __asm__ ("r4") = (unsigned long) envp;
|
|
|
|
__asm__ __volatile__ ("trapa %1 !\t\t\t execve(%2,%3,%4)"
|
|
|
|
: "=r" (__sc0)
|
|
|
|
: "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4) );
|
|
|
|
__asm__ __volatile__ ("!dummy %0 %1 %2 %3"
|
|
|
|
: : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4) : "memory");
|
|
|
|
return __sc0;
|
|
|
|
}
|