add ls180 pinmap text file
[soc.git] / src / soc / litex / crt0.S
1 /* Copyright 2013-2014 IBM Corp.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12 * implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #define FIXUP_ENDIAN \
18 tdi 0,0,0x48; /* Reverse endian of b . + 8 */ \
19 b 191f; /* Skip trampoline if endian is good */ \
20 .long 0xa600607d; /* mfmsr r11 */ \
21 .long 0x01006b69; /* xori r11,r11,1 */ \
22 .long 0x05009f42; /* bcl 20,31,$+4 */ \
23 .long 0xa602487d; /* mflr r10 */ \
24 .long 0x14004a39; /* addi r10,r10,20 */ \
25 .long 0xa64b5a7d; /* mthsrr0 r10 */ \
26 .long 0xa64b7b7d; /* mthsrr1 r11 */ \
27 .long 0x2402004c; /* hrfid */ \
28 191:
29
30
31 /* Load an immediate 64-bit value into a register */
32 #define LOAD_IMM64(r, e) \
33 lis r,(e)@highest; \
34 ori r,r,(e)@higher; \
35 rldicr r,r, 32, 31; \
36 oris r,r, (e)@h; \
37 ori r,r, (e)@l;
38
39 . = 0
40 .global _start
41 _start:
42 FIXUP_ENDIAN
43
44 /* setup stack */
45 LOAD_IMM64(%r1, _fstack - 0x100)
46 LOAD_IMM64(%r12, main)
47 mtctr %r12,
48 bctrl
49 b .
50
51 #define EXCEPTION(nr) \
52 .= nr; \
53 b .
54
55 /* More exception stubs */
56 EXCEPTION(0x100)
57 EXCEPTION(0x200)
58 EXCEPTION(0x300)
59 EXCEPTION(0x380)
60 EXCEPTION(0x400)
61 EXCEPTION(0x480)
62 EXCEPTION(0x500)
63 EXCEPTION(0x600)
64 EXCEPTION(0x700)
65 EXCEPTION(0x800)
66 EXCEPTION(0x900)
67 EXCEPTION(0x980)
68 EXCEPTION(0xa00)
69 EXCEPTION(0xb00)
70 EXCEPTION(0xc00)
71 EXCEPTION(0xd00)
72 EXCEPTION(0xe00)
73 EXCEPTION(0xe20)
74 EXCEPTION(0xe40)
75 EXCEPTION(0xe60)
76 EXCEPTION(0xe80)
77 EXCEPTION(0xf00)
78 EXCEPTION(0xf20)
79 EXCEPTION(0xf40)
80 EXCEPTION(0xf60)
81 EXCEPTION(0xf80)
82 #if 0
83 EXCEPTION(0x1000)
84 EXCEPTION(0x1100)
85 EXCEPTION(0x1200)
86 EXCEPTION(0x1300)
87 EXCEPTION(0x1400)
88 EXCEPTION(0x1500)
89 EXCEPTION(0x1600)
90 #endif
91
92 .text
93