1
0
mirror of https://github.com/CTCaer/hekate.git synced 2024-12-25 06:18:11 +00:00

hos: Add exosphere no user exceptions handle cfg

This commit is contained in:
Kostas Missos 2019-09-09 17:00:13 +03:00
parent 718e502983
commit b74b449601
5 changed files with 32 additions and 15 deletions

View File

@ -679,7 +679,7 @@ int hos_launch(ini_sec_t *cfg)
// Config Exosphère if booting full Atmosphère. // Config Exosphère if booting full Atmosphère.
if (ctxt.atmosphere && ctxt.secmon) if (ctxt.atmosphere && ctxt.secmon)
config_exosphere(ctxt.pkg1_id->id, ctxt.pkg1_id->kb, (void *)ctxt.pkg1_id->warmboot_base, ctxt.stock); config_exosphere(&ctxt);
// Finalize MC carveout. // Finalize MC carveout.
if (ctxt.pkg1_id->kb <= KB_FIRMWARE_VERSION_301) if (ctxt.pkg1_id->kb <= KB_FIRMWARE_VERSION_301)

View File

@ -62,6 +62,7 @@ typedef struct _launch_ctxt_t
bool debugmode; bool debugmode;
bool stock; bool stock;
bool atmosphere; bool atmosphere;
bool exo_no_user_exceptions;
bool emuMMC; bool emuMMC;
ini_sec_t *cfg; ini_sec_t *cfg;

View File

