-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcstart.c
More file actions
29 lines (24 loc) · 680 Bytes
/
cstart.c
File metadata and controls
29 lines (24 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
extern int __bss_start__;
extern int __bss_end__;
extern int _vectors;
extern int _vectors_end;
extern void main();
#define RPI_VECTOR_START 0x0
void _cstart() {
// Zero out BSS
int* bss = &__bss_start__;
int* bss_end = &__bss_end__;
while (bss < bss_end)
*bss++ = 0;
/*
* Copy in interrupt vector and FIQ handler _vector and _vector_end are
* symbols defined in the interrupt assembly file, at the beginning and end of
* the vector and its embedded constants.
*/
int *vectorsdst = (int *)RPI_VECTOR_START;
int *vectors = &_vectors;
int *vectors_end = &_vectors_end;
while (vectors < vectors_end)
*vectorsdst++ = *vectors++;
main();
}