misc.S 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. .text
  18. /*
  19. * Returns (address we are running at) - (address we were linked at)
  20. * for use before the text and data are mapped to KERNELBASE.
  21. */
  22. _GLOBAL(reloc_offset)
  23. mflr r0
  24. bl 1f
  25. 1: mflr r3
  26. LOAD_REG_IMMEDIATE(r4,1b)
  27. subf r3,r4,r3
  28. mtlr r0
  29. blr
  30. /*
  31. * add_reloc_offset(x) returns x + reloc_offset().
  32. */
  33. _GLOBAL(add_reloc_offset)
  34. mflr r0
  35. bl 1f
  36. 1: mflr r5
  37. LOAD_REG_IMMEDIATE(r4,1b)
  38. subf r5,r4,r5
  39. add r3,r3,r5
  40. mtlr r0
  41. blr