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