[rtems commit] arm: Fix PMSA regions for contiguous sections

Sebastian Huber sebh at rtems.org
Wed Jun 8 07:04:42 UTC 2022


Module:    rtems
Branch:    master
Commit:    c93f0f01e5a260df008b568b74ca8bb7677e1bf5
Changeset: http://git.rtems.org/rtems/commit/?id=c93f0f01e5a260df008b568b74ca8bb7677e1bf5

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jun  3 08:27:57 2022 +0200

arm: Fix PMSA regions for contiguous sections

Sections with identical attributes may be contiguous with a respective
begin and end address which is not on a minimum region boundary.  The
begin address is aligned down to the region base address.  The end
address is aligned up to the region end address.  Account for this in
the check for contiguous sections.

Update #4202.

---

 cpukit/score/cpu/arm/aarch32-psma-init.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cpukit/score/cpu/arm/aarch32-psma-init.c b/cpukit/score/cpu/arm/aarch32-psma-init.c
index 3519104b21..543e1b7d9b 100644
--- a/cpukit/score/cpu/arm/aarch32-psma-init.c
+++ b/cpukit/score/cpu/arm/aarch32-psma-init.c
@@ -133,16 +133,16 @@ size_t _AArch32_PMSA_Map_sections_to_regions(
       if ( attr == region_attr ) {
         uint32_t region_end;
 
-        if ( end == region_base ) {
-          /* Extend the region region */
+        if ( end - region_base <= AARCH32_PMSA_MIN_REGION_ALIGN ) {
+          /* Extend the region */
           regions[ ri ].base = base;
           break;
         }
 
         region_end = region_limit + AARCH32_PMSA_MIN_REGION_ALIGN;
 
-        if ( base == region_end ) {
-          /* Extend the region region */
+        if ( region_end - base <= AARCH32_PMSA_MIN_REGION_ALIGN ) {
+          /* Extend the region */
           regions[ ri ].limit = limit;
           break;
         }



More information about the vc mailing list