Exosphere: Fix crash for certain games on newer firmwares

This commit is contained in:
Michael Scire 2018-08-20 19:31:15 -07:00
parent b5234e9efb
commit c40bb9b317

View file

@ -25,6 +25,7 @@
#define SMC_PRIV_HANDLERS 0x9
#define DEBUG_LOG_SMCS 0
#define DEBUG_PANIC_ON_FAILURE 0
/* User SMC prototypes */
uint32_t smc_set_config(smc_args_t *args);
@ -260,6 +261,7 @@ void call_smc_handler(uint32_t handler_id, smc_args_t *args) {
}
#endif
#if DEBUG_PANIC_ON_FAILURE
if (args->X[0] && (!is_aes_kek || args->X[3] <= EXOSPHERE_TARGET_FIRMWARE_DEFAULT_FOR_DEBUG))
{
MAKE_REG32(get_iram_address_for_debug() + 0x4FF0) = handler_id;
@ -268,6 +270,9 @@ void call_smc_handler(uint32_t handler_id, smc_args_t *args) {
*(volatile smc_args_t *)(get_iram_address_for_debug() + 0x4F00) = *args;
panic(PANIC_REBOOT);
}
#else
(void)(is_aes_kek);
#endif
(void)result; /* FIXME: result unused */
}
@ -636,9 +641,11 @@ uint32_t smc_configure_carveout(smc_args_t *args) {
}
/* Configuration is one-shot, and cannot be done multiple times. */
if (exosphere_get_target_firmware() < EXOSPHERE_TARGET_FIRMWARE_300) {
if (g_configured_carveouts[carveout_id]) {
return 2;
}
}
configure_kernel_carveout(carveout_id + 4, address, size);
g_configured_carveouts[carveout_id] = true;