1 /* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
2 Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
3 On-Line Applications Research Corporation.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 In addition to the permissions in the GNU Lesser General Public
12 License, the Free Software Foundation gives you unlimited
13 permission to link the compiled version of this file with other
14 programs, and to distribute those programs without any restriction
15 coming from the use of this file. (The GNU Lesser General Public
16 License restrictions do apply in other respects; for example, they
17 cover modification of the file, and distribution when not linked
18 into another program.)
20 Note that people who make modified versions of this file are not
21 obligated to grant this special exception for their modified
22 versions; it is their choice whether to do so. The GNU Lesser
23 General Public License gives permission to release a modified
24 version without this exception; this exception also makes it
25 possible to release a modified version which carries forward this
28 The GNU C Library is distributed in the hope that it will be useful,
29 but WITHOUT ANY WARRANTY; without even the implied warranty of
30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
31 Lesser General Public License for more details.
33 You should have received a copy of the GNU Lesser General Public
34 License along with the GNU C Library; if not, write to the Free
35 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
40 * This file contains the entry point for the application.
41 * The name of this entry point is compiler dependent.
42 * It jumps to the BSP which is responsible for performing
48 .globl start # GNU960 default entry point
52 modpc r12, r12, r12 # enable tracing/trace faults
54 mov 0, g14 # initialize constant for C
57 * zero out uninitialized data area
60 lda _end, r4 /* find end of .bss */
61 lda _bss_start, r5 /* find beginning of .bss */
64 loop: st r6, (r5) /* to zero out uninitialized */
65 addo 4, r5, r5 /* data area */
66 cmpobl r5, r4, loop /* loop until _end reached */
69 lda heap_memory, r12 /* tell C lib where heap is */
70 st r12,___C_heap_start
71 lda heap_size, r12 /* tell C lib how big heap is */
73 lda stack_memory,r12 /* set up stack pointer: */
75 mov 0, g14 /* initialize constant for C */
78 ret /* return to monitor */
81 ldconst 0x3b001000, g0
82 ldconst 0x00009107, g1
83 modac g1, g0, g0 /* set AC controls */
86 * Call application mainline.
87 * Someday, real values of argc and argv will be set up.
88 * For now, they are set to 0.
91 callx __Board_Initialize /* Initialize the board */
96 callx ___libc_init /* initialize the library and */
99 * if we return from main, we have "fallen" off the end
100 * of the program, therefore status is 0
101 * so move 0 to g0 (exit parameter)
110 * Data Declarations. Start with a macro which helps declare space.
113 #define DECLARE_SPACE(_name,_space,_align) \
118 #define DECLARE_LABEL(_name) \
122 #define DECLARE_PTR(_name) DECLARE_SPACE(_name,4,2)
123 #define DECLARE_U32(_name) DECLARE_SPACE(_name,4,2)
124 #define DECLARE_U16(_name) DECLARE_SPACE(_name,2,1)
127 * Require environment stuff
130 DECLARE_LABEL(_environ)
133 DECLARE_LABEL(_errno)
137 * Stack Size and Space
140 .set stack_size, 0x20000
142 DECLARE_SPACE(stack_memory,stack_size,4)
143 DECLARE_LABEL(stack_end)
146 * Heap Size and Space
149 .set heap_size, 0x20000
151 DECLARE_SPACE(heap_memory,heap_size,4)
152 DECLARE_LABEL(heap_end)