Skip to content

Commit 28d353d

Browse files
Al Virotorvalds
authored andcommitted
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>
1 parent be53db6 commit 28d353d

3 files changed

Lines changed: 19 additions & 53 deletions

File tree

‎arch/alpha/kernel/alpha_ksyms.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ EXPORT_SYMBOL(alpha_write_fp_reg_s);
5252

5353
/* entry.S */
5454
EXPORT_SYMBOL(kernel_thread);
55-
EXPORT_SYMBOL(kernel_execve);
5655

5756
/* Networking helper routines. */
5857
EXPORT_SYMBOL(csum_tcpudp_magic);

‎arch/alpha/kernel/entry.S‎

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -663,58 +663,6 @@ kernel_thread:
663663
br ret_to_kernel
664664
.end kernel_thread
665665

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

719667
/*
720668
* Special system calls. Most of these are special in that they either

‎arch/alpha/kernel/process.c‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,3 +455,22 @@ get_wchan(struct task_struct *p)
455455
}
456456
return pc;
457457
}
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, &regs);
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);

0 commit comments

Comments
 (0)