aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-10-10 11:52:44 -0400
committerMichal Simek <michal.simek@xilinx.com>2012-11-16 02:45:47 -0500
commit99c59f60fd751876c37fbea01e55606441ac6db4 (patch)
tree20acbb5f052686052c62a315eb0e25e926b0d2c0 /arch
parent2319295dd8dbd076afa136bffb797ef726b605a0 (diff)
microblaze: switch to generic kernel_execve()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/microblaze/Kconfig1
-rw-r--r--arch/microblaze/kernel/entry-nommu.S4
-rw-r--r--arch/microblaze/kernel/entry.S22
-rw-r--r--arch/microblaze/kernel/process.c1
-rw-r--r--arch/microblaze/kernel/sys_microblaze.c21
5 files changed, 6 insertions, 43 deletions
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 3b8df669eecd..198abf6d41c4 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -27,6 +27,7 @@ config MICROBLAZE
27 select GENERIC_CLOCKEVENTS 27 select GENERIC_CLOCKEVENTS
28 select MODULES_USE_ELF_RELA 28 select MODULES_USE_ELF_RELA
29 select GENERIC_KERNEL_THREAD 29 select GENERIC_KERNEL_THREAD
30 select GENERIC_KERNEL_EXECVE
30 31
31config SWAP 32config SWAP
32 def_bool n 33 def_bool n
diff --git a/arch/microblaze/kernel/entry-nommu.S b/arch/microblaze/kernel/entry-nommu.S
index c47e92cd7e78..8957c7760c47 100644
--- a/arch/microblaze/kernel/entry-nommu.S
+++ b/arch/microblaze/kernel/entry-nommu.S
@@ -479,8 +479,8 @@ ENTRY(ret_from_kernel_thread)
479 addk r5, r0, r3 479 addk r5, r0, r3
480 brald r15, r20 480 brald r15, r20
481 addk r5, r0, r19 481 addk r5, r0, r19
482 brid sys_exit /* won't be returning... */ 482 brid ret_to_user
483 addk r5, r0, r0 483 addk r3, r0, r0
484 484
485work_pending: 485work_pending:
486 enable_irq 486 enable_irq
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S
index be76d1338be0..9aa54def9985 100644
--- a/arch/microblaze/kernel/entry.S
+++ b/arch/microblaze/kernel/entry.S
@@ -293,24 +293,6 @@ C_ENTRY(_user_exception):
293 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */ 293 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */
294 addi r14, r14, 4 /* return address is 4 byte after call */ 294 addi r14, r14, 4 /* return address is 4 byte after call */
295 295
296 mfs r1, rmsr
297 nop
298 andi r1, r1, MSR_UMS
299 bnei r1, 1f
300
301/* Kernel-mode state save - kernel execve */
302 lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/
303 tophys(r1,r1);
304
305 addik r1, r1, -PT_SIZE; /* Make room on the stack. */
306 SAVE_REGS
307
308 swi r1, r1, PT_MODE; /* pt_regs -> kernel mode */
309 brid 2f;
310 nop; /* Fill delay slot */
311
312/* User-mode state save. */
3131:
314 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */ 296 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */
315 tophys(r1,r1); 297 tophys(r1,r1);
316 lwi r1, r1, TS_THREAD_INFO; /* get stack from task_struct */ 298 lwi r1, r1, TS_THREAD_INFO; /* get stack from task_struct */
@@ -490,8 +472,8 @@ C_ENTRY(ret_from_kernel_thread):
490 /* ( in the delay slot ) */ 472 /* ( in the delay slot ) */
491 brald r15, r20 /* fn was left in r20 */ 473 brald r15, r20 /* fn was left in r20 */
492 addk r5, r0, r19 /* ... and argument - in r19 */ 474 addk r5, r0, r19 /* ... and argument - in r19 */
493 brid sys_exit /* won't be returning... */ 475 brid ret_from_trap
494 addk r5, r0, r0 476 add r3, r0, r0
495 477
496C_ENTRY(sys_vfork): 478C_ENTRY(sys_vfork):
497 brid microblaze_vfork /* Do real work (tail-call) */ 479 brid microblaze_vfork /* Do real work (tail-call) */
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
index cbf8bb92f159..29768c3dc358 100644
--- a/arch/microblaze/kernel/process.c
+++ b/arch/microblaze/kernel/process.c
@@ -215,6 +215,7 @@ void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp)
215 regs->pt_mode = 0; 215 regs->pt_mode = 0;
216#ifdef CONFIG_MMU 216#ifdef CONFIG_MMU
217 regs->msr |= MSR_UMS; 217 regs->msr |= MSR_UMS;
218 regs->msr &= ~MSR_VM;
218#endif 219#endif
219} 220}
220 221
diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c
index 404c0f24bd41..b200ee7d1da9 100644
--- a/arch/microblaze/kernel/sys_microblaze.c
+++ b/arch/microblaze/kernel/sys_microblaze.c
@@ -75,24 +75,3 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
75 75
76 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT); 76 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
77} 77}
78
79/*
80 * Do a system call from kernel instead of calling sys_execve so we
81 * end up with proper pt_regs.
82 */
83int kernel_execve(const char *filename,
84 const char *const argv[],
85 const char *const envp[])
86{
87 register const char *__a __asm__("r5") = filename;
88 register const void *__b __asm__("r6") = argv;
89 register const void *__c __asm__("r7") = envp;
90 register unsigned long __syscall __asm__("r12") = __NR_execve;
91 register unsigned long __ret __asm__("r3");
92 __asm__ __volatile__ ("brki r14, 0x8"
93 : "=r" (__ret), "=r" (__syscall)
94 : "1" (__syscall), "r" (__a), "r" (__b), "r" (__c)
95 : "r4", "r8", "r9",
96 "r10", "r11", "r14", "cc", "memory");
97 return __ret;
98}