This commit is contained in:
kristina 2016-05-21 03:42:50 +01:00
parent c90348397a
commit f9187ed13a

View File

@ -2,6 +2,27 @@
#include <chainloader.h>
#include <hardware.h>
void main() {
printf("%s: arm_chainloader started on ARM, continuing boot from here ...\n", __FUNCTION__);
extern uintptr_t* __init_array_start;
extern uintptr_t* __init_array_end;
#define logf(fmt, ...) printf("[startup::%s]: " fmt, __FUNCTION__, ##__VA_ARGS__);
void cxx_init() {
unsigned ctor_count = (unsigned)(&__init_array_end - &__init_array_start);
void (*static_ctor)();
logf("calling %d static constructors (0x%X - 0x%X) ...\n", ctor_count, &__init_array_start, &__init_array_end);
for (unsigned i = 0; i < ctor_count; i++) {
uintptr_t* ptr = (((uintptr_t*)&__init_array_start) + i);
static_ctor = (void*)*ptr;
static_ctor();
}
}
void main() {
logf("started on ARM, continuing boot from here ...\n", __FUNCTION__);
/* c++ runtime */
cxx_init();
}