misc.S 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * This file contains miscellaneous low-level functions.
  3. * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
  4. *
  5. * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
  6. * and Paul Mackerras.
  7. *
  8. * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
  9. * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * as published by the Free Software Foundation; either version
  14. * 2 of the License, or (at your option) any later version.
  15. */
  16. #include <asm/ppc_asm.h>
  17. #include <asm/unistd.h>
  18. .text
  19. /*
  20. * Returns (address we are running at) - (address we were linked at)
  21. * for use before the text and data are mapped to KERNELBASE.
  22. */
  23. _GLOBAL(reloc_offset)
  24. mflr r0
  25. bl 1f
  26. 1: mflr r3
  27. LOAD_REG_IMMEDIATE(r4,1b)
  28. subf r3,r4,r3
  29. mtlr r0
  30. blr
  31. /*
  32. * add_reloc_offset(x) returns x + reloc_offset().
  33. */
  34. _GLOBAL(add_reloc_offset)
  35. mflr r0
  36. bl 1f
  37. 1: mflr r5
  38. LOAD_REG_IMMEDIATE(r4,1b)
  39. subf r5,r4,r5
  40. add r3,r3,r5
  41. mtlr r0
  42. blr
  43. _GLOBAL(kernel_execve)
  44. li r0,__NR_execve
  45. sc
  46. bnslr
  47. neg r3,r3
  48. blr