diff options
author | Al Viro <viro@ZenIV.linux.org.uk> | 2012-08-18 22:41:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-08-19 11:41:19 -0400 |
commit | 28d353d9891c28496e366bebe4e65233f59ad1f6 (patch) | |
tree | 814900bf40b5e24c4b50396c4df22058fc951c60 /arch/alpha/kernel | |
parent | be53db6e4edd9dc013b21a929ad2b142dea8b9c0 (diff) |
alpha: take kernel_execve() out of entry.S
Signed-off-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Michael Cree <mcree@orcon.net.nz>
Acked-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/alpha/kernel')
-rw-r--r-- | arch/alpha/kernel/alpha_ksyms.c | 1 | ||||
-rw-r--r-- | arch/alpha/kernel/entry.S | 52 | ||||
-rw-r--r-- | arch/alpha/kernel/process.c | 19 |
3 files changed, 19 insertions, 53 deletions
diff --git a/arch/alpha/kernel/alpha_ksyms.c b/arch/alpha/kernel/alpha_ksyms.c index a354277bbaa7..15fa821d09cd 100644 --- a/arch/alpha/kernel/alpha_ksyms.c +++ b/arch/alpha/kernel/alpha_ksyms.c | |||
@@ -52,7 +52,6 @@ EXPORT_SYMBOL(alpha_write_fp_reg_s); | |||
52 | 52 | ||
53 | /* entry.S */ | 53 | /* entry.S */ |
54 | EXPORT_SYMBOL(kernel_thread); | 54 | EXPORT_SYMBOL(kernel_thread); |
55 | EXPORT_SYMBOL(kernel_execve); | ||
56 | 55 | ||
57 | /* Networking helper routines. */ | 56 | /* Networking helper routines. */ |
58 | EXPORT_SYMBOL(csum_tcpudp_magic); | 57 | EXPORT_SYMBOL(csum_tcpudp_magic); |
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S index 22b0c4d414a7..ec0da0567ab5 100644 --- a/arch/alpha/kernel/entry.S +++ b/arch/alpha/kernel/entry.S | |||
@@ -663,58 +663,6 @@ kernel_thread: | |||
663 | br ret_to_kernel | 663 | br ret_to_kernel |
664 | .end kernel_thread | 664 | .end kernel_thread |
665 | 665 | ||
666 | /* | ||
667 | * kernel_execve(path, argv, envp) | ||
668 | */ | ||
669 | .align 4 | ||
670 | .globl kernel_execve | ||
671 | .ent kernel_execve | ||
672 | kernel_execve: | ||
673 | /* We can be called from a module. */ | ||
674 | ldgp $gp, 0($27) | ||
675 | lda $sp, -(32+SIZEOF_PT_REGS+8)($sp) | ||
676 | .frame $sp, 32+SIZEOF_PT_REGS+8, $26, 0 | ||
677 | stq $26, 0($sp) | ||
678 | stq $16, 8($sp) | ||
679 | stq $17, 16($sp) | ||
680 | stq $18, 24($sp) | ||
681 | .prologue 1 | ||
682 | |||
683 | lda $16, 32($sp) | ||
684 | lda $17, 0 | ||
685 | lda $18, SIZEOF_PT_REGS | ||
686 | bsr $26, memset !samegp | ||
687 | |||
688 | /* Avoid the HAE being gratuitously wrong, which would cause us | ||
689 | to do the whole turn off interrupts thing and restore it. */ | ||
690 | ldq $2, alpha_mv+HAE_CACHE | ||
691 | stq $2, 152+32($sp) | ||
692 | |||
693 | ldq $16, 8($sp) | ||
694 | ldq $17, 16($sp) | ||
695 | ldq $18, 24($sp) | ||
696 | lda $19, 32($sp) | ||
697 | bsr $26, do_execve !samegp | ||
698 | |||
699 | ldq $26, 0($sp) | ||
700 | bne $0, 1f /* error! */ | ||
701 | |||
702 | /* Move the temporary pt_regs struct from its current location | ||
703 | to the top of the kernel stack frame. See copy_thread for | ||
704 | details for a normal process. */ | ||
705 | lda $16, 0x4000 - SIZEOF_PT_REGS($8) | ||
706 | lda $17, 32($sp) | ||
707 | lda $18, SIZEOF_PT_REGS | ||
708 | bsr $26, memmove !samegp | ||
709 | |||
710 | /* Take that over as our new stack frame and visit userland! */ | ||
711 | lda $sp, 0x4000 - SIZEOF_PT_REGS($8) | ||
712 | br $31, ret_from_sys_call | ||
713 | |||
714 | 1: lda $sp, 32+SIZEOF_PT_REGS+8($sp) | ||
715 | ret | ||
716 | .end kernel_execve | ||
717 | |||
718 | 666 | ||
719 | /* | 667 | /* |
720 | * Special system calls. Most of these are special in that they either | 668 | * Special system calls. Most of these are special in that they either |
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index 153d3fce3e8e..d6fde98b74b3 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c | |||
@@ -455,3 +455,22 @@ get_wchan(struct task_struct *p) | |||
455 | } | 455 | } |
456 | return pc; | 456 | return pc; |
457 | } | 457 | } |
458 | |||
459 | int kernel_execve(const char *path, const char *const argv[], const char *const envp[]) | ||
460 | { | ||
461 | /* Avoid the HAE being gratuitously wrong, which would cause us | ||
462 | to do the whole turn off interrupts thing and restore it. */ | ||
463 | struct pt_regs regs = {.hae = alpha_mv.hae_cache}; | ||
464 | int err = do_execve(path, argv, envp, ®s); | ||
465 | if (!err) { | ||
466 | struct pt_regs *p = current_pt_regs(); | ||
467 | /* copy regs to normal position and off to userland we go... */ | ||
468 | *p = regs; | ||
469 | __asm__ __volatile__ ( | ||
470 | "mov %0, $sp;" | ||
471 | "br $31, ret_from_sys_call" | ||
472 | : : "r"(p)); | ||
473 | } | ||
474 | return err; | ||
475 | } | ||
476 | EXPORT_SYMBOL(kernel_execve); | ||