start.S 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 <asm-offsets.h>
  20. #include <config.h>
  21. #include <version.h>
  22. .text
  23. .align 2
  24. .global _start
  25. _sh_start:
  26. .long 0x00000010 /* Ppower ON reset PC*/
  27. .long 0x00000000
  28. .long 0x00000010 /* Manual reset PC */
  29. .long 0x00000000
  30. _init:
  31. mov.l ._lowlevel_init, r0
  32. 100: bsrf r0
  33. nop
  34. bsr 1f
  35. nop
  36. 1: sts pr, r5
  37. mov.l ._reloc_dst, r4
  38. add #(_sh_start-1b), r5
  39. mov.l ._reloc_dst_end, r6
  40. 2: mov.l @r5+, r1
  41. mov.l r1, @r4
  42. add #4, r4
  43. cmp/hs r6, r4
  44. bf 2b
  45. mov.l ._bss_start, r4
  46. mov.l ._bss_end, r5
  47. mov #0, r1
  48. 3: mov.l r1, @r4 /* bss clear */
  49. add #4, r4
  50. cmp/hs r5, r4
  51. bf 3b
  52. mov.l ._gd_init, r13 /* global data */
  53. mov.l ._stack_init, r15 /* stack */
  54. mov.l ._sh_generic_init, r0
  55. jsr @r0
  56. nop
  57. loop:
  58. bra loop
  59. .align 2
  60. ._lowlevel_init: .long (lowlevel_init - (100b + 4))
  61. ._reloc_dst: .long reloc_dst
  62. ._reloc_dst_end: .long reloc_dst_end
  63. ._bss_start: .long bss_start
  64. ._bss_end: .long bss_end
  65. ._gd_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE)
  66. ._stack_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
  67. ._sh_generic_init: .long sh_generic_init