head_32.S 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * linux/arch/sh/boot/compressed/head.S
  4. *
  5. * Copyright (C) 1999 Stuart Menefy
  6. * Copyright (C) 2003 SUGIOKA Toshinobu
  7. */
  8. .text
  9. #include <asm/page.h>
  10. .global startup
  11. startup:
  12. /* Load initial status register */
  13. mov.l init_sr, r1
  14. ldc r1, sr
  15. /* Move myself to proper location if necessary */
  16. mova 1f, r0
  17. mov.l 1f, r2
  18. cmp/eq r2, r0
  19. bt clear_bss
  20. sub r0, r2
  21. mov.l bss_start_addr, r0
  22. mov #0xffffffe0, r1
  23. and r1, r0 ! align cache line
  24. mov.l text_start_addr, r3
  25. mov r0, r1
  26. sub r2, r1
  27. 3:
  28. mov.l @r1, r4
  29. mov.l @(4,r1), r5
  30. mov.l @(8,r1), r6
  31. mov.l @(12,r1), r7
  32. mov.l @(16,r1), r8
  33. mov.l @(20,r1), r9
  34. mov.l @(24,r1), r10
  35. mov.l @(28,r1), r11
  36. mov.l r4, @r0
  37. mov.l r5, @(4,r0)
  38. mov.l r6, @(8,r0)
  39. mov.l r7, @(12,r0)
  40. mov.l r8, @(16,r0)
  41. mov.l r9, @(20,r0)
  42. mov.l r10, @(24,r0)
  43. mov.l r11, @(28,r0)
  44. #ifdef CONFIG_CPU_SH4
  45. ocbwb @r0
  46. #endif
  47. cmp/hi r3, r0
  48. add #-32, r0
  49. bt/s 3b
  50. add #-32, r1
  51. mov.l 2f, r0
  52. jmp @r0
  53. nop
  54. .align 2
  55. 1: .long 1b
  56. 2: .long clear_bss
  57. text_start_addr:
  58. .long startup
  59. /* Clear BSS */
  60. clear_bss:
  61. mov.l end_addr, r1
  62. mov.l bss_start_addr, r2
  63. mov #0, r0
  64. l1:
  65. mov.l r0, @-r1
  66. cmp/eq r1,r2
  67. bf l1
  68. /* Set the initial pointer. */
  69. mov.l init_stack_addr, r0
  70. mov.l @r0, r15
  71. /* Decompress the kernel */
  72. mov.l decompress_kernel_addr, r0
  73. jsr @r0
  74. nop
  75. /* Jump to the start of the decompressed kernel */
  76. mov.l kernel_start_addr, r0
  77. jmp @r0
  78. nop
  79. .align 2
  80. bss_start_addr:
  81. .long __bss_start
  82. end_addr:
  83. .long _end
  84. init_sr:
  85. .long 0x500000F0 /* Privileged mode, Bank=0, Block=1, IMASK=0xF */
  86. kexec_magic:
  87. .long 0x400000F0 /* magic used by kexec to parse zImage format */
  88. init_stack_addr:
  89. .long stack_start
  90. decompress_kernel_addr:
  91. .long decompress_kernel
  92. kernel_start_addr:
  93. #ifdef CONFIG_32BIT
  94. .long ___pa(_text+PAGE_SIZE)
  95. #else
  96. .long _text+PAGE_SIZE
  97. #endif
  98. .align 9
  99. fake_headers_as_bzImage:
  100. .word 0
  101. .ascii "HdrS" ! header signature
  102. .word 0x0202 ! header version number (>= 0x0105)
  103. ! or else old loadlin-1.5 will fail)
  104. .word 0 ! default_switch
  105. .word 0 ! SETUPSEG
  106. .word 0x1000
  107. .word 0 ! pointing to kernel version string
  108. .byte 0 ! = 0, old one (LILO, Loadlin,
  109. ! 0xTV: T=0 for LILO
  110. ! V = version
  111. .byte 1 ! Load flags bzImage=1
  112. .word 0x8000 ! size to move, when setup is not
  113. .long 0x100000 ! 0x100000 = default for big kernel
  114. .long 0 ! address of loaded ramdisk image
  115. .long 0 # its size in bytes