Rewrote crt0, init, and chainloading code

start.s, init.c, linker.ld and linker.specs are meant
to be re-used by user applications, should they remove the defines
from init.c and the .chainloader* sections from the linker script
This commit is contained in:
TuxSH
2018-05-07 23:32:45 +02:00
parent 699ddfc043
commit e8306361f0
29 changed files with 848 additions and 185 deletions

View File

@@ -4,10 +4,22 @@
#include <stddef.h>
#include <stdint.h>
#define PAYLOAD_ARG_DATA_MAX_SIZE 0x1000
#define CHAINLOADER_ARG_DATA_MAX_SIZE 0x6200
#define CHAINLOADER_MAX_ENTRIES 128
extern uint8_t g_payload_arg_data[PAYLOAD_ARG_DATA_MAX_SIZE];
typedef struct chainloader_entry_t {
uintptr_t load_address;
uintptr_t src_address;
size_t size;
size_t num;
} chainloader_entry_t;
void relocate_and_chainload(uintptr_t load_address, uintptr_t src_address, size_t size, int argc);
extern chainloader_entry_t g_chainloader_entries[CHAINLOADER_MAX_ENTRIES]; /* keep them sorted */
extern size_t g_chainloader_num_entries;
extern uintptr_t g_chainloader_entrypoint;
extern char g_chainloader_arg_data[CHAINLOADER_ARG_DATA_MAX_SIZE];
void relocate_and_chainload(int argc);
#endif