All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	Jeff Dike <jdike@addtoit.com>,
	Bjoern Steinbrink <B.Steinbrink@gmx.de>,
	Arjan van de Ven <arjan@infradead.org>,
	Chase Venters <chase.venters@clientec.com>,
	Andrew Morton <akpm@osdl.org>,
	Russell King <rmk+lkml@arm.linux.org.uk>,
	rusty@rustcorp.com.au
Subject: Re: [PATCH 3/7] provide kernel_execve on all architectures
Date: Tue, 29 Aug 2006 18:21:08 +0100	[thread overview]
Message-ID: <25403.1156872068@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <20060827215636.263883000@klappe.arndb.de>

Arnd Bergmann <arnd@arndb.de> wrote:

> 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.

Try applying the attached delta for FRV.  Note that you didn't #include
asm/unistd.h in your original patch.

Signed-Off-By: David Howells <dhowells@redhat.com>

---
diff --git a/arch/frv/kernel/Makefile b/arch/frv/kernel/Makefile
index 91d380a..7bf175c 100644
--- a/arch/frv/kernel/Makefile
+++ b/arch/frv/kernel/Makefile
@@ -8,7 +8,7 @@ heads-$(CONFIG_MMU)		:= head-mmu-fr451.o
 extra-y:= head.o init_task.o vmlinux.lds
 
 obj-y := $(heads-y) entry.o entry-table.o break.o switch_to.o kernel_thread.o \
-	 process.o traps.o ptrace.o signal.o dma.o \
+	 kernel_execve.o process.o traps.o ptrace.o signal.o dma.o \
 	 sys_frv.o time.o semaphore.o setup.o frv_ksyms.o \
 	 debug-stub.o irq.o irq-routing.o sleep.o uaccess.o atomic-ops.o
 
diff --git a/arch/frv/kernel/sys_frv.c b/arch/frv/kernel/sys_frv.c
index 944aab2..c4d4348 100644
--- a/arch/frv/kernel/sys_frv.c
+++ b/arch/frv/kernel/sys_frv.c
@@ -212,19 +212,3 @@ asmlinkage long sys_ipc(unsigned long ca
 		return -ENOSYS;
 	}
 }
-
-/*
- * 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 __scnum __asm__ ("gr7") = __NR_execve;
-	register unsigned long __sc0 __asm__ ("gr8") = (unsigned long) filename;
-	register unsigned long __sc1 __asm__ ("gr9") = (unsigned long) argv;
-	register unsigned long __sc2 __asm__ ("gr10") = (unsigned long) envp;
-	__asm__ __volatile__ ("tira gr0,#0"
-			      : "+r" (__sc0)
-			      : "r" (__scnum), "r" (__sc1), "r" (__sc2));
-	return __sc0;
-}
diff --git a/arch/frv/kernel/kernel_execve.S b/arch/frv/kernel/kernel_execve.S
new file mode 100644
index 0000000..9b074a1
--- /dev/null
+++ b/arch/frv/kernel/kernel_execve.S
@@ -0,0 +1,33 @@
+/* in-kernel program execution
+ *
+ * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells (dhowells@redhat.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/linkage.h>
+#include <asm/unistd.h>
+
+###############################################################################
+#
+# 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[])
+#
+# On entry: GR8/GR9/GR10: arguments to function
+# On return: GR8: syscall return.
+#
+###############################################################################
+	.globl		kernel_execve
+	.type		kernel_execve,@function
+kernel_execve:
+	setlos		__NR_execve,gr7
+	tira		gr0,#0
+	bralr
+
+	.size		kernel_execve,.-kernel_execve

  parent reply	other threads:[~2006-08-29 17:22 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-27 21:47 [PATCH 0/7] kill __KERNEL_SYSCALLS__ Arnd Bergmann
2006-08-27 21:47 ` [PATCH 2/7] rename the provided execve functions to kernel_execve Arnd Bergmann
2006-08-28  2:20   ` Randy.Dunlap
2006-08-28  7:44     ` Arnd Bergmann
2006-08-27 21:47 ` [PATCH 3/7] provide kernel_execve on all architectures Arnd Bergmann
2006-08-29  2:22   ` Ralf Baechle
2006-08-29 17:21   ` David Howells [this message]
2006-08-27 21:47 ` [PATCH 4/7] Remove the use of _syscallX macros in UML Arnd Bergmann
2006-08-28  9:25   ` Andreas Schwab
2006-08-30  5:41   ` H. Peter Anvin
2006-08-30 12:38     ` Arnd Bergmann
2006-08-27 21:47 ` [PATCH 6/7] remove all remaining _syscallX macros Arnd Bergmann
2006-08-28  7:35   ` Andi Kleen
2006-08-28  7:41     ` Arnd Bergmann
2006-08-28  7:46       ` Arjan van de Ven
2006-08-28  8:09         ` Arnd Bergmann
2006-08-28  7:50       ` Andi Kleen
2006-08-28  8:01         ` Arnd Bergmann
2006-08-28  8:03           ` Andi Kleen
2006-08-28  8:09             ` David Miller
2006-08-28  8:15               ` Andi Kleen
2006-08-28  8:19                 ` David Miller
2006-08-28  8:28                   ` Andi Kleen
2006-08-28  8:40                     ` David Woodhouse
2006-08-28  8:53                       ` Andi Kleen
2006-08-28 10:00                         ` David Woodhouse
2006-08-28 10:37                           ` Arjan van de Ven
2006-08-28 10:58                             ` Andi Kleen
2006-08-28 14:05                           ` Arnd Bergmann
2006-08-28 14:42                             ` Andi Kleen
2006-08-28 15:46                               ` Adrian Bunk
2006-08-28 17:00                                 ` Andi Kleen
2006-08-30 17:45                                   ` Adrian Bunk
2006-08-28 20:20                               ` Horst H. von Brand
2006-08-28 21:23                                 ` Arnd Bergmann
2006-08-30  5:44                               ` H. Peter Anvin
2006-08-30  7:22                                 ` Andi Kleen
2006-08-27 21:47 ` [PATCH 7/7] remove the global errno from the kernel Arnd Bergmann
2006-08-29 17:23   ` David Howells
2006-08-27 22:00 ` [PATCH 5/7] sh64: remove the use of kernel syscalls Arnd Bergmann
2006-08-28  8:05   ` Paul Mundt
2006-08-27 22:01 ` [PATCH 1/7] introduce kernel_execve Arnd Bergmann
2006-08-29  9:12 ` [PATCH 0/7] kill __KERNEL_SYSCALLS__ David Howells
2006-08-29  9:37   ` Arnd Bergmann
2006-08-29  9:38   ` Haavard Skinnemoen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25403.1156872068@warthog.cambridge.redhat.com \
    --to=dhowells@redhat.com \
    --cc=B.Steinbrink@gmx.de \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=arnd@arndb.de \
    --cc=chase.venters@clientec.com \
    --cc=jdike@addtoit.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+lkml@arm.linux.org.uk \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.