Merge branch 'feature/memprot_test_app_v4.4' into 'release/v4.4'

memprot: Fix incorrect faulting address reported for esp32c3 (v4.4)

See merge request espressif/esp-idf!22583
This commit is contained in:
Mahavir Jain 2023-03-06 20:27:21 +08:00
commit 60b90c5144
2 changed files with 5 additions and 2 deletions

View File

@ -300,7 +300,7 @@ static inline uint32_t memprot_ll_iram0_get_monitor_status_fault_world(void)
static inline intptr_t memprot_ll_iram0_get_monitor_status_fault_addr(void)
{
uint32_t addr = REG_GET_FIELD(SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_IRAM0_PMS_MONITOR_VIOLATE_STATUS_ADDR);
return (intptr_t)(addr > 0 ? (addr << I_D_FAULT_ADDR_SHIFT) + IRAM0_ADDRESS_LOW : 0);
return (intptr_t)(addr > 0 ? (addr << I_D_FAULT_ADDR_SHIFT) + IRAM0_VIOLATE_STATUS_ADDR_OFFSET : 0);
}
static inline uint32_t memprot_ll_iram0_get_monitor_status_register(void)
@ -815,7 +815,7 @@ static inline uint32_t memprot_ll_dram0_get_monitor_status_fault_world(void)
static inline uint32_t memprot_ll_dram0_get_monitor_status_fault_addr(void)
{
uint32_t addr = REG_GET_FIELD(SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_2_REG, SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_VIOLATE_STATUS_ADDR);
return addr > 0 ? (addr << I_D_FAULT_ADDR_SHIFT) + DRAM0_ADDRESS_LOW : 0;
return addr > 0 ? (addr << I_D_FAULT_ADDR_SHIFT) + DRAM0_VIOLATE_STATUS_ADDR_OFFSET : 0;
}
static inline uint32_t memprot_ll_dram0_get_monitor_status_fault_wr(void)

View File

@ -35,6 +35,9 @@ typedef union {
#define DRAM_SRAM_START 0x3FC7C000
#define IRAM0_VIOLATE_STATUS_ADDR_OFFSET 0x40000000
#define DRAM0_VIOLATE_STATUS_ADDR_OFFSET 0x3C000000
#ifndef MAP_DRAM_TO_IRAM
#define MAP_DRAM_TO_IRAM(addr) (addr - DRAM_SRAM_START + SOC_IRAM_LOW)
#endif