From 597bdded69366783f11e7d161a112724f18b158e Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Fri, 12 Jun 2020 00:46:21 -0700 Subject: [PATCH] fusee/exo2: more fixes to boot lower firmwares --- exosphere/Makefile | 8 +++++--- exosphere/program/source/smc/secmon_smc_aes.cpp | 2 +- fusee/fusee-secondary/src/nxboot.c | 6 +----- fusee/fusee-secondary/src/nxboot.h | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/exosphere/Makefile b/exosphere/Makefile index 8017acdef..00aca3834 100644 --- a/exosphere/Makefile +++ b/exosphere/Makefile @@ -14,11 +14,13 @@ exosphere.bin: program.lz4 boot_code.lz4 @printf LENY >> exosphere.bin @echo "Built exosphere.bin..." -program.lz4: - $(MAKE) -C program +program.lz4: build_program @cp program/program.lz4 program.lz4 @cp program/boot_code.lz4 boot_code.lz4 +build_program: + $(MAKE) -C program + warmboot.bin: $(MAKE) -C warmboot @cp warmboot/warmboot.bin warmboot.bin @@ -40,4 +42,4 @@ warmboot-clean: boot_code-clean: @rm -f boot_code.lz4 -.PHONY: all clean $(CLEAN_TARGETS) +.PHONY: all clean build_program $(CLEAN_TARGETS) diff --git a/exosphere/program/source/smc/secmon_smc_aes.cpp b/exosphere/program/source/smc/secmon_smc_aes.cpp index 7dabf7d43..60912e78a 100644 --- a/exosphere/program/source/smc/secmon_smc_aes.cpp +++ b/exosphere/program/source/smc/secmon_smc_aes.cpp @@ -572,7 +572,7 @@ namespace ams::secmon::smc { const u8 * const seal_key_source = SealKeySources[seal_key_type]; /* Decrypt the data. */ - if (!DecryptDeviceUniqueData(work_buffer, data_size, nullptr, seal_key_source, se::AesBlockSize, access_key, sizeof(access_key), key_source, sizeof(key_source), work_buffer, data_size, enforce_device_unique)) { + if (!DecryptDeviceUniqueData(work_buffer, data_size, nullptr, seal_key_source, se::AesBlockSize, access_key, se::AesBlockSize, key_source, se::AesBlockSize, work_buffer, data_size, enforce_device_unique)) { return SmcResult::InvalidArgument; } diff --git a/fusee/fusee-secondary/src/nxboot.c b/fusee/fusee-secondary/src/nxboot.c index 45a0bca02..6a87a34f1 100644 --- a/fusee/fusee-secondary/src/nxboot.c +++ b/fusee/fusee-secondary/src/nxboot.c @@ -954,11 +954,7 @@ uint32_t nxboot_main(void) { print(SCREEN_LOG_LEVEL_INFO, u8"[NXBOOT] Reading Exosphère...\n"); /* Select the right address for Exosphère. */ - if (MAILBOX_EXOSPHERE_CONFIGURATION->target_firmware < ATMOSPHERE_TARGET_FIRMWARE_4_0_0) { - exosphere_memaddr = (void *)0x4002D000; - } else { - exosphere_memaddr = (void *)0x40030000; - } + exosphere_memaddr = (void *)0x40030000; /* Copy Exosphère to a good location or read it directly to it. */ if (loader_ctx->exosphere_path[0] != '\0') { diff --git a/fusee/fusee-secondary/src/nxboot.h b/fusee/fusee-secondary/src/nxboot.h index 8c640e2f5..8d007b1f9 100644 --- a/fusee/fusee-secondary/src/nxboot.h +++ b/fusee/fusee-secondary/src/nxboot.h @@ -35,7 +35,7 @@ typedef struct { #define MAILBOX_NX_BOOTLOADER_BASE_100_620 0x40002E00 #define MAILBOX_NX_BOOTLOADER_BASE_700 0x40000000 -#define MAILBOX_NX_BOOTLOADER_BASE(targetfw) ((targetfw >= ATMOSPHERE_TARGET_FIRMWARE_7_0_0) ? (MAILBOX_NX_BOOTLOADER_BASE_700) : (MAILBOX_NX_BOOTLOADER_BASE_100_620)) +#define MAILBOX_NX_BOOTLOADER_BASE(targetfw) (MAILBOX_NX_BOOTLOADER_BASE_700) #define MAKE_MAILBOX_NX_BOOTLOADER_REG(targetfw, n) MAKE_REG32(MAILBOX_NX_BOOTLOADER_BASE(targetfw) + n) #define MAILBOX_NX_BOOTLOADER_BOOT_REASON_BASE(targetfw) (MAILBOX_NX_BOOTLOADER_BASE(targetfw) + 0x10)