relocate_kernel.S 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * relocate_kernel.S - put the kernel image in place to boot
  3. */
  4. #include <asm/kexec.h>
  5. .globl relocate_new_kernel
  6. relocate_new_kernel:
  7. ldr r0,kexec_indirection_page
  8. ldr r1,kexec_start_address
  9. 0: /* top, read another word for the indirection page */
  10. ldr r3, [r0],#4
  11. /* Is it a destination page. Put destination address to r4 */
  12. tst r3,#1,0
  13. beq 1f
  14. bic r4,r3,#1
  15. b 0b
  16. 1:
  17. /* Is it an indirection page */
  18. tst r3,#2,0
  19. beq 1f
  20. bic r0,r3,#2
  21. b 0b
  22. 1:
  23. /* are we done ? */
  24. tst r3,#4,0
  25. beq 1f
  26. b 2f
  27. 1:
  28. /* is it source ? */
  29. tst r3,#8,0
  30. beq 0b
  31. bic r3,r3,#8
  32. mov r6,#1024
  33. 9:
  34. ldr r5,[r3],#4
  35. str r5,[r4],#4
  36. subs r6,r6,#1
  37. bne 9b
  38. b 0b
  39. 2:
  40. /* Jump to relocated kernel */
  41. mov lr,r1
  42. mov r0,#0
  43. ldr r1,kexec_mach_type
  44. mov r2,#0
  45. mov pc,lr
  46. .globl kexec_start_address
  47. kexec_start_address:
  48. .long 0x0
  49. .globl kexec_indirection_page
  50. kexec_indirection_page:
  51. .long 0x0
  52. .globl kexec_mach_type
  53. kexec_mach_type:
  54. .long 0x0
  55. relocate_new_kernel_end:
  56. .globl relocate_new_kernel_size
  57. relocate_new_kernel_size:
  58. .long relocate_new_kernel_end - relocate_new_kernel