[ac7d5ef0] | 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 | * |
---|
[60b791ad] | 8 | * COPYRIGHT (c) 1989-1998. |
---|
[ac7d5ef0] | 9 | * On-Line Applications Research Corporation (OAR). |
---|
[03f2154e] | 10 | * Copyright assigned to U.S. Government, 1994. |
---|
[ac7d5ef0] | 11 | * |
---|
[98e4ebf5] | 12 | * The license and distribution terms for this file may be |
---|
| 13 | * found in the file LICENSE in this distribution or at |
---|
[03f2154e] | 14 | * http://www.OARcorp.com/rtems/license.html. |
---|
[ac7d5ef0] | 15 | * |
---|
| 16 | * $Id$ |
---|
| 17 | */ |
---|
| 18 | |
---|
| 19 | #include "asm.h" |
---|
| 20 | |
---|
[906577f4] | 21 | #if (M68K_COLDFIRE_ARCH == 0) /* All ColdFire BSPs must provide their own start vector */ |
---|
| 22 | |
---|
[ac7d5ef0] | 23 | BEGIN_CODE |
---|
| 24 | | Default entry points for: |
---|
| 25 | PUBLIC (start) | GNU |
---|
| 26 | PUBLIC (M68Kvec) | Vector Table |
---|
| 27 | |
---|
| 28 | SYM (start): |
---|
[7e19c72b] | 29 | SYM (M68Kvec): | standard location for vectors |
---|
[ac7d5ef0] | 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) |
---|
[7e19c72b] | 56 | oriw #0x3700,sr | SUPV MODE,INTERRUPTS OFF!!! |
---|
[ac7d5ef0] | 57 | #if ( M68K_HAS_SEPARATE_STACKS == 1 ) |
---|
| 58 | movec isp,a0 |
---|
| 59 | move.l a0, SYM (initial_isp) |
---|
[9898425] | 60 | movec usp,a0 |
---|
[ac7d5ef0] | 61 | move.l a0, SYM (initial_usp) |
---|
[9898425] | 62 | movec msp,a0 |
---|
| 63 | move.l a0, SYM (initial_msp) |
---|
| 64 | #else |
---|
[ac7d5ef0] | 65 | move.l a7, SYM (initial_msp) |
---|
[9898425] | 66 | #endif |
---|
[ac7d5ef0] | 67 | |
---|
| 68 | | |
---|
| 69 | | zero out uninitialized data area |
---|
| 70 | | |
---|
| 71 | zerobss: |
---|
[7e19c72b] | 72 | moveal # SYM (end),a0 | find end of .bss |
---|
| 73 | moveal # SYM (bss_start),a1 | find beginning of .bss |
---|
[ac7d5ef0] | 74 | movel #0,d0 |
---|
| 75 | |
---|
[7e19c72b] | 76 | loop: movel #0,a1@+ | to zero out uninitialized |
---|
[ac7d5ef0] | 77 | cmpal a0,a1 |
---|
| 78 | jlt loop | loop until _end reached |
---|
| 79 | |
---|
[db88957] | 80 | movel # SYM (stack_init),d0 | d0 = stop of stack |
---|
[7e19c72b] | 81 | andl #0xffffffc0,d0 | align it on 16 byte boundary |
---|
| 82 | movw #0x3700,sr | SUPV MODE,INTERRUPTS OFF!!! |
---|
| 83 | movel d0,a7 | set master stack pointer |
---|
| 84 | movel d0,a6 | set base pointer |
---|
[ac7d5ef0] | 85 | |
---|
| 86 | /* |
---|
[e2a2ec60] | 87 | * RTEMS should maintain a separate interrupt stack on CPUs |
---|
[ac7d5ef0] | 88 | * without one in hardware. This is currently not supported |
---|
| 89 | * on versions of the m68k without a HW intr stack. |
---|
| 90 | */ |
---|
| 91 | |
---|
| 92 | #if ( M68K_HAS_SEPARATE_STACKS == 1 ) |
---|
[7e19c72b] | 93 | lea SYM (hiintstack),a0 | a0 = high end of intr stack |
---|
[ac7d5ef0] | 94 | movec a0,isp | set interrupt stack |
---|
| 95 | #endif |
---|
[3a4ae6c] | 96 | movel #0,a7@- | push environp |
---|
| 97 | movel #0,a7@- | push argv |
---|
| 98 | movel #0,a7@- | push argc |
---|
| 99 | |
---|
[e2a2ec60] | 100 | jsr SYM (boot_card) |
---|
[3a4ae6c] | 101 | addl #12,a7 |
---|
| 102 | |
---|
[ac7d5ef0] | 103 | #if ( M68K_HAS_SEPARATE_STACKS == 1 ) |
---|
| 104 | move.l SYM (initial_isp),a0 |
---|
| 105 | movec a0,isp |
---|
| 106 | move.l SYM (initial_usp),a0 |
---|
| 107 | movec a0,usp |
---|
| 108 | move.l SYM (initial_msp),a0 |
---|
| 109 | movec a0,msp |
---|
| 110 | #else |
---|
| 111 | movea.l SYM (initial_msp),a7 |
---|
| 112 | #endif |
---|
| 113 | move.w SYM (initial_sr),sr |
---|
| 114 | rts |
---|
| 115 | |
---|
| 116 | END_CODE |
---|
| 117 | |
---|
| 118 | BEGIN_DATA |
---|
| 119 | |
---|
| 120 | PUBLIC (start_frame) |
---|
| 121 | SYM (start_frame): |
---|
| 122 | .space 4,0 |
---|
| 123 | |
---|
| 124 | END_DATA |
---|
| 125 | |
---|
| 126 | BEGIN_BSS |
---|
| 127 | |
---|
| 128 | PUBLIC (environ) |
---|
| 129 | .align 2 |
---|
| 130 | SYM (environ): |
---|
| 131 | .long 0 |
---|
| 132 | |
---|
| 133 | PUBLIC (initial_isp) |
---|
| 134 | SYM (initial_isp): |
---|
| 135 | .space 4 |
---|
| 136 | |
---|
| 137 | PUBLIC (initial_msp) |
---|
| 138 | SYM (initial_msp): |
---|
| 139 | .space 4 |
---|
| 140 | |
---|
| 141 | PUBLIC (initial_usp) |
---|
| 142 | SYM (initial_usp): |
---|
| 143 | .space 4 |
---|
| 144 | |
---|
| 145 | PUBLIC (initial_sr) |
---|
| 146 | SYM (initial_sr): |
---|
| 147 | .space 2 |
---|
| 148 | |
---|
| 149 | END_DATA |
---|
[906577f4] | 150 | #endif |
---|
[ac7d5ef0] | 151 | END |
---|
| 152 | |
---|
| 153 | |
---|