From 97d3b745d90b580cd316d82359094aa43cdb0f56 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Sun, 8 Dec 2019 03:02:17 +0200 Subject: [PATCH] exo: Add support for user access to PMU flag --- bootloader/hos/hos.h | 1 + bootloader/hos/hos_config.c | 11 +++++++++++ bootloader/hos/secmon_exo.c | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/bootloader/hos/hos.h b/bootloader/hos/hos.h index 428eb78..0888784 100644 --- a/bootloader/hos/hos.h +++ b/bootloader/hos/hos.h @@ -65,6 +65,7 @@ typedef struct _launch_ctxt_t bool stock; bool atmosphere; bool exo_no_user_exceptions; + bool exo_user_pmu; bool emuMMC; ini_sec_t *cfg; diff --git a/bootloader/hos/hos_config.c b/bootloader/hos/hos_config.c index ab235b7..7d68713 100644 --- a/bootloader/hos/hos_config.c +++ b/bootloader/hos/hos_config.c @@ -201,6 +201,16 @@ static int _config_dis_exo_user_exceptions(launch_ctxt_t *ctxt, const char *valu return 1; } +static int _config_exo_user_pmu_access(launch_ctxt_t *ctxt, const char *value) +{ + if (*value == '1') + { + DPRINTF("Enabled user access to PMU\n"); + ctxt->exo_user_pmu = true; + } + return 1; +} + static int _config_fss(launch_ctxt_t *ctxt, const char *value) { return parse_fss(ctxt, value); @@ -223,6 +233,7 @@ static const cfg_handler_t _config_handlers[] = { { "stock", _config_stock }, { "atmosphere", _config_atmosphere }, { "nouserexceptions", _config_dis_exo_user_exceptions }, + { "userpmu", _config_exo_user_pmu_access }, { "fss0", _config_fss }, { NULL, NULL }, }; diff --git a/bootloader/hos/secmon_exo.c b/bootloader/hos/secmon_exo.c index d0f92ac..7419746 100644 --- a/bootloader/hos/secmon_exo.c +++ b/bootloader/hos/secmon_exo.c @@ -135,6 +135,7 @@ typedef struct _atm_fatal_error_ctx #define EXO_FLAG_DBG_PRIV (1 << 1) #define EXO_FLAG_DBG_USER (1 << 2) #define EXO_FLAG_NO_USER_EXC (1 << 3) +#define EXO_FLAG_USER_PMU (1 << 4) void config_exosphere(launch_ctxt_t *ctxt) { @@ -172,6 +173,10 @@ void config_exosphere(launch_ctxt_t *ctxt) if (ctxt->exo_no_user_exceptions) exoFlags |= EXO_FLAG_NO_USER_EXC; + // Enable user access to PMU. + if (ctxt->exo_user_pmu) + exoFlags |= EXO_FLAG_USER_PMU; + // Set mailbox values. exo_cfg->magic = EXO_MAGIC_VAL;