1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-27 06:12:15 +00:00

Exosphere: Fix relocation bug (warmboot relocs currently broken in edge case)

This commit is contained in:
Michael Scire 2018-05-18 03:10:06 -06:00
parent e0a5acd0ba
commit 1a9f095463
3 changed files with 9 additions and 6 deletions

View file

@ -122,6 +122,7 @@ uintptr_t get_coldboot_crt0_stack_address(void) {
void coldboot_init(coldboot_crt0_reloc_list_t *reloc_list, uintptr_t start_cold) { void coldboot_init(coldboot_crt0_reloc_list_t *reloc_list, uintptr_t start_cold) {
//MAILBOX_NX_SECMON_BOOT_TIME = TIMERUS_CNTR_1US_0; //MAILBOX_NX_SECMON_BOOT_TIME = TIMERUS_CNTR_1US_0;
//MAKE_REG32(0x7000E400ULL) = 0x10;
/* Custom approach */ /* Custom approach */
reloc_list->reloc_base = start_cold; reloc_list->reloc_base = start_cold;

View file

@ -18,7 +18,7 @@
#define EXOSPHERE_TARGET_FIRMWARE_500 5 #define EXOSPHERE_TARGET_FIRMWARE_500 5
/* TODO: What should this be, for release? */ /* TODO: What should this be, for release? */
#define EXOSPHERE_TARGET_FIRMWARE_DEFAULT_FOR_DEBUG EXOSPHERE_TARGET_FIRMWARE_200 #define EXOSPHERE_TARGET_FIRMWARE_DEFAULT_FOR_DEBUG EXOSPHERE_TARGET_FIRMWARE_100
#define MAILBOX_BASE_PHYS (MMIO_GET_DEVICE_PA(MMIO_DEVID_NXBOOTLOADER_MAILBOX)) #define MAILBOX_BASE_PHYS (MMIO_GET_DEVICE_PA(MMIO_DEVID_NXBOOTLOADER_MAILBOX))

View file

@ -89,11 +89,13 @@ __start_cold:
cmp x0, x1 cmp x0, x1
beq _post_cold_crt0_reloc beq _post_cold_crt0_reloc
1: 1:
ldp x3, x4, [x0], #0x10 ldp x3, x4, [x1], #0x10
stp x3, x4, [x1], #0x10 stp x3, x4, [x0], #0x10
cmp x0, x2 cmp x0, x2
blo 1b blo 1b
adr x20, __start_cold
adr x19, g_coldboot_crt0_relocation_list
ldr x16, =_post_cold_crt0_reloc ldr x16, =_post_cold_crt0_reloc
br x16 br x16
@ -104,9 +106,9 @@ _post_cold_crt0_reloc:
mov sp, x0 mov sp, x0
mov fp, #0 mov fp, #0
adr x0, g_coldboot_crt0_relocation_list /* X1 is already set to __start_cold (original load location) from above. */
mov x19, x0 mov x0, x19
adr x1, __start_cold mov x1, x20
bl coldboot_init bl coldboot_init
ldr x16, =__jump_to_main_cold ldr x16, =__jump_to_main_cold