diff --git a/wumsloader/src/globals.h b/wumsloader/src/globals.h index c973cbe..c71eaa9 100644 --- a/wumsloader/src/globals.h +++ b/wumsloader/src/globals.h @@ -17,15 +17,17 @@ extern std::vector gAllocatedAddresses; #define MEMORY_REGION_START 0x00800000 #define MEMORY_REGION_SIZE 0x00800000 -#define CUSTOM_RPX_LOADER_RETURN_CODE 0x00009000 // We have to skip the first 0x00009000 bytes because it's still used -#define RELOCATOR_SIZE 0x52000 // Maximum size of the wumsloader, needs to match the one defined in link.ld -#define ENVIRONMENT_PATH_LENGTH 0x100 // Length of the EnvironmentPath. -#define MEMORY_REGION_USABLE_MEM_REGION_END_LENGTH 0x04 // sizeof(uint32_t) +#define RELOCATOR_SIZE 0x50000 // Maximum size of the wumsloader, needs to match the one defined in link.ld +#define ENVIRONMENT_PATH_LENGTH 0x100 // Length of the EnvironmentPath. +#define MEMORY_REGION_USABLE_MEM_REGION_END_LENGTH 0x04 // sizeof(uint32_t) -#define MEMORY_REGION_ENVIRONMENT_STRING_ADRR (MEMORY_REGION_START + CUSTOM_RPX_LOADER_RETURN_CODE + RELOCATOR_SIZE) + +#define MEMORY_REGION_ENVIRONMENT_STRING_ADRR (MEMORY_REGION_START + RELOCATOR_SIZE) #define MEMORY_REGION_USABLE_MEM_REGION_END_VALUE_PTR ((uint32_t *) (MEMORY_REGION_ENVIRONMENT_STRING_ADRR + ENVIRONMENT_PATH_LENGTH)) #define MEMORY_REGION_USABLE_MEM_REGION_END_VALUE (*MEMORY_REGION_USABLE_MEM_REGION_END_VALUE_PTR) +// Technically we overwrite the CustomRPXLoader that is still loaded at 0x00800000... +// We can get away with it because the EnvironmentLoader exits instead of returning to the CustomRPXLoader. #define MEMORY_REGION_USABLE_HEAP_START ((uint32_t) MEMORY_REGION_USABLE_MEM_REGION_END_VALUE_PTR + MEMORY_REGION_USABLE_MEM_REGION_END_LENGTH) #define MEMORY_REGION_USABLE_HEAP_END MEMORY_REGION_USABLE_MEM_REGION_END_VALUE diff --git a/wumsloader/src/link.ld b/wumsloader/src/link.ld index 9817b48..ad09c45 100644 --- a/wumsloader/src/link.ld +++ b/wumsloader/src/link.ld @@ -3,7 +3,7 @@ OUTPUT(loader.elf); ENTRY(_start); SECTIONS { - . = 0x00809000; + . = 0x00800000; .text ALIGN(32) : { KEEP (*(.crt0)) KEEP (*(SORT_NONE(.init))) @@ -92,4 +92,4 @@ SECTIONS { } } -ASSERT((SIZEOF(.text) + SIZEOF(.data) + SIZEOF(.rodata) + SIZEOF(.eh_frame) + SIZEOF(.bss)) < 0x52000, "Memory overlapping with modules."); +ASSERT((SIZEOF(.text) + SIZEOF(.data) + SIZEOF(.rodata) + SIZEOF(.eh_frame) + SIZEOF(.bss)) < 0x50000, "Memory overlapping with modules.");