crt0.S 928 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (C) Paul Mackerras 1997.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. *
  9. * NOTE: this code runs in 32 bit mode and is packaged as ELF32.
  10. */
  11. #include "ppc_asm.h"
  12. .text
  13. .globl _zimage_start
  14. _zimage_start:
  15. bl 1f
  16. 1:
  17. mflr r0
  18. lis r9,1b@ha
  19. addi r9,r9,1b@l
  20. subf. r0,r9,r0
  21. beq 3f
  22. lis r9,__got2_start@ha
  23. addi r9,r9,__got2_start@l
  24. lis r8,__got2_end@ha
  25. addi r8,r8,__got2_end@l
  26. subf. r8,r9,r8
  27. beq 3f
  28. srwi. r8,r8,2
  29. mtctr r8
  30. add r9,r0,r9
  31. 2:
  32. lwz r8,0(r9)
  33. add r8,r8,r0
  34. stw r8,0(r9)
  35. addi r9,r9,4
  36. bdnz 2b
  37. 3:
  38. lis r9,_start@h
  39. add r9,r0,r9
  40. lis r8,_etext@ha
  41. addi r8,r8,_etext@l
  42. add r8,r0,r8
  43. 4: dcbf r0,r9
  44. icbi r0,r9
  45. addi r9,r9,0x20
  46. cmplwi 0,r9,8
  47. blt 4b
  48. sync
  49. isync
  50. mr r6,r1
  51. b start