mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 09:09:10 -04:00
fix(memory-utils): Missing case in esp_ptr_executable logic
esp_ptr_executable does not consider that the PSRAM and FLASH memory mapping are not always matching. Added a "pointer is in PSRAM" specific check in the logic to fix the issue.
This commit is contained in:
parent
68b79fc138
commit
92d575379f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2010-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -29,6 +29,24 @@ bool esp_ptr_dma_ext_capable(const void *p)
|
||||
#endif //CONFIG_SPIRAM
|
||||
}
|
||||
|
||||
bool esp_ptr_executable(const void *p)
|
||||
{
|
||||
intptr_t ip = (intptr_t) p;
|
||||
return (ip >= SOC_IROM_LOW && ip < SOC_IROM_HIGH)
|
||||
|| (ip >= SOC_IRAM_LOW && ip < SOC_IRAM_HIGH)
|
||||
|| (ip >= SOC_IROM_MASK_LOW && ip < SOC_IROM_MASK_HIGH)
|
||||
#if SOC_SPIRAM_SUPPORTED && CONFIG_SPIRAM
|
||||
|| esp_ptr_external_ram(p)
|
||||
#endif
|
||||
#if defined(SOC_CACHE_APP_LOW) && defined(CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE)
|
||||
|| (ip >= SOC_CACHE_APP_LOW && ip < SOC_CACHE_APP_HIGH)
|
||||
#endif
|
||||
#if SOC_RTC_FAST_MEM_SUPPORTED
|
||||
|| (ip >= SOC_RTC_IRAM_LOW && ip < SOC_RTC_IRAM_HIGH)
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
bool esp_ptr_byte_accessible(const void *p)
|
||||
{
|
||||
intptr_t ip = (intptr_t) p;
|
||||
|
@ -246,21 +246,7 @@ inline static bool esp_ptr_word_aligned(const void *p)
|
||||
*
|
||||
* @return true: is executable; false: not executable
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
inline static bool esp_ptr_executable(const void *p)
|
||||
{
|
||||
intptr_t ip = (intptr_t) p;
|
||||
return (ip >= SOC_IROM_LOW && ip < SOC_IROM_HIGH)
|
||||
|| (ip >= SOC_IRAM_LOW && ip < SOC_IRAM_HIGH)
|
||||
|| (ip >= SOC_IROM_MASK_LOW && ip < SOC_IROM_MASK_HIGH)
|
||||
#if defined(SOC_CACHE_APP_LOW) && defined(CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE)
|
||||
|| (ip >= SOC_CACHE_APP_LOW && ip < SOC_CACHE_APP_HIGH)
|
||||
#endif
|
||||
#if SOC_RTC_FAST_MEM_SUPPORTED
|
||||
|| (ip >= SOC_RTC_IRAM_LOW && ip < SOC_RTC_IRAM_HIGH)
|
||||
#endif
|
||||
;
|
||||
}
|
||||
bool esp_ptr_executable(const void *p);
|
||||
|
||||
/**
|
||||
* @brief Check if the pointer is byte accessible
|
||||
|
Loading…
x
Reference in New Issue
Block a user