-
- Downloads
Increase type widths to satisfy width requirements
Usually, C has no problem up-converting types to larger bit sizes. MISRA
rule 10.7 requires that you not do this, or be very explicit about this.
This resolves the following required rule:
bl1/aarch64/bl1_context_mgmt.c:81:[MISRA C-2012 Rule 10.7 (required)]<None>
The width of the composite expression "0U | ((mode & 3U) << 2U) | 1U |
0x3c0U" (32 bits) is less that the right hand operand
"18446744073709547519ULL" (64 bits).
This also resolves MISRA defects such as:
bl2/aarch64/bl2arch_setup.c:18:[MISRA C-2012 Rule 12.2 (required)]
In the expression "3U << 20", shifting more than 7 bits, the number
of bits in the essential type of the left expression, "3U", is
not allowed.
Further, MISRA requires that all shifts don't overflow. The definition of
PAGE_SIZE was (1U << 12), and 1U is 8 bits. This caused about 50 issues.
This fixes the violation by changing the definition to 1UL << 12. Since
this uses 32bits, it should not create any issues for aarch32.
This patch also contains a fix for a build failure in the sun50i_a64
platform. Specifically, these misra fixes removed a single and
instruction,
92407e73 and x19, x19, #0xffffffff
from the cm_setup_context function caused a relocation in
psci_cpus_on_start to require a linker-generated stub. This increased the
size of the .text section and caused an alignment later on to go over a
page boundary and round up to the end of RAM before placing the .data
section. This sectionn is of non-zero size and therefore causes a link
error.
The fix included in this reorders the functions during link time
without changing their ording with respect to alignment.
Change-Id: I76b4b662c3d262296728a8b9aab7a33b02087f16
Signed-off-by:
Jimmy Brisson <jimmy.brisson@arm.com>
Showing
- bl1/aarch64/bl1_context_mgmt.c 2 additions, 2 deletionsbl1/aarch64/bl1_context_mgmt.c
- bl31/bl31.ld.S 1 addition, 1 deletionbl31/bl31.ld.S
- bl32/tsp/aarch64/tsp_entrypoint.S 1 addition, 1 deletionbl32/tsp/aarch64/tsp_entrypoint.S
- common/bl_common.c 2 additions, 2 deletionscommon/bl_common.c
- drivers/arm/cci/cci.c 3 additions, 3 deletionsdrivers/arm/cci/cci.c
- drivers/arm/tzc/tzc400.c 3 additions, 3 deletionsdrivers/arm/tzc/tzc400.c
- drivers/arm/tzc/tzc_common_private.h 9 additions, 9 deletionsdrivers/arm/tzc/tzc_common_private.h
- include/arch/aarch32/arch.h 15 additions, 15 deletionsinclude/arch/aarch32/arch.h
- include/arch/aarch64/arch.h 22 additions, 22 deletionsinclude/arch/aarch64/arch.h
- include/arch/aarch64/el3_common_macros.S 1 addition, 1 deletioninclude/arch/aarch64/el3_common_macros.S
- include/export/common/ep_info_exp.h 5 additions, 5 deletionsinclude/export/common/ep_info_exp.h
- include/lib/pmf/pmf.h 5 additions, 5 deletionsinclude/lib/pmf/pmf.h
- include/lib/pmf/pmf_helpers.h 9 additions, 7 deletionsinclude/lib/pmf/pmf_helpers.h
- include/lib/smccc.h 4 additions, 3 deletionsinclude/lib/smccc.h
- include/lib/xlat_tables/xlat_tables_defs.h 3 additions, 3 deletionsinclude/lib/xlat_tables/xlat_tables_defs.h
- lib/aarch64/misc_helpers.S 3 additions, 3 deletionslib/aarch64/misc_helpers.S
- lib/el3_runtime/aarch64/context_mgmt.c 2 additions, 2 deletionslib/el3_runtime/aarch64/context_mgmt.c
- lib/psci/psci_common.c 4 additions, 2 deletionslib/psci/psci_common.c
- lib/xlat_tables_v2/xlat_tables_utils.c 4 additions, 4 deletionslib/xlat_tables_v2/xlat_tables_utils.c
- plat/arm/common/arm_common.c 1 addition, 1 deletionplat/arm/common/arm_common.c
Loading
Please register or sign in to comment