x1000: add function for booting linux kernels

Change-Id: I0750b084fe88d21a8686daf0681b32b1dcba8fec
This commit is contained in:
Aidan MacDonald 2022-03-04 00:59:39 +00:00
parent e6c2f26e82
commit a87f93d8ff
2 changed files with 32 additions and 0 deletions

View file

@ -102,6 +102,35 @@ void x1000_boot_rockbox(const void* source, size_t length)
while(1);
}
void x1000_boot_linux(const void* source, size_t length,
void* load, void* entry, const char* args)
{
size_t args_len = strlen(args);
disable_irq();
/* --- Beyond this point, do not call into DRAM --- */
void* safe_mem = (void*)X1000_IRAM_END;
/* copy argument string to a safe location */
char* args_copy = safe_mem + 32;
iram_memmove(args_copy, args, args_len);
/* generate argv array */
char** argv = safe_mem;
argv[0] = NULL;
argv[1] = args_copy;
iram_memmove(load, source, length);
commit_discard_idcache();
typedef void(*entry_fn)(long, char**, long, long);
entry_fn fn = (entry_fn)entry;
fn(2, argv, 0, 0);
while(1);
}
void rolo_restart(const unsigned char* source, unsigned char* dest, int length)
{
(void)dest;

View file

@ -47,6 +47,9 @@ enum {
void x1000_boot_rockbox(const void* source, size_t length)
__attribute__((section(".icode")));
void x1000_boot_linux(const void* source, size_t length,
void* load, void* entry, const char* args)
__attribute__((section(".icode")));
/* Note: these functions are inlined to minimize SPL code size.
* They are private to the X1000 early boot code anyway... */