start.S 1.8 KB

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