Commit 807283b
RISC-V: change pointer and stack types
portPOINTER_SIZE_TYPE is used in FreeRTOS to store both pointer and
integer values. Using a plain integer type for this purpose is unsafe on
architectures that distinguish between pointers and integers, where an
integer type (e.g. uint64_t) may not be able to represent all pointer
values.
The standard intptr_t type is explicitly defined to safely hold either a
pointer or an integer. This commit changes portPOINTER_SIZE_TYPE to
intptr_t, similar to the existing POSIX port, improving portability of
the RISC-V port.
Similarly, portSTACK_TYPE is used to store word-sized values on the
stack that may represent either integers or pointers, and is often cast
to pointer types. Changing it to uintptr_t makes this usage explicit and
correct, improving portability, intent, and safety for capability-based
extensions such as CHERI-RISC-V.
Signed-off-by: Hesham Almatary <Hesham.Almatary@cl.cam.ac.uk>1 parent f1043c4 commit 807283b
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | | - | |
56 | 54 | | |
57 | | - | |
58 | 55 | | |
59 | 56 | | |
60 | 57 | | |
61 | 58 | | |
62 | 59 | | |
63 | 60 | | |
64 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
0 commit comments