Skip to content

Commit 294945f

Browse files
committed
armv9: document Armv9 port MISRA deviations in MISRA.md
Add three new deviation entries for the ARM_AARCH64_ARMV9 port: - Directive 4.3 (inline assembly): required to access AArch64 system registers with no C equivalent; confined to the port layer - Rule 5.8 (identifier reuse): pvPortMalloc/vPortFree macro redirect to MTE-tagged wrappers, isolating tagging logic in the port - Rule 11.6 (pointer-to-integer cast): MTE tag stripping requires masking pointer bits 56-59 via uintptr_t to recover canonical address
1 parent d18a43e commit 294945f

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

MISRA.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ with ( Assuming rule 8.4 violation; with justification in point 1 ):
1818
grep 'MISRA Ref 8.4.1' . -rI
1919
```
2020

21+
#### Dir 4.3
22+
23+
MISRA C:2012 Dir 4.3: Assembly language shall be encapsulated and isolated.
24+
25+
_Ref 4.3.1_
26+
- AArch64 port files (portable/GCC/ARM_AARCH64_ARMV9/) use inline assembly
27+
to access system registers (GIC, generic timer, PAC keys, MTE, SVE
28+
configuration) that have no C-language equivalent. Assembly is confined to
29+
the port layer and isolated from application code.
30+
2131
#### Dir 4.7
2232

2333
MISRA C:2012 Dir 4.7: If a function returns error information, then that error
@@ -116,6 +126,31 @@ _Ref 11.5.5_
116126
because data storage buffers are implemented as uint8_t arrays for the
117127
ease of sizing, alignment and access.
118128

129+
#### Rule 5.8
130+
131+
MISRA C:2012 Rule 5.8: Identifiers that define objects or functions with
132+
external linkage shall be unique.
133+
134+
_Ref 5.8.1_
135+
- The Armv9 port (portable/GCC/ARM_AARCH64_ARMV9/portmacro.h) defines macros
136+
that redirect `pvPortMalloc` and `vPortFree` to MTE-tagged wrapper functions
137+
when `configARMV9_MTE_HEAP == 1`. This keeps MTE heap tagging logic isolated
138+
in the port without modifying shared upstream kernel files. An alternative
139+
that eliminates this deviation (integrating tagging into heap_4.c) is
140+
documented in the source.
141+
142+
#### Rule 11.6
143+
144+
MISRA C:2012 Rule 11.6: A cast shall not be performed between a pointer to void
145+
and an arithmetic type.
146+
147+
_Ref 11.6.1_
148+
- The Armv9 MTE port (portable/GCC/ARM_AARCH64_ARMV9/mte_port.c) casts
149+
between pointer and uintptr_t to strip the MTE tag bits (top byte) from
150+
tagged pointers before passing them to the underlying allocator. This is
151+
required because MTE tags are encoded in pointer bits 56-59 and must be
152+
removed to recover the canonical address.
153+
119154
#### Rule 14.3
120155

121156
MISRA C-2012 Rule 14.3: Controlling expressions shall not be invariant.

0 commit comments

Comments
 (0)