kernel_execve.S 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* MN10300 In-kernel program execution
  2. *
  3. * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #include <linux/linkage.h>
  12. #include <asm/unistd.h>
  13. ###############################################################################
  14. #
  15. # Do a system call from kernel instead of calling sys_execve so we end up with
  16. # proper pt_regs.
  17. #
  18. # int kernel_execve(const char *filename, char *const argv[],
  19. # char *const envp[])
  20. #
  21. # On entry: D0/D1/8(SP): arguments to function
  22. # On return: D0: syscall return.
  23. #
  24. ###############################################################################
  25. .globl kernel_execve
  26. .type kernel_execve,@function
  27. kernel_execve:
  28. mov a3,a1
  29. mov d0,a0
  30. mov (12,sp),a3
  31. mov +__NR_execve,d0
  32. syscall 0
  33. mov a1,a3
  34. rets
  35. .size kernel_execve,.-kernel_execve