@ -191,6 +191,16 @@ static int _config_atmosphere(launch_ctxt_t *ctxt, const char *value)
return 1; return 1;
} }
static int _config_dis_exo_user_exceptions(launch_ctxt_t *ctxt, const char *value)
{
if (*value == '1')
{
DPRINTF("Disabled exosphere user exception handlers\n");
ctxt->exo_no_user_exceptions = true;
}
return 1;
}
static int _config_fss(launch_ctxt_t *ctxt, const char *value) static int _config_fss(launch_ctxt_t *ctxt, const char *value)
{ {
return parse_fss(ctxt, value); return parse_fss(ctxt, value);
@ -212,6 +222,7 @@ static const cfg_handler_t _config_handlers[] = {
{ "debugmode", _config_debugmode }, { "debugmode", _config_debugmode },
{ "stock", _config_stock }, { "stock", _config_stock },
{ "atmosphere", _config_atmosphere }, { "atmosphere", _config_atmosphere },
{ "nouserexceptions", _config_dis_exo_user_exceptions },
{ "fss0", _config_fss }, { "fss0", _config_fss },
{ NULL, NULL }, { NULL, NULL },
}; };

View File

@ -134,8 +134,9 @@ typedef struct _atm_fatal_error_ctx
#define EXO_MAGIC_VAL 0x304F5845 #define EXO_MAGIC_VAL 0x304F5845
#define EXO_FLAG_DBG_PRIV (1 << 1) #define EXO_FLAG_DBG_PRIV (1 << 1)
#define EXO_FLAG_DBG_USER (1 << 2) #define EXO_FLAG_DBG_USER (1 << 2)
#define EXO_FLAG_NO_USER_EXC (1 << 3)
void config_exosphere(const char *id, u32 kb, void *warmboot, bool stock) void config_exosphere(launch_ctxt_t *ctxt)
{ {
u32 exoFwNo = 0; u32 exoFwNo = 0;
u32 exoFlags = 0; u32 exoFlags = 0;
@ -144,10 +145,10 @@ void config_exosphere(const char *id, u32 kb, void *warmboot, bool stock)
volatile exo_cfg_t *exo_cfg = (exo_cfg_t *)EXO_CFG_ADDR; volatile exo_cfg_t *exo_cfg = (exo_cfg_t *)EXO_CFG_ADDR;
switch (kb) switch (ctxt->pkg1_id->kb)
{ {
case KB_FIRMWARE_VERSION_100_200: case KB_FIRMWARE_VERSION_100_200:
if (!strcmp(id, "20161121183008")) if (!strcmp(ctxt->pkg1_id->id, "20161121183008"))
exoFwNo = 1; exoFwNo = 1;
else else
exoFwNo = 2; exoFwNo = 2;
@ -156,16 +157,20 @@ void config_exosphere(const char *id, u32 kb, void *warmboot, bool stock)
exoFwNo = 3; exoFwNo = 3;
break; break;
default: default:
exoFwNo = kb + 1; exoFwNo = ctxt->pkg1_id->kb + 1;
if (!strcmp(id, "20190314172056") || !strcmp(id, "20190531152432")) if (!strcmp(ctxt->pkg1_id->id, "20190314172056") || !strcmp(ctxt->pkg1_id->id, "20190531152432"))
exoFwNo++; // ATM_TARGET_FW_800/810. exoFwNo++; // ATM_TARGET_FW_800/810.
break; break;
} }
// To avoid problems, make private debug mode always on if not semi-stock. // To avoid problems, make private debug mode always on if not semi-stock.
if (!stock || (emu_cfg.enabled && !h_cfg.emummc_force_disable)) if (!ctxt->stock || (emu_cfg.enabled && !h_cfg.emummc_force_disable))
exoFlags |= EXO_FLAG_DBG_PRIV; exoFlags |= EXO_FLAG_DBG_PRIV;
// Disable proper failure handling.
if (ctxt->exo_no_user_exceptions)
exoFlags |= EXO_FLAG_NO_USER_EXC;
// Set mailbox values. // Set mailbox values.
exo_cfg->magic = EXO_MAGIC_VAL; exo_cfg->magic = EXO_MAGIC_VAL;
@ -174,7 +179,7 @@ void config_exosphere(const char *id, u32 kb, void *warmboot, bool stock)
exo_cfg->flags = exoFlags; exo_cfg->flags = exoFlags;
// If warmboot is lp0fw, add in RSA modulus. // If warmboot is lp0fw, add in RSA modulus.
volatile wb_cfg_t *wb_cfg = (wb_cfg_t *)(warmboot + ATM_WB_HEADER_OFF); volatile wb_cfg_t *wb_cfg = (wb_cfg_t *)(ctxt->pkg1_id->warmboot_base + ATM_WB_HEADER_OFF);
if (wb_cfg->magic == ATM_WB_MAGIC) if (wb_cfg->magic == ATM_WB_MAGIC)
{ {
@ -197,7 +202,7 @@ void config_exosphere(const char *id, u32 kb, void *warmboot, bool stock)
else else
rsa_mod[0x10] = 0x37; rsa_mod[0x10] = 0x37;
memcpy(warmboot + 0x10, rsa_mod + 0x10, 0x100); memcpy((void *)(ctxt->pkg1_id->warmboot_base + 0x10), rsa_mod + 0x10, 0x100);
} }
if (emu_cfg.enabled && !h_cfg.emummc_force_disable) if (emu_cfg.enabled && !h_cfg.emummc_force_disable)
@ -212,9 +217,9 @@ void config_exosphere(const char *id, u32 kb, void *warmboot, bool stock)
else else
strcpy((char *)exo_cfg->emummc_cfg.file_cfg.path, emu_cfg.path); strcpy((char *)exo_cfg->emummc_cfg.file_cfg.path, emu_cfg.path);
if (emu_cfg.nintendo_path && !stock) if (emu_cfg.nintendo_path && !ctxt->stock)
strcpy((char *)exo_cfg->emummc_cfg.nintendo_path, emu_cfg.nintendo_path); strcpy((char *)exo_cfg->emummc_cfg.nintendo_path, emu_cfg.nintendo_path);
else if (stock) else if (ctxt->stock)
strcpy((char *)exo_cfg->emummc_cfg.nintendo_path, "Nintendo"); strcpy((char *)exo_cfg->emummc_cfg.nintendo_path, "Nintendo");
else else
exo_cfg->emummc_cfg.nintendo_path[0] = 0; exo_cfg->emummc_cfg.nintendo_path[0] = 0;

View File

@ -19,7 +19,7 @@
#include "../utils/types.h" #include "../utils/types.h"
void config_exosphere(const char *id, u32 kb, void *warmboot, bool stock); void config_exosphere(launch_ctxt_t *ctxt);
void secmon_exo_check_panic(); void secmon_exo_check_panic();
#endif #endif