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 | |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Nobuhiro Iwamatsu | 5b6918e | 2008-08-31 22:48:33 +0900 | [diff] [blame] | 6 | */ |
| 7 | |
Wolfgang Denk | 0191e47 | 2010-10-26 14:34:52 +0200 | [diff] [blame] | 8 | #include <asm-offsets.h> |
Nobuhiro Iwamatsu | 5b6918e | 2008-08-31 22:48:33 +0900 | [diff] [blame] | 9 | #include <config.h> |
Nobuhiro Iwamatsu | 5b6918e | 2008-08-31 22:48:33 +0900 | [diff] [blame] | 10 | |
| 11 | .text |
| 12 | .align 2 |
| 13 | |
| 14 | .global _start |
Nobuhiro Iwamatsu | a0dbe93 | 2010-11-24 13:12:17 +0900 | [diff] [blame] | 15 | _sh_start: |
Nobuhiro Iwamatsu | 5b6918e | 2008-08-31 22:48:33 +0900 | [diff] [blame] | 16 | .long 0x00000010 /* Ppower ON reset PC*/ |
| 17 | .long 0x00000000 |
| 18 | .long 0x00000010 /* Manual reset PC */ |
| 19 | .long 0x00000000 |
| 20 | _init: |
| 21 | mov.l ._lowlevel_init, r0 |
| 22 | 100: bsrf r0 |
| 23 | nop |
| 24 | bsr 1f |
| 25 | nop |
| 26 | 1: sts pr, r5 |
| 27 | mov.l ._reloc_dst, r4 |
Nobuhiro Iwamatsu | a0dbe93 | 2010-11-24 13:12:17 +0900 | [diff] [blame] | 28 | add #(_sh_start-1b), r5 |
Nobuhiro Iwamatsu | 5b6918e | 2008-08-31 22:48:33 +0900 | [diff] [blame] | 29 | mov.l ._reloc_dst_end, r6 |
| 30 | |
| 31 | 2: mov.l @r5+, r1 |
| 32 | mov.l r1, @r4 |
| 33 | add #4, r4 |
| 34 | cmp/hs r6, r4 |
| 35 | bf 2b |
| 36 | |
| 37 | mov.l ._bss_start, r4 |
| 38 | mov.l ._bss_end, r5 |
| 39 | mov #0, r1 |
| 40 | |
| 41 | 3: mov.l r1, @r4 /* bss clear */ |
| 42 | add #4, r4 |
| 43 | cmp/hs r5, r4 |
| 44 | bf 3b |
| 45 | |
| 46 | mov.l ._gd_init, r13 /* global data */ |
| 47 | mov.l ._stack_init, r15 /* stack */ |
| 48 | |
| 49 | mov.l ._sh_generic_init, r0 |
| 50 | jsr @r0 |
| 51 | nop |
| 52 | |
| 53 | loop: |
| 54 | bra loop |
| 55 | |
| 56 | .align 2 |
| 57 | |
| 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 |
Nobuhiro Iwamatsu | a0dbe93 | 2010-11-24 13:12:17 +0900 | [diff] [blame] | 63 | ._gd_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE) |
| 64 | ._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] | 65 | ._sh_generic_init: .long sh_generic_init |