start.S 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2016 Vladimir Zapolskiy <vz@mleia.com>
  4. * Copyright (C) 2007, 2010 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  5. */
  6. #include <asm-offsets.h>
  7. #include <config.h>
  8. .text
  9. .align 2
  10. .global _start
  11. _start:
  12. mov.l ._lowlevel_init, r0
  13. 100: bsrf r0
  14. nop
  15. bsr 1f
  16. nop
  17. 1: sts pr, r5
  18. mov.l ._reloc_dst, r4
  19. add #(_start-1b), r5
  20. mov.l ._reloc_dst_end, r6
  21. #ifdef CONFIG_OF_SEPARATE
  22. mov.l ._reloc_size, r0
  23. add r5, r0
  24. add #4, r0
  25. mov.l @r0, r0
  26. swap.b r0, r0
  27. swap.w r0, r0
  28. swap.b r0, r0
  29. add #4, r0
  30. add r0, r6
  31. #endif
  32. 2: mov.l @r5+, r1
  33. mov.l r1, @r4
  34. add #4, r4
  35. cmp/hs r6, r4
  36. bf 2b
  37. #ifndef CONFIG_OF_SEPARATE
  38. mov.l ._bss_start, r4
  39. mov.l ._bss_end, r5
  40. mov #0, r1
  41. 3: mov.l r1, @r4 /* bss clear */
  42. add #4, r4
  43. cmp/hs r5, r4
  44. bf 3b
  45. #endif
  46. mov.l ._gd_init, r13 /* global data */
  47. mov.l ._stack_init, r15 /* stack */
  48. #if CONFIG_VAL(SYS_MALLOC_F_LEN)
  49. mov.l ._gd_malloc_base, r14
  50. mov.l r15, @r14
  51. #endif
  52. mov.l ._sh_generic_init, r0
  53. jsr @r0
  54. mov #0, r4
  55. loop:
  56. bra loop
  57. .align 2
  58. ._lowlevel_init: .long (lowlevel_init - (100b + 4))
  59. ._reloc_dst: .long _start
  60. ._reloc_dst_end: .long reloc_dst_end
  61. ._reloc_size: .long (_end - _start)
  62. ._bss_start: .long bss_start
  63. ._bss_end: .long bss_end
  64. ._gd_init: .long (_start - GENERATED_GBL_DATA_SIZE)
  65. #if CONFIG_VAL(SYS_MALLOC_F_LEN)
  66. ._gd_malloc_base: .long (_start - GENERATED_GBL_DATA_SIZE + GD_MALLOC_BASE)
  67. #endif
  68. ._stack_init: .long (_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
  69. ._sh_generic_init: .long board_init_f