1 | /* entry.s |
---|
2 | * |
---|
3 | * This file contains the entry point for the application. |
---|
4 | * The name of this entry point is compiler dependent. |
---|
5 | * It jumps to the BSP which is responsible for performing |
---|
6 | * all initialization. |
---|
7 | * |
---|
8 | * COPYRIGHT (c) 1989-1998. |
---|
9 | * On-Line Applications Research Corporation (OAR). |
---|
10 | * Copyright assigned to U.S. Government, 1994. |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.OARcorp.com/rtems/license.html. |
---|
15 | * |
---|
16 | * $Id$ |
---|
17 | */ |
---|
18 | |
---|
19 | #include "asm.h" |
---|
20 | |
---|
21 | #if (M68K_COLDFIRE_ARCH == 0) /* All ColdFire BSPs must provide their own start vector */ |
---|
22 | |
---|
23 | BEGIN_CODE |
---|
24 | | Default entry points for: |
---|
25 | PUBLIC (start) | GNU |
---|
26 | PUBLIC (M68Kvec) | Vector Table |
---|
27 | |
---|
28 | SYM (start): |
---|
29 | SYM (M68Kvec): | standard location for vectors |
---|
30 | nop | for linkers with problem |
---|
31 | | location zero |
---|
32 | jmp SYM (start_around) |
---|
33 | |
---|
34 | /* |
---|
35 | * We can use the following space as our vector table |
---|
36 | * if the CPU has a VBR or we can save vector table in it |
---|
37 | * if the CPU does not. |
---|
38 | */ |
---|
39 | |
---|
40 | .space 4088 | to avoid initial intr stack |
---|
41 | | from 135BUG on MVME13? |
---|
42 | | and start code at 0x4000 |
---|
43 | SYM (vectors): |
---|
44 | .space 1016 | reserve space for rest of vectors |
---|
45 | |
---|
46 | #if ( M68K_HAS_SEPARATE_STACKS == 1 ) |
---|
47 | SYM (lowintstack): |
---|
48 | .space 4092 | reserve for interrupt stack |
---|
49 | SYM (hiintstack): |
---|
50 | .space 4 | end of interrupt stack |
---|
51 | #endif |
---|
52 | |
---|
53 | PUBLIC (start_around) |
---|
54 | SYM (start_around): |
---|
55 | move.w sr, SYM (initial_sr) |
---|
56 | oriw #0x3700,sr | SUPV MODE,INTERRUPTS OFF!!! |
---|
57 | #if ( M68K_HAS_SEPARATE_STACKS == 1 ) |
---|
58 | movec isp,a0 |
---|
59 | move.l a0, SYM (initial_isp) |
---|
60 | movec usp,a0 |
---|
61 | move.l a0, SYM (initial_usp) |
---|
62 | movec msp,a0 |
---|
63 | move.l a0, SYM (initial_msp) |
---|
64 | #else |
---|
65 | move.l a7, SYM (initial_msp) |
---|
66 | #endif |
---|
67 | |
---|
68 | | |
---|
69 | | zero out uninitialized data area |
---|
70 | | |
---|
71 | zerobss: |
---|
72 | moveal # SYM (end),a0 | find end of .bss |
---|
73 | moveal # SYM (bss_start),a1 | find beginning of .bss |
---|
74 | movel #0,d0 |
---|
75 | |
---|
76 | loop: movel #0,a1@+ | to zero out uninitialized |
---|
77 | cmpal a0,a1 |
---|
78 | jlt loop | loop until _end reached |
---|
79 | |
---|
80 | movel # SYM (end),d0 | d0 = end of bss/start of heap |
---|
81 | addl # SYM (heap_size),d0 | d0 = end of heap |
---|
82 | movel d0, SYM (stack_start) | Save for brk() routine |
---|
83 | addl # SYM (stack_size),d0 | make room for stack |
---|
84 | andl #0xffffffc0,d0 | align it on 16 byte boundary |
---|
85 | movw #0x3700,sr | SUPV MODE,INTERRUPTS OFF!!! |
---|
86 | movel d0,a7 | set master stack pointer |
---|
87 | movel d0,a6 | set base pointer |
---|
88 | |
---|
89 | /* |
---|
90 | * RTEMS should maintain a separate interrupt stack on CPUs |
---|
91 | * without one in hardware. This is currently not supported |
---|
92 | * on versions of the m68k without a HW intr stack. |
---|
93 | */ |
---|
94 | |
---|
95 | #if ( M68K_HAS_SEPARATE_STACKS == 1 ) |
---|
96 | lea SYM (hiintstack),a0 | a0 = high end of intr stack |
---|
97 | movec a0,isp | set interrupt stack |
---|
98 | #endif |
---|
99 | movel #0,a7@- | push environp |
---|
100 | movel #0,a7@- | push argv |
---|
101 | movel #0,a7@- | push argc |
---|
102 | |
---|
103 | jsr SYM (boot_card) |
---|
104 | addl #12,a7 |
---|
105 | |
---|
106 | #if ( M68K_HAS_SEPARATE_STACKS == 1 ) |
---|
107 | move.l SYM (initial_isp),a0 |
---|
108 | movec a0,isp |
---|
109 | move.l SYM (initial_usp),a0 |
---|
110 | movec a0,usp |
---|
111 | move.l SYM (initial_msp),a0 |
---|
112 | movec a0,msp |
---|
113 | #else |
---|
114 | movea.l SYM (initial_msp),a7 |
---|
115 | #endif |
---|
116 | move.w SYM (initial_sr),sr |
---|
117 | rts |
---|
118 | |
---|
119 | END_CODE |
---|
120 | |
---|
121 | BEGIN_DATA |
---|
122 | |
---|
123 | PUBLIC (start_frame) |
---|
124 | SYM (start_frame): |
---|
125 | .space 4,0 |
---|
126 | |
---|
127 | PUBLIC (stack_start) |
---|
128 | SYM (stack_start): |
---|
129 | .space 4,0 |
---|
130 | END_DATA |
---|
131 | |
---|
132 | BEGIN_BSS |
---|
133 | |
---|
134 | PUBLIC (environ) |
---|
135 | .align 2 |
---|
136 | SYM (environ): |
---|
137 | .long 0 |
---|
138 | |
---|
139 | PUBLIC (initial_isp) |
---|
140 | SYM (initial_isp): |
---|
141 | .space 4 |
---|
142 | |
---|
143 | PUBLIC (initial_msp) |
---|
144 | SYM (initial_msp): |
---|
145 | .space 4 |
---|
146 | |
---|
147 | PUBLIC (initial_usp) |
---|
148 | SYM (initial_usp): |
---|
149 | .space 4 |
---|
150 | |
---|
151 | PUBLIC (initial_sr) |
---|
152 | SYM (initial_sr): |
---|
153 | .space 2 |
---|
154 | |
---|
155 | PUBLIC (heap_size) |
---|
156 | .set SYM (heap_size),0x2000 |
---|
157 | |
---|
158 | PUBLIC (stack_size) |
---|
159 | .set SYM (stack_size),0x1000 |
---|
160 | |
---|
161 | |
---|
162 | END_DATA |
---|
163 | #endif |
---|
164 | END |
---|
165 | |
---|
166 | |
---|