start.S 1.7 KB

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