Skip to content

Commit 0e68077

Browse files
johnboilesIcarus113
authored andcommitted
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.
1 parent 6287650 commit 0e68077

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

components/esp_psram/system_layer/esp_psram.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ extern uint8_t _rodata_reserved_end;
6666
#endif /* CONFIG_SPIRAM_RODATA */
6767

6868
#if CONFIG_SPIRAM_FETCH_INSTRUCTIONS
69+
extern uint8_t _instruction_reserved_start;
6970
extern uint8_t _instruction_reserved_end;
7071
#endif /* CONFIG_SPIRAM_FETCH_INSTRUCTIONS */
7172

@@ -483,6 +484,12 @@ bool IRAM_ATTR esp_psram_check_ptr_addr(const void *p)
483484
}
484485
#endif /* CONFIG_SPIRAM_FETCH_INSTRUCTIONS && SOC_MMU_DI_VADDR_SHARED */
485486

487+
#if CONFIG_SPIRAM_FETCH_INSTRUCTIONS
488+
if ((intptr_t)p >= (uint32_t)&_instruction_reserved_start && (intptr_t)p < (uint32_t)&_instruction_reserved_end) {
489+
return true;
490+
}
491+
#endif /* CONFIG_SPIRAM_FETCH_INSTRUCTIONS */
492+
486493
return false;
487494
}
488495

0 commit comments

Comments
 (0)