Add debug region to mapped memory

This commit is contained in:
Michael Scire 2018-03-07 04:00:19 -08:00
parent b26b8e1f5c
commit 6592744b3b
5 changed files with 20 additions and 1 deletions

View file

@ -150,6 +150,8 @@ void clear_priv_smc_in_progress(void) {
uint32_t (*g_smc_callback)(void *, uint64_t) = NULL;
uint64_t g_smc_callback_key = 0;
static _Atomic(int) g_num_smcs_called = 0;
uint64_t try_set_smc_callback(uint32_t (*callback)(void *, uint64_t)) {
uint64_t key;
if (g_smc_callback_key) {
@ -198,6 +200,13 @@ void call_smc_handler(uint32_t handler_id, smc_args_t *args) {
if ((smc_handler = g_smc_tables[handler_id].handlers[smc_id].handler) == NULL) {
generic_panic();
}
int num_called = atomic_fetch_add(&g_num_smcs_called, 1);
/* DEBUG: use num_called to determine panic behavior. */
if (num_called == 0x30) {
/* panic(COLOR_F); */
}
/* Call function. */
args->X[0] = smc_handler(args);