|
Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
See rte_safe_ptr.h for behavior. More...
#include "rte/oal/memory/rte_safe_ptr.h"#include "rte/utils/cast/rte_cast.h"#include "rte/utils/safestate/rte_safety_violation.h"Go to the source code of this file.
Macros | |
| #define | RTE_SAFE_PTR_CANARY ((uint32_t)0x5AFE9021U) |
Functions | |
| rte_status_t | rte_safe_ptr_init (rte_safe_ptr_t *sp, void *ptr, size_t size) |
| Initializes sp to wrap [ptr, ptr + size), writing the canary. | |
| bool | rte_safe_ptr_is_valid (const rte_safe_ptr_t *sp) |
| Checks whether sp currently wraps a valid, non-invalidated region. | |
| rte_status_t | rte_safe_ptr_get (const rte_safe_ptr_t *sp, void **out_ptr) |
| Retrieves the wrapped pointer directly (the whole region, no offset) after validating it. | |
| rte_status_t | rte_safe_ptr_offset (const rte_safe_ptr_t *sp, size_t offset, size_t length, void **out_ptr) |
| Computes a bounds-checked pointer at offset within sp's region, verifying the caller's intended access of length bytes starting at offset stays within the wrapped region. | |
| void | rte_safe_ptr_invalidate (rte_safe_ptr_t *sp) |
| Invalidates sp: clears the wrapped pointer and the canary, so every subsequent access on sp fails RTE_STATUS_DATA_CORRUPTION. | |
See rte_safe_ptr.h for behavior.
Definition in file rte_safe_ptr.c.
| #define RTE_SAFE_PTR_CANARY ((uint32_t)0x5AFE9021U) |
Fixed canary value written by rte_safe_ptr_init() and checked by every access function - an arbitrary, distinctive bit pattern (not 0x00000000 or 0xFFFFFFFF, which a plain zeroed or all-ones-erased memory region could produce by coincidence).
Definition at line 15 of file rte_safe_ptr.c.