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