start.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <asm-offsets.h>
  24. #include <config.h>
  25. #include <version.h>
  26. .text
  27. .align 2
  28. .global _start
  29. _sh_start:
  30. mov.l ._lowlevel_init, r0
  31. 100: bsrf r0
  32. nop
  33. bsr 1f
  34. nop
  35. 1: sts pr, r5
  36. mov.l ._reloc_dst, r4
  37. add #(_sh_start-1b), r5
  38. mov.l ._reloc_dst_end, r6
  39. 2: mov.l @r5+, r1
  40. mov.l r1, @r4
  41. add #4, r4
  42. cmp/hs r6, r4
  43. bf 2b
  44. mov.l ._bss_start, r4
  45. mov.l ._bss_end, r5
  46. mov #0, r1
  47. 3: mov.l r1, @r4 /* bss clear */
  48. add #4, r4
  49. cmp/hs r5, r4
  50. bf 3b
  51. mov.l ._gd_init, r13 /* global data */
  52. mov.l ._stack_init, r15 /* stack */
  53. mov.l ._sh_generic_init, r0
  54. jsr @r0
  55. nop
  56. loop:
  57. bra loop
  58. .align 2
  59. ._lowlevel_init: .long (lowlevel_init - (100b + 4))
  60. ._reloc_dst: .long reloc_dst
  61. ._reloc_dst_end: .long reloc_dst_end
  62. ._bss_start: .long bss_start
  63. ._bss_end: .long bss_end
  64. ._gd_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE)
  65. ._stack_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
  66. ._sh_generic_init: .long sh_generic_init