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>
This commit is contained in:
Al Viro 2012-10-10 11:52:44 -04:00 committed by Michal Simek
parent 2319295dd8
commit 99c59f60fd
5 changed files with 6 additions and 43 deletions

View File

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

View File

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

View File

@ -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) */

View File

@ -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
}

View File

@ -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;
}