Nobuhiro Iwamatsu | 5b6918e | 2008-08-31 22:48:33 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> |
| 3 | * Copyright (C) 2008 Renesas Solutions Corp. |
| 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 | |
Wolfgang Denk | 0191e47 | 2010-10-26 14:34:52 +0200 | [diff] [blame] | 21 | #include <asm-offsets.h> |
Nobuhiro Iwamatsu | 5b6918e | 2008-08-31 22:48:33 +0900 | [diff] [blame] | 22 | #include <config.h> |
| 23 | #include <version.h> |
| 24 | |
| 25 | .text |
| 26 | .align 2 |
| 27 | |
| 28 | .global _start |
Nobuhiro Iwamatsu | a0dbe93 | 2010-11-24 13:12:17 +0900 | [diff] [blame] | 29 | _sh_start: |
Nobuhiro Iwamatsu | 5b6918e | 2008-08-31 22:48:33 +0900 | [diff] [blame] | 30 | .long 0x00000010 /* Ppower ON reset PC*/ |
| 31 | .long 0x00000000 |
| 32 | .long 0x00000010 /* Manual reset PC */ |
| 33 | .long 0x00000000 |
| 34 | _init: |
| 35 | mov.l ._lowlevel_init, r0 |
| 36 | 100: bsrf r0 |
| 37 | nop |
| 38 | bsr 1f |
| 39 | nop |
| 40 | 1: sts pr, r5 |
| 41 | mov.l ._reloc_dst, r4 |
Nobuhiro Iwamatsu | a0dbe93 | 2010-11-24 13:12:17 +0900 | [diff] [blame] | 42 | add #(_sh_start-1b), r5 |
Nobuhiro Iwamatsu | 5b6918e | 2008-08-31 22:48:33 +0900 | [diff] [blame] | 43 | mov.l ._reloc_dst_end, r6 |
| 44 | |
| 45 | 2: mov.l @r5+, r1 |
| 46 | mov.l r1, @r4 |
| 47 | add #4, r4 |
| 48 | cmp/hs r6, r4 |
| 49 | bf 2b |
| 50 | |
| 51 | mov.l ._bss_start, r4 |
| 52 | mov.l ._bss_end, r5 |
| 53 | mov #0, r1 |
| 54 | |
| 55 | 3: mov.l r1, @r4 /* bss clear */ |
| 56 | add #4, r4 |
| 57 | cmp/hs r5, r4 |
| 58 | bf 3b |
| 59 | |
| 60 | mov.l ._gd_init, r13 /* global data */ |
| 61 | mov.l ._stack_init, r15 /* stack */ |
| 62 | |
| 63 | mov.l ._sh_generic_init, r0 |
| 64 | jsr @r0 |
| 65 | nop |
| 66 | |
| 67 | loop: |
| 68 | bra loop |
| 69 | |
| 70 | .align 2 |
| 71 | |
| 72 | ._lowlevel_init: .long (lowlevel_init - (100b + 4)) |
| 73 | ._reloc_dst: .long reloc_dst |
| 74 | ._reloc_dst_end: .long reloc_dst_end |
| 75 | ._bss_start: .long bss_start |
| 76 | ._bss_end: .long bss_end |
Nobuhiro Iwamatsu | a0dbe93 | 2010-11-24 13:12:17 +0900 | [diff] [blame] | 77 | ._gd_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE) |
| 78 | ._stack_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16) |
Nobuhiro Iwamatsu | 5b6918e | 2008-08-31 22:48:33 +0900 | [diff] [blame] | 79 | ._sh_generic_init: .long sh_generic_init |