exo2: minor stack/mmu fixes, now gets to main on hw

This commit is contained in:
Michael Scire 2020-05-14 03:49:48 -07:00 committed by SciresM
parent 1fdd83628e
commit 27843314a4
4 changed files with 19 additions and 17 deletions

View file

@ -24,6 +24,7 @@ namespace ams::secmon::loader {
/* Uncompress the program image. */ /* Uncompress the program image. */
Uncompress(secmon::MemoryRegionPhysicalTzramFullProgramImage.GetPointer(), secmon::MemoryRegionPhysicalTzramFullProgramImage.GetSize(), program_lz4, program_lz4_size); Uncompress(secmon::MemoryRegionPhysicalTzramFullProgramImage.GetPointer(), secmon::MemoryRegionPhysicalTzramFullProgramImage.GetSize(), program_lz4, program_lz4_size);
/* Copy the boot image to the end of IRAM */ /* Copy the boot image to the end of IRAM */
u8 *relocated_boot_code = secmon::MemoryRegionPhysicalIramBootCodeImage.GetEndPointer<u8>() - boot_code_lz4_size; u8 *relocated_boot_code = secmon::MemoryRegionPhysicalIramBootCodeImage.GetEndPointer<u8>() - boot_code_lz4_size;
std::memcpy(relocated_boot_code, boot_code_lz4, boot_code_lz4_size); std::memcpy(relocated_boot_code, boot_code_lz4, boot_code_lz4_size);
@ -31,6 +32,7 @@ namespace ams::secmon::loader {
/* Uncompress the boot image. */ /* Uncompress the boot image. */
Uncompress(secmon::MemoryRegionPhysicalIramBootCodeImage.GetPointer(), secmon::MemoryRegionPhysicalIramBootCodeImage.GetSize(), relocated_boot_code, boot_code_lz4_size); Uncompress(secmon::MemoryRegionPhysicalIramBootCodeImage.GetPointer(), secmon::MemoryRegionPhysicalIramBootCodeImage.GetSize(), relocated_boot_code, boot_code_lz4_size);
/* Jump to the boot image. */ /* Jump to the boot image. */
reinterpret_cast<void (*)()>(secmon::MemoryRegionPhysicalIramBootCodeImage.GetAddress())(); reinterpret_cast<void (*)()>(secmon::MemoryRegionPhysicalIramBootCodeImage.GetAddress())();

View file

@ -95,7 +95,7 @@ _start:
ERRATUM_INVALIDATE_BTB_AT_BOOT ERRATUM_INVALIDATE_BTB_AT_BOOT
/* Set the stack pointer to a temporary location. */ /* Set the stack pointer to a temporary location. */
ldr x20, =0x7C010800 ldr x20, =0x7C020000
mov sp, x20 mov sp, x20
/* Call our init array functions. */ /* Call our init array functions. */

View file

@ -174,15 +174,15 @@ namespace ams::mmu::arch::arm64 {
} }
constexpr u64 MakeL1BlockEntry(u64 address, PageTableMappingAttribute attr) { constexpr u64 MakeL1BlockEntry(u64 address, PageTableMappingAttribute attr) {
return address | static_cast<u64>(attr) | 0x1ul; return address | static_cast<u64>(attr) | static_cast<u64>(PageTableMappingAttribute_AccessFlagAccessed) | 0x1ul;
} }
constexpr u64 MakeL2BlockEntry(u64 address, PageTableMappingAttribute attr) { constexpr u64 MakeL2BlockEntry(u64 address, PageTableMappingAttribute attr) {
return address | static_cast<u64>(attr) | 0x1ul; return address | static_cast<u64>(attr) | static_cast<u64>(PageTableMappingAttribute_AccessFlagAccessed) | 0x1ul;
} }
constexpr u64 MakeL3BlockEntry(u64 address, PageTableMappingAttribute attr) { constexpr u64 MakeL3BlockEntry(u64 address, PageTableMappingAttribute attr) {
return address | static_cast<u64>(attr) | 0x3ul; return address | static_cast<u64>(attr) | static_cast<u64>(PageTableMappingAttribute_AccessFlagAccessed) | 0x3ul;
} }
constexpr uintptr_t GetL2Offset(uintptr_t address) { constexpr uintptr_t GetL2Offset(uintptr_t address) {