Skip to content

Commit

Permalink
alpha: take kernel_execve() out of entry.S
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Al Viro authored and Linus Torvalds committed Aug 19, 2012
1 parent be53db6 commit 28d353d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 53 deletions.
1 change: 0 additions & 1 deletion arch/alpha/kernel/alpha_ksyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ EXPORT_SYMBOL(alpha_write_fp_reg_s);

/* entry.S */
EXPORT_SYMBOL(kernel_thread);
EXPORT_SYMBOL(kernel_execve);

/* Networking helper routines. */
EXPORT_SYMBOL(csum_tcpudp_magic);
Expand Down
52 changes: 0 additions & 52 deletions arch/alpha/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -663,58 +663,6 @@ kernel_thread:
br ret_to_kernel
.end kernel_thread

/*
* kernel_execve(path, argv, envp)
*/
.align 4
.globl kernel_execve
.ent kernel_execve
kernel_execve:
/* We can be called from a module. */
ldgp $gp, 0($27)
lda $sp, -(32+SIZEOF_PT_REGS+8)($sp)
.frame $sp, 32+SIZEOF_PT_REGS+8, $26, 0
stq $26, 0($sp)
stq $16, 8($sp)
stq $17, 16($sp)
stq $18, 24($sp)
.prologue 1

lda $16, 32($sp)
lda $17, 0
lda $18, SIZEOF_PT_REGS
bsr $26, memset !samegp

/* Avoid the HAE being gratuitously wrong, which would cause us
to do the whole turn off interrupts thing and restore it. */
ldq $2, alpha_mv+HAE_CACHE
stq $2, 152+32($sp)

ldq $16, 8($sp)
ldq $17, 16($sp)
ldq $18, 24($sp)
lda $19, 32($sp)
bsr $26, do_execve !samegp

ldq $26, 0($sp)
bne $0, 1f /* error! */

/* Move the temporary pt_regs struct from its current location
to the top of the kernel stack frame. See copy_thread for
details for a normal process. */
lda $16, 0x4000 - SIZEOF_PT_REGS($8)
lda $17, 32($sp)
lda $18, SIZEOF_PT_REGS
bsr $26, memmove !samegp

/* Take that over as our new stack frame and visit userland! */
lda $sp, 0x4000 - SIZEOF_PT_REGS($8)
br $31, ret_from_sys_call

1: lda $sp, 32+SIZEOF_PT_REGS+8($sp)
ret
.end kernel_execve


/*
* Special system calls. Most of these are special in that they either
Expand Down
19 changes: 19 additions & 0 deletions arch/alpha/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,3 +455,22 @@ get_wchan(struct task_struct *p)
}
return pc;
}

int kernel_execve(const char *path, const char *const argv[], const char *const envp[])
{
/* Avoid the HAE being gratuitously wrong, which would cause us
to do the whole turn off interrupts thing and restore it. */
struct pt_regs regs = {.hae = alpha_mv.hae_cache};
int err = do_execve(path, argv, envp, &regs);
if (!err) {
struct pt_regs *p = current_pt_regs();
/* copy regs to normal position and off to userland we go... */
*p = regs;
__asm__ __volatile__ (
"mov %0, $sp;"
"br $31, ret_from_sys_call"
: : "r"(p));
}
return err;
}
EXPORT_SYMBOL(kernel_execve);

0 comments on commit 28d353d

Please sign in to comment.