start.S 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * (C) Copyright 2007
  3. * Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
  4. *
  5. * (C) Copyright 2007
  6. * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  7. *
  8. * SPDX-License-Identifier: GPL-2.0+
  9. */
  10. #include <asm-offsets.h>
  11. #include <config.h>
  12. .text
  13. .align 2
  14. .global _start
  15. _sh_start:
  16. mov.l ._lowlevel_init, r0
  17. 100: bsrf r0
  18. nop
  19. bsr 1f
  20. nop
  21. 1: sts pr, r5
  22. mov.l ._reloc_dst, r4
  23. add #(_sh_start-1b), r5
  24. mov.l ._reloc_dst_end, r6
  25. 2: mov.l @r5+, r1
  26. mov.l r1, @r4
  27. add #4, r4
  28. cmp/hs r6, r4
  29. bf 2b
  30. mov.l ._bss_start, r4
  31. mov.l ._bss_end, r5
  32. mov #0, r1
  33. 3: mov.l r1, @r4 /* bss clear */
  34. add #4, r4
  35. cmp/hs r5, r4
  36. bf 3b
  37. mov.l ._gd_init, r13 /* global data */
  38. mov.l ._stack_init, r15 /* stack */
  39. #TODO(sh maintainer): Fix this up to call the correct code
  40. #mov.l ._sh_generic_init, r0
  41. #jsr @r0
  42. nop
  43. loop:
  44. bra loop
  45. .align 2
  46. ._lowlevel_init: .long (lowlevel_init - (100b + 4))
  47. ._reloc_dst: .long reloc_dst
  48. ._reloc_dst_end: .long reloc_dst_end
  49. ._bss_start: .long bss_start
  50. ._bss_end: .long bss_end
  51. ._gd_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE)
  52. ._stack_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
  53. #._sh_generic_init: .long sh_generic_init