[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 | * |
---|
[03f2154e] | 8 | * COPYRIGHT (c) 1989-1997. |
---|
[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 | |
---|
| 21 | BEGIN_CODE |
---|
| 22 | PUBLIC(start) # GNU960 default entry point |
---|
| 23 | |
---|
[467eae4d] | 24 | SYM(start): |
---|
[ac7d5ef0] | 25 | mov 3, r12 |
---|
| 26 | modpc r12, r12, r12 # enable tracing/trace faults |
---|
| 27 | mov g5, g5 # NOP |
---|
| 28 | mov 0, g14 # initialize constant for C |
---|
| 29 | |
---|
| 30 | /* |
---|
| 31 | * zero out uninitialized data area |
---|
| 32 | */ |
---|
| 33 | zerobss: |
---|
| 34 | lda _end, r4 /* find end of .bss */ |
---|
| 35 | lda _bss_start, r5 /* find beginning of .bss */ |
---|
| 36 | ldconst 0, r6 |
---|
| 37 | |
---|
| 38 | loop: st r6, (r5) /* to zero out uninitialized */ |
---|
| 39 | addo 4, r5, r5 /* data area */ |
---|
| 40 | cmpobl r5, r4, loop /* loop until _end reached */ |
---|
| 41 | |
---|
| 42 | /* set up stack pointer: |
---|
| 43 | * The heap will begin at '_end'; its length is 'heap_size' |
---|
| 44 | * bytes. The stack will begin at the first 64-byte-aligned |
---|
| 45 | * block after the heap. |
---|
| 46 | * |
---|
| 47 | * A default value of 'heap_size' is set by linking with libnindy.a |
---|
| 48 | * The default can be overridden by redefining this symbol at link |
---|
| 49 | * time (with a line of the form 'heap_size=XXXX;' in the lnk960 |
---|
| 50 | * linker specification file; or one of the form |
---|
| 51 | * "-defsym heap_size=XXXX" on the gld960 invocation line). |
---|
| 52 | */ |
---|
| 53 | |
---|
| 54 | ldconst _end, sp /* set sp = address of end of heap */ |
---|
| 55 | lda heap_size(sp),sp |
---|
| 56 | lda 64(sp), sp /* Now round up to 64-byte boundary */ |
---|
| 57 | ldconst 0xffffffc0, r12 |
---|
| 58 | and r12, sp, sp |
---|
| 59 | st sp, _stack_start /* Save for brk() routine */ |
---|
| 60 | |
---|
| 61 | call init_frames |
---|
| 62 | ret /* return to monitor */ |
---|
| 63 | |
---|
| 64 | init_frames: |
---|
| 65 | mov 0, g14 /* initialize constant for C */ |
---|
| 66 | ldconst 0x3b001000, g0 |
---|
| 67 | ldconst 0x00009107, g1 |
---|
| 68 | modac g1, g0, g0 /* set AC controls */ |
---|
| 69 | |
---|
| 70 | /* |
---|
| 71 | * remember the frame, so that we can set it up if necessary |
---|
| 72 | */ |
---|
| 73 | |
---|
| 74 | st fp, _start_frame |
---|
| 75 | |
---|
| 76 | /* |
---|
| 77 | * Call application mainline. |
---|
| 78 | * Someday, real values of argc and argv will be set up. |
---|
| 79 | * For now, they are set to 0. |
---|
| 80 | */ |
---|
| 81 | ldconst 0,g0 |
---|
| 82 | ldconst 0,g1 |
---|
[3a4ae6c] | 83 | ldconst 0,g2 |
---|
| 84 | call _main |
---|
[ac7d5ef0] | 85 | ret |
---|
| 86 | |
---|
| 87 | END_CODE |
---|
| 88 | |
---|
| 89 | BEGIN_DATA |
---|
| 90 | |
---|
| 91 | PUBLIC(_start_frame) |
---|
[467eae4d] | 92 | PUBLIC(start_frame) |
---|
[ac7d5ef0] | 93 | SYM (_start_frame): |
---|
[467eae4d] | 94 | SYM (start_frame): |
---|
[ac7d5ef0] | 95 | .word 0 # addr of first user frame: for gdb960 |
---|
| 96 | |
---|
| 97 | PUBLIC(_stack_start) |
---|
[467eae4d] | 98 | PUBLIC(stack_start) |
---|
| 99 | SYM (_stack_start): |
---|
| 100 | SYM (stack_start): |
---|
[ac7d5ef0] | 101 | .word 0 # addr of first user frame: for gdb960 |
---|
| 102 | |
---|
| 103 | END_DATA |
---|
| 104 | |
---|
| 105 | BEGIN_BSS |
---|
| 106 | PUBLIC(heap_size) |
---|
| 107 | .set heap_size,0x2000 |
---|
| 108 | END_BSS |
---|
| 109 | |
---|
| 110 | END |
---|