2014-03-31 16:33:24 +02:00
|
|
|
#include "types.h"
|
2014-03-23 18:40:31 +01:00
|
|
|
#include "string.h"
|
2014-03-31 16:33:24 +02:00
|
|
|
#include "cache.h"
|
|
|
|
#include "ios.h"
|
2014-03-24 19:59:24 +01:00
|
|
|
#include "usbgecko.h"
|
2014-03-23 18:40:31 +01:00
|
|
|
void _main(void)
|
|
|
|
{
|
2014-03-24 19:59:24 +01:00
|
|
|
usbgecko_init();
|
2014-03-31 16:33:24 +02:00
|
|
|
ios_cleanup(); //hopefully that wont disable any features
|
2014-03-24 19:59:24 +01:00
|
|
|
gprintf("Copying External Booter...\n");
|
2014-03-31 20:14:46 +02:00
|
|
|
u8 *start = (u8*)0x80A80000;
|
|
|
|
_memcpy(start, (u8*)0x90110000, 0xF0000); //960kb safe copying of booter
|
2014-03-31 16:33:24 +02:00
|
|
|
sync_after_write(start, 0xF0000);
|
2014-03-24 19:59:24 +01:00
|
|
|
gprintf("Done! Jumping to Entrypoint...\n");
|
2014-03-31 16:33:24 +02:00
|
|
|
asm volatile (
|
2014-03-31 20:31:24 +02:00
|
|
|
"lis %r3, 0x80A8\n"
|
|
|
|
"ori %r3, %r3, 0x0000\n"
|
2014-03-31 16:33:24 +02:00
|
|
|
"mtlr %r3\n"
|
|
|
|
"blr\n"
|
|
|
|
);
|
2014-03-31 20:14:46 +02:00
|
|
|
}
|
|
|
|
#include "memory.h"
|
|
|
|
#define SYSCALL_VECTOR ((u8*)0x80000C00)
|
|
|
|
void __init_syscall()
|
|
|
|
{
|
|
|
|
u8* sc_vector = SYSCALL_VECTOR;
|
|
|
|
u32 bytes = (u32)DCFlashInvalidate - (u32)__temp_abe;
|
|
|
|
u8* from = (u8*)__temp_abe;
|
|
|
|
for ( ; bytes != 0 ; --bytes )
|
|
|
|
{
|
|
|
|
*sc_vector = *from;
|
|
|
|
sc_vector++;
|
|
|
|
from++;
|
|
|
|
}
|
|
|
|
|
|
|
|
sync_after_write(SYSCALL_VECTOR, 0x100);
|
|
|
|
ICInvalidateRange(SYSCALL_VECTOR, 0x100);
|
2014-03-23 18:40:31 +01:00
|
|
|
}
|