lkml.org 
[lkml]   [2006]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH 3/6] provide kernel_execve on all architectures
From
Date
On Wed, 2006-08-30 at 14:43 +0200, Arnd Bergmann wrote:
> This adds the new kernel_execve function on all architectures
> that were using _syscall3() to implement execve.

Doesn't compile for s390. Patch attached, issues fixed:
1) Include unistd.h for __NR_execve
2) The compiler warns about __arg2 and __arg3 assignments (watch out for
the *const* - isn't C a lovely language ;-)
3) The inline assembly does not clobber register "1", nor the condition
code. The call to kernel_execve does clobber both so it is not really a
problem, but nit-picking is fun >:-)

--
blue skies,
Martin.

Martin Schwidefsky
Linux for zSeries Development & Services
IBM Deutschland Entwicklung GmbH

"Reality continues to ruin my life." - Calvin.

---
diff -urpN linux-2.6/arch/s390/kernel/sys_s390.c linux-2.6-patched/arch/s390/kernel/sys_s390.c
--- linux-2.6/arch/s390/kernel/sys_s390.c 2006-08-30 15:23:14.000000000 +0200
+++ linux-2.6-patched/arch/s390/kernel/sys_s390.c 2006-08-30 15:18:37.000000000 +0200
@@ -27,6 +27,7 @@
#include <linux/file.h>
#include <linux/utsname.h>
#include <linux/personality.h>
+#include <linux/unistd.h>

#include <asm/uaccess.h>
#include <asm/ipc.h>
@@ -273,14 +274,15 @@ s390_fadvise64_64(struct fadvise64_64_ar
int kernel_execve(const char *filename, char *const argv[], char *const envp[])
{
register const char *__arg1 asm("2") = filename;
- register void *__arg2 asm("3") = argv;
- register void *__arg3 asm("4") = envp;
+ register char *const*__arg2 asm("3") = argv;
+ register char *const*__arg3 asm("4") = envp;
register long __svcres asm("2");
- asm volatile ("svc %b1"
+ asm volatile(
+ "svc %b1"
: "=d" (__svcres)
: "i" (__NR_execve),
"0" (__arg1),
"d" (__arg2),
- "d" (__arg3) : "1", "cc", "memory");
+ "d" (__arg3) : "memory");
return __svcres;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-08-30 16:19    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site