linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Salter <msalter@redhat.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	Mark Salter <msalter@redhat.com>
Subject: [PATCH 1/2] c6x: implement ret_from_kernel_execve() and switch to generic kernel_execve()
Date: Mon, 10 Sep 2012 18:20:02 -0400	[thread overview]
Message-ID: <1347315603-30027-2-git-send-email-msalter@redhat.com> (raw)
In-Reply-To: <1347315603-30027-1-git-send-email-msalter@redhat.com>

Signed-off-by: Mark Salter <msalter@redhat.com>
---
 arch/c6x/include/asm/unistd.h |    2 ++
 arch/c6x/kernel/entry.S       |   31 ++++++++++++++++++++++++-------
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/arch/c6x/include/asm/unistd.h b/arch/c6x/include/asm/unistd.h
index 6d54ea4..1ce3a6f 100644
--- a/arch/c6x/include/asm/unistd.h
+++ b/arch/c6x/include/asm/unistd.h
@@ -16,6 +16,8 @@
 #if !defined(_ASM_C6X_UNISTD_H) || defined(__SYSCALL)
 #define _ASM_C6X_UNISTD_H
 
+#define __ARCH_WANT_KERNEL_EXECVE
+
 /* Use the standard ABI for syscalls. */
 #include <asm-generic/unistd.h>
 
diff --git a/arch/c6x/kernel/entry.S b/arch/c6x/kernel/entry.S
index 30b37e5..693002b 100644
--- a/arch/c6x/kernel/entry.S
+++ b/arch/c6x/kernel/entry.S
@@ -315,6 +315,30 @@ resume_userspace:
  [A0]	BNOP	.S1	work_pending,5
 	BNOP	.S1	restore_all,5
 
+	;; extern void ret_from_kernel_execve(struct pt_regs *normal,
+	;; 				      struct pt_regs *new)
+	;;
+	;; Copy new regs to normal regs.
+	;; Switch stack to normal regs and return to userspace.
+	;;
+ENTRY(ret_from_kernel_execve)
+#ifdef CONFIG_C6X_BIG_KERNEL
+	MVKL	.S2	memmove,B0
+	MVKH	.S2	memmove,B0
+	B	.S2	B0
+#else
+	B	.S2	memmove
+#endif
+	ADDKPC	.S2	0f,B3,2
+	MVK	.S1	REGS__END,A6	; sizeof(struct pt_regs)
+	SUB	.L2X	A4,8,B10	; save new SP in callee-saved reg
+0:
+	BNOP	.S2	resume_userspace,2
+	MV	.S2	B10,SP			; switch stack
+	MVK	.L2	0,B1
+	STW	.D2T2	B1,*+SP(REGS__END+8)	; clear syscall flag
+ENDPROC(ret_from_kernel_execve)
+
 	;;
 	;; System call handling
 	;; B0 = syscall number (in sys_call_table)
@@ -593,13 +617,6 @@ ENTRY(sys_sigaltstack)
 	NOP	4
 ENDPROC(sys_sigaltstack)
 
-	;; kernel_execve
-ENTRY(kernel_execve)
-	MVK	.S2	__NR_execve,B0
-	SWE
-	BNOP	.S2	B3,5
-ENDPROC(kernel_execve)
-
 	;;
 	;; Special system calls
 	;; return address is in B3
-- 
1.7.9.1

  reply	other threads:[~2012-09-10 22:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-07 18:20 [RFC] status of execve() work - per-architecture patches solicited Al Viro
2012-09-07 18:20 ` Al Viro
2012-09-07 18:22 ` Al Viro
2012-09-10 13:40 ` Greg Ungerer
2012-09-10 16:49   ` Al Viro
2012-09-11  3:39     ` Greg Ungerer
2012-09-13 13:27     ` Greg Ungerer
2012-09-10 22:20 ` Mark Salter
2012-09-10 22:20   ` Mark Salter [this message]
2012-09-10 22:20     ` [PATCH 1/2] c6x: implement ret_from_kernel_execve() and switch to generic kernel_execve() Mark Salter
2012-09-10 22:20   ` [PATCH 2/2] c6x: switch to generic sys_execve() Mark Salter
2012-09-17  3:26   ` [RFC] status of execve() work - per-architecture patches solicited Al Viro
2012-09-21 16:26     ` Mark Salter
2012-09-21 16:26       ` [PATCH 1/3] c6x: add ret_from_kernel_thread(), simplify kernel_thread() Mark Salter
2012-09-21 16:26         ` Mark Salter
2012-09-21 16:26       ` [PATCH 2/3] c6x: switch to generic kernel_execve Mark Salter
2012-09-21 16:26         ` Mark Salter
2012-09-21 16:26       ` [PATCH 3/3] c6x: switch to generic sys_execve Mark Salter
2012-09-21 16:26         ` Mark Salter
2012-09-21 18:39       ` [RFC] status of execve() work - per-architecture patches solicited Al Viro
2012-09-22 11:16         ` Greg Ungerer
2012-09-23  0:46           ` Al Viro
2012-09-23  0:46             ` Al Viro
2012-09-24 10:59             ` Vineet Gupta
2012-09-17  9:29 ` Michal Simek
2012-09-17  9:29   ` Michal Simek
2012-09-17 22:57   ` Al Viro
2012-09-19 12:20 ` Vineet Gupta
2012-09-19 13:32   ` Al Viro

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=1347315603-30027-2-git-send-email-msalter@redhat.com \
    --to=msalter@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).