diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-10 11:52:44 -0400 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2012-11-16 08:45:47 +0100 |
commit | 99c59f60fd751876c37fbea01e55606441ac6db4 (patch) | |
tree | 20acbb5f052686052c62a315eb0e25e926b0d2c0 /arch/microblaze | |
parent | 2319295dd8dbd076afa136bffb797ef726b605a0 (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/microblaze')
-rw-r--r-- | arch/microblaze/Kconfig | 1 | ||||
-rw-r--r-- | arch/microblaze/kernel/entry-nommu.S | 4 | ||||
-rw-r--r-- | arch/microblaze/kernel/entry.S | 22 | ||||
-rw-r--r-- | arch/microblaze/kernel/process.c | 1 | ||||
-rw-r--r-- | arch/microblaze/kernel/sys_microblaze.c | 21 |
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 select GENERIC_CLOCKEVENTS select MODULES_USE_ELF_RELA select GENERIC_KERNEL_THREAD + select GENERIC_KERNEL_EXECVE config SWAP 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) addk r5, r0, r3 brald r15, r20 addk r5, r0, r19 - brid sys_exit /* won't be returning... */ - addk r5, r0, r0 + brid ret_to_user + addk r3, r0, r0 work_pending: 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): swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */ addi r14, r14, 4 /* return address is 4 byte after call */ - mfs r1, rmsr - nop - andi r1, r1, MSR_UMS - bnei r1, 1f - -/* Kernel-mode state save - kernel execve */ - lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/ - tophys(r1,r1); - - addik r1, r1, -PT_SIZE; /* Make room on the stack. */ - SAVE_REGS - - swi r1, r1, PT_MODE; /* pt_regs -> kernel mode */ - brid 2f; - nop; /* Fill delay slot */ - -/* User-mode state save. */ -1: lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */ tophys(r1,r1); lwi r1, r1, TS_THREAD_INFO; /* get stack from task_struct */ @@ -490,8 +472,8 @@ C_ENTRY(ret_from_kernel_thread): /* ( in the delay slot ) */ brald r15, r20 /* fn was left in r20 */ addk r5, r0, r19 /* ... and argument - in r19 */ - brid sys_exit /* won't be returning... */ - addk r5, r0, r0 + brid ret_from_trap + add r3, r0, r0 C_ENTRY(sys_vfork): 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) regs->pt_mode = 0; #ifdef CONFIG_MMU regs->msr |= MSR_UMS; + regs->msr &= ~MSR_VM; #endif } 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, return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT); } - -/* - * 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, - const char *const argv[], - const char *const envp[]) -{ - register const char *__a __asm__("r5") = filename; - register const void *__b __asm__("r6") = argv; - register const void *__c __asm__("r7") = envp; - register unsigned long __syscall __asm__("r12") = __NR_execve; - register unsigned long __ret __asm__("r3"); - __asm__ __volatile__ ("brki r14, 0x8" - : "=r" (__ret), "=r" (__syscall) - : "1" (__syscall), "r" (__a), "r" (__b), "r" (__c) - : "r4", "r8", "r9", - "r10", "r11", "r14", "cc", "memory"); - return __ret; -} |