relocator_asm.S 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2009,2010 Free Software Foundation, Inc.
  4. *
  5. * GRUB is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * GRUB is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include <grub/symbol.h>
  19. .p2align 4 /* force 16-byte alignment */
  20. VARIABLE (grub_relocator_forward_start)
  21. mr 3, 9
  22. mr 4, 10
  23. copycont1:
  24. lbz 11,0(8)
  25. stb 11,0(9)
  26. addi 8, 8, 0x1
  27. addi 9, 9, 0x1
  28. addi 10, 10, -1
  29. cmpwi 10, 0
  30. bne copycont1
  31. #include "../../kern/powerpc/cache_flush.S"
  32. VARIABLE (grub_relocator_forward_end)
  33. VARIABLE (grub_relocator_backward_start)
  34. mr 3, 9
  35. mr 4, 10
  36. add 9, 9, 10
  37. add 8, 8, 10
  38. /* Backward movsl is implicitly off-by-one. compensate that. */
  39. addi 9, 9, -1
  40. addi 8, 8, -1
  41. copycont2:
  42. lbz 11,0(8)
  43. stb 11,0(9)
  44. addi 8, 8, -1
  45. addi 9, 9, -1
  46. addi 10, 10, -1
  47. cmpwi 10, 0
  48. bne copycont2
  49. #include "../../kern/powerpc/cache_flush.S"
  50. VARIABLE (grub_relocator_backward_end)