1 |
2 |
drasko |
/*******************************************************************************
|
2 |
|
|
* Filename: src/main.c *
|
3 |
|
|
* Description: Elf-loader - ELF file kernel/application bootstraper, header *
|
4 |
|
|
* file defining the architecture specific functions required. *
|
5 |
|
|
* Authors: Adam 'WeirdArms' Wiggins <awiggins@cse.unsw.edu.au>. *
|
6 |
|
|
* Created: 2004-12-01 *
|
7 |
|
|
********************************************************************************
|
8 |
|
|
* *
|
9 |
|
|
* Australian Public Licence B (OZPLB) *
|
10 |
|
|
* *
|
11 |
|
|
* Version 1-0 *
|
12 |
|
|
* *
|
13 |
|
|
* Copyright (c) 2004 - 2005 University of New South Wales, Australia *
|
14 |
|
|
* *
|
15 |
|
|
* All rights reserved. *
|
16 |
|
|
* *
|
17 |
|
|
* Developed by: Operating Systems, Embedded and *
|
18 |
|
|
* Distributed Systems Group (DiSy) *
|
19 |
|
|
* University of New South Wales *
|
20 |
|
|
* http://www.disy.cse.unsw.edu.au *
|
21 |
|
|
* *
|
22 |
|
|
* Permission is granted by University of New South Wales, free of charge, to *
|
23 |
|
|
* any person obtaining a copy of this software and any associated *
|
24 |
|
|
* documentation files (the "Software") to deal with the Software without *
|
25 |
|
|
* restriction, including (without limitation) the rights to use, copy, *
|
26 |
|
|
* modify, adapt, merge, publish, distribute, communicate to the public, *
|
27 |
|
|
* sublicense, and/or sell, lend or rent out copies of the Software, and *
|
28 |
|
|
* to permit persons to whom the Software is furnished to do so, subject *
|
29 |
|
|
* to the following conditions: *
|
30 |
|
|
* *
|
31 |
|
|
* * Redistributions of source code must retain the above copyright *
|
32 |
|
|
* notice, this list of conditions and the following disclaimers. *
|
33 |
|
|
* *
|
34 |
|
|
* * Redistributions in binary form must reproduce the above *
|
35 |
|
|
* copyright notice, this list of conditions and the following *
|
36 |
|
|
* disclaimers in the documentation and/or other materials provided *
|
37 |
|
|
* with the distribution. *
|
38 |
|
|
* *
|
39 |
|
|
* * Neither the name of University of New South Wales, nor the names of *
|
40 |
|
|
* its contributors, may be used to endorse or promote products derived *
|
41 |
|
|
* from this Software without specific prior written permission. *
|
42 |
|
|
* *
|
43 |
|
|
* EXCEPT AS EXPRESSLY STATED IN THIS LICENCE AND TO THE FULL EXTENT *
|
44 |
|
|
* PERMITTED BY APPLICABLE LAW, THE SOFTWARE IS PROVIDED "AS-IS", AND *
|
45 |
|
|
* NATIONAL ICT AUSTRALIA AND ITS CONTRIBUTORS MAKE NO REPRESENTATIONS, *
|
46 |
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING *
|
47 |
|
|
* BUT NOT LIMITED TO ANY REPRESENTATIONS, WARRANTIES OR CONDITIONS *
|
48 |
|
|
* REGARDING THE CONTENTS OR ACCURACY OF THE SOFTWARE, OR OF TITLE, *
|
49 |
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, *
|
50 |
|
|
* THE ABSENCE OF LATENT OR OTHER DEFECTS, OR THE PRESENCE OR ABSENCE OF *
|
51 |
|
|
* ERRORS, WHETHER OR NOT DISCOVERABLE. *
|
52 |
|
|
* *
|
53 |
|
|
* TO THE FULL EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL *
|
54 |
|
|
* NATIONAL ICT AUSTRALIA OR ITS CONTRIBUTORS BE LIABLE ON ANY LEGAL *
|
55 |
|
|
* THEORY (INCLUDING, WITHOUT LIMITATION, IN AN ACTION OF CONTRACT, *
|
56 |
|
|
* NEGLIGENCE OR OTHERWISE) FOR ANY CLAIM, LOSS, DAMAGES OR OTHER *
|
57 |
|
|
* LIABILITY, INCLUDING (WITHOUT LIMITATION) LOSS OF PRODUCTION OR *
|
58 |
|
|
* OPERATION TIME, LOSS, DAMAGE OR CORRUPTION OF DATA OR RECORDS; OR LOSS *
|
59 |
|
|
* OF ANTICIPATED SAVINGS, OPPORTUNITY, REVENUE, PROFIT OR GOODWILL, OR *
|
60 |
|
|
* OTHER ECONOMIC LOSS; OR ANY SPECIAL, INCIDENTAL, INDIRECT, *
|
61 |
|
|
* CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES, ARISING OUT OF OR IN *
|
62 |
|
|
* CONNECTION WITH THIS LICENCE, THE SOFTWARE OR THE USE OF OR OTHER *
|
63 |
|
|
* DEALINGS WITH THE SOFTWARE, EVEN IF NATIONAL ICT AUSTRALIA OR ITS *
|
64 |
|
|
* CONTRIBUTORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH CLAIM, LOSS, *
|
65 |
|
|
* DAMAGES OR OTHER LIABILITY. *
|
66 |
|
|
* *
|
67 |
|
|
* If applicable legislation implies representations, warranties, or *
|
68 |
|
|
* conditions, or imposes obligations or liability on University of New South *
|
69 |
|
|
* Wales or one of its contributors in respect of the Software that *
|
70 |
|
|
* cannot be wholly or partly excluded, restricted or modified, the *
|
71 |
|
|
* liability of University of New South Wales or the contributor is limited, to *
|
72 |
|
|
* the full extent permitted by the applicable legislation, at its *
|
73 |
|
|
* option, to: *
|
74 |
|
|
* a. in the case of goods, any one or more of the following: *
|
75 |
|
|
* i. the replacement of the goods or the supply of equivalent goods; *
|
76 |
|
|
* ii. the repair of the goods; *
|
77 |
|
|
* iii. the payment of the cost of replacing the goods or of acquiring *
|
78 |
|
|
* equivalent goods; *
|
79 |
|
|
* iv. the payment of the cost of having the goods repaired; or *
|
80 |
|
|
* b. in the case of services: *
|
81 |
|
|
* i. the supplying of the services again; or *
|
82 |
|
|
* ii. the payment of the cost of having the services supplied again. *
|
83 |
|
|
* *
|
84 |
|
|
* The construction, validity and performance of this licence is governed *
|
85 |
|
|
* by the laws in force in New South Wales, Australia. *
|
86 |
|
|
* *
|
87 |
|
|
*******************************************************************************/
|
88 |
|
|
|
89 |
|
|
/** It is assumed that the either the boot loader or the baremetal
|
90 |
|
|
* crt0.S has initialised the whatever console provides printf based
|
91 |
|
|
* output.
|
92 |
|
|
*/
|
93 |
|
|
|
94 |
|
|
/** arch_init() This function conducts architecture specific
|
95 |
|
|
* initialisation of the machine to prep it for loading of the kernel
|
96 |
|
|
* and application images from the dite generated elf file.
|
97 |
|
|
*/
|
98 |
|
|
void arch_init(void);
|
99 |
|
|
|
100 |
|
|
/** arch_start_kernel() This function carries out any architecture
|
101 |
|
|
* specific post-image-loading initialisation and jumps to the
|
102 |
|
|
* kernel's entry point.
|
103 |
|
|
*
|
104 |
|
|
* entry - The entry point of the kernel,
|
105 |
|
|
*/
|
106 |
|
|
void arch_start_kernel(void* entry);
|
107 |
|
|
|
108 |
|
|
#ifdef __PPC64__
|
109 |
|
|
#include <elf/elf.h>
|
110 |
|
|
|
111 |
|
|
int arch_claim_memory(struct Elf32_Header*);
|
112 |
|
|
#endif
|