Commit 99c59f60 authored by Al Viro's avatar Al Viro Committed by Michal Simek

microblaze: switch to generic kernel_execve()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarMichal Simek <michal.simek@xilinx.com>
parent 2319295d
...@@ -27,6 +27,7 @@ config MICROBLAZE ...@@ -27,6 +27,7 @@ config MICROBLAZE
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select MODULES_USE_ELF_RELA select MODULES_USE_ELF_RELA
select GENERIC_KERNEL_THREAD select GENERIC_KERNEL_THREAD
select GENERIC_KERNEL_EXECVE
config SWAP config SWAP
def_bool n def_bool n
......
...@@ -479,8 +479,8 @@ ENTRY(ret_from_kernel_thread) ...@@ -479,8 +479,8 @@ ENTRY(ret_from_kernel_thread)
addk r5, r0, r3 addk r5, r0, r3
brald r15, r20 brald r15, r20
addk r5, r0, r19 addk r5, r0, r19
brid sys_exit /* won't be returning... */ brid ret_to_user
addk r5, r0, r0 addk r3, r0, r0
work_pending: work_pending:
enable_irq enable_irq
......
...@@ -293,24 +293,6 @@ C_ENTRY(_user_exception): ...@@ -293,24 +293,6 @@ C_ENTRY(_user_exception):
swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */ swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */
addi r14, r14, 4 /* return address is 4 byte after call */ 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 */ lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */
tophys(r1,r1); tophys(r1,r1);
lwi r1, r1, TS_THREAD_INFO; /* get stack from task_struct */ lwi r1, r1, TS_THREAD_INFO; /* get stack from task_struct */
...@@ -490,8 +472,8 @@ C_ENTRY(ret_from_kernel_thread): ...@@ -490,8 +472,8 @@ C_ENTRY(ret_from_kernel_thread):
/* ( in the delay slot ) */ /* ( in the delay slot ) */
brald r15, r20 /* fn was left in r20 */ brald r15, r20 /* fn was left in r20 */
addk r5, r0, r19 /* ... and argument - in r19 */ addk r5, r0, r19 /* ... and argument - in r19 */
brid sys_exit /* won't be returning... */ brid ret_from_trap
addk r5, r0, r0 add r3, r0, r0
C_ENTRY(sys_vfork): C_ENTRY(sys_vfork):
brid microblaze_vfork /* Do real work (tail-call) */ brid microblaze_vfork /* Do real work (tail-call) */
......
...@@ -215,6 +215,7 @@ void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp) ...@@ -215,6 +215,7 @@ void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp)
regs->pt_mode = 0; regs->pt_mode = 0;
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
regs->msr |= MSR_UMS; regs->msr |= MSR_UMS;
regs->msr &= ~MSR_VM;
#endif #endif
} }
......
...@@ -75,24 +75,3 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len, ...@@ -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); 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;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment