mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
[PATCH] provide kernel_execve on all architectures
This adds the new kernel_execve function on all architectures that were using _syscall3() to implement execve. The implementation uses code from the _syscall3 macros provided in the unistd.h header file. I don't have cross-compilers for any of these architectures, so the patch is untested with the exception of i386. Most architectures can probably implement this in a nicer way in assembly or by combining it with the sys_execve implementation itself, but this should do it for now. [[email protected]: m68knommu build fix] [[email protected]: build fix] [[email protected]: build fix] [[email protected]: mips fix] [[email protected]: s390 fix] Signed-off-by: Arnd Bergmann <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Richard Henderson <[email protected]> Cc: Ivan Kokshaysky <[email protected]> Cc: Russell King <[email protected]> Cc: Ian Molton <[email protected]> Cc: Mikael Starvik <[email protected]> Cc: David Howells <[email protected]> Cc: Yoshinori Sato <[email protected]> Cc: Hirokazu Takata <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Kyle McMartin <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Martin Schwidefsky <[email protected]> Cc: Paul Mundt <[email protected]> Cc: Kazumoto Kojima <[email protected]> Cc: Richard Curnow <[email protected]> Cc: William Lee Irwin III <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Jeff Dike <[email protected]> Cc: Paolo 'Blaisorblade' Giarrusso <[email protected]> Cc: Miles Bader <[email protected]> Cc: Chris Zankel <[email protected]> Cc: "Luck, Tony" <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Roman Zippel <[email protected]> Signed-off-by: Ralf Baechle <[email protected]> Signed-off-by: Bernhard Rosenkraenzer <[email protected]> Signed-off-by: Mark Haverkamp <[email protected]> Signed-off-by: Adrian Bunk <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
3db03b4afb
commit
fe74290d51
16 changed files with 300 additions and 12 deletions
|
|
@ -25,6 +25,7 @@
|
|||
#include <asm/cachectl.h>
|
||||
#include <asm/traps.h>
|
||||
#include <asm/ipc.h>
|
||||
#include <asm/unistd.h>
|
||||
|
||||
/*
|
||||
* sys_pipe() is the normal C calling standard for creating
|
||||
|
|
@ -280,3 +281,26 @@ asmlinkage void syscall_print(void *dummy,...)
|
|||
((regs->pc)&0xffffff)-2,regs->orig_er0,regs->er1,regs->er2,regs->er3,regs->er0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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 long res __asm__("er0");
|
||||
register const char * _a __asm__("er1") = filename;
|
||||
register void *_b __asm__("er2") = argv;
|
||||
register void *_c __asm__("er3") = envp;
|
||||
__asm__ __volatile__ ("mov.l %1,er0\n\t"
|
||||
"trapa #0\n\t"
|
||||
: "=r" (res)
|
||||
: "g" (__NR_execve),
|
||||
"g" (_a),
|
||||
"g" (_b),
|
||||
"g" (_c)
|
||||
: "cc", "memory");
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue