mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 20:41:14 +00:00
spi_flash: Flush flash cache if flash_mmap()ing a written-to page
Without this, it's possible for stale information to be read from cache via mmap, even if the MMU table entry had been invalidated prior to writing flash (if the same MMU table entry was re-used after writing flash.)
This commit is contained in:

committed by
Ivan Grokhotkov

parent
95c150fe2c
commit
36ccdee6ec
@@ -48,4 +48,12 @@ void spi_flash_disable_interrupts_caches_and_other_cpu_no_os();
|
||||
// This function is implied to be called when other CPU is not running or running code from IRAM.
|
||||
void spi_flash_enable_interrupts_caches_no_os();
|
||||
|
||||
// Mark the pages containing a flash region as having been
|
||||
// erased or written to. This means the flash cache needs
|
||||
// to be evicted before these pages can be flash_mmap()ed again,
|
||||
// as they may contain stale data
|
||||
//
|
||||
// Only call this while holding spi_flash_op_lock()
|
||||
void spi_flash_mark_modified_region(uint32_t start_addr, uint32_t length);
|
||||
|
||||
#endif //ESP_SPI_FLASH_CACHE_UTILS_H
|
||||
|
Reference in New Issue
Block a user