start.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (C) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  3. * Copyright (C) 2008 Renesas Solutions Corp.
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of
  7. * the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  17. * MA 02111-1307 USA
  18. */
  19. #include <config.h>
  20. #include <version.h>
  21. .text
  22. .align 2
  23. .global _start
  24. _start:
  25. .long 0x00000010 /* Ppower ON reset PC*/
  26. .long 0x00000000
  27. .long 0x00000010 /* Manual reset PC */
  28. .long 0x00000000
  29. _init:
  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 #(_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 (_start - CFG_GBL_DATA_SIZE)
  65. ._stack_init: .long (_start - CFG_GBL_DATA_SIZE - CFG_MALLOC_LEN - 16)
  66. ._sh_generic_init: .long sh_generic_init