arm: core: mpu: Prevent updating unexpected region
The REGION bits (bit[3:0]) of MPU_RBAR register can specify the number of the region to update if the VALID bit (bit[4]) is also set. If the bit[3:0] of "region_addr" are not zero, might cause to update unexpected region. This could happen since we might not declare stack memory with specific alignment. This patch will mask the bit[4:0] of "region_addr" to prevent updating unexpected region. Signed-off-by: Chunlin Han <chunlin.han@linaro.org>
This commit is contained in:
parent
b520075788
commit
e125e5b9c6
2 changed files with 5 additions and 1 deletions
|
@ -64,7 +64,8 @@ static void _region_init(u32_t index, u32_t region_addr,
|
|||
/* Select the region you want to access */
|
||||
ARM_MPU_DEV->rnr = index;
|
||||
/* Configure the region */
|
||||
ARM_MPU_DEV->rbar = region_addr | REGION_VALID | index;
|
||||
ARM_MPU_DEV->rbar = (region_addr & REGION_BASE_ADDR_MASK)
|
||||
| REGION_VALID | index;
|
||||
ARM_MPU_DEV->rasr = region_attr | REGION_ENABLE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue