[PATCH 1/2] c6x: implement ret_from_kernel_execve() and switch to generic kernel_execve()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Mark Salter <msalter@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux