fix(memory-utils): Add _instruction_reserved_start/end to esp_psram_check_ptr_addr

Adds missing range check that can be used when SPIRAM_XIP_FROM_PSRAM is enabled.
This commit is contained in:
John Boiles
2025-05-20 20:23:39 -07:00
committed by armando
parent a2b21a9070
commit 9faf8c3a52

View File

@@ -56,6 +56,7 @@ extern uint8_t _rodata_reserved_end;
#endif /* CONFIG_SPIRAM_RODATA */
#if CONFIG_SPIRAM_FETCH_INSTRUCTIONS
extern uint8_t _instruction_reserved_start;
extern uint8_t _instruction_reserved_end;
#endif /* CONFIG_SPIRAM_FETCH_INSTRUCTIONS */
@@ -467,6 +468,12 @@ bool IRAM_ATTR esp_psram_check_ptr_addr(const void *p)
}
#endif /* CONFIG_SPIRAM_FETCH_INSTRUCTIONS && SOC_MMU_DI_VADDR_SHARED */
#if CONFIG_SPIRAM_FETCH_INSTRUCTIONS
if ((intptr_t)p >= (uint32_t)&_instruction_reserved_start && (intptr_t)p < (uint32_t)&_instruction_reserved_end) {
return true;
}
#endif /* CONFIG_SPIRAM_FETCH_INSTRUCTIONS */
return false;
}