|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
First-party porting header for the vendored xz-embedded decoder. More...
#include <stddef.h>#include <stdint.h>#include <string.h>#include "unarch_xz_pool.h"#include "xz.h"Go to the source code of this file.
Macros | |
| #define | XZ_DEC_PREALLOC |
| Enable xz-embedded's preallocated-dictionary streaming mode. | |
| #define | XZ_USE_CRC64 |
| Verify CRC64 block/stream checks (the xz(1) default). | |
| #define | kmalloc(size, flags) |
| xz-embedded allocator seam -> zero-heap bump arena (state structs). | |
| #define | kfree(ptr) |
| xz-embedded free seam – no-op under arena semantics. | |
| #define | vmalloc(size) |
| xz-embedded large-allocation seam (dictionary) -> same bump arena. | |
| #define | vfree(ptr) |
| xz-embedded large-free seam – no-op under arena semantics. | |
| #define | memeq(a, b, size) |
| Byte-equality shim the SOUP uses for magic/footer comparison. | |
| #define | memzero(buf, size) |
| Zero-fill shim the SOUP uses to reset decoder state. | |
| #define | min(x, y) |
| Untyped minimum shim used by the SOUP's buffer clamping. | |
| #define | min_t(type, x, y) |
| Typed minimum shim used by the SOUP's buffer clamping. | |
| #define | fallthrough [[fallthrough]] |
| Explicit switch-case fall-through marker for the SOUP sources. | |
| #define | __always_inline [[gnu::always_inline]] inline |
| Kernel-style force-inline marker used by the SOUP hot paths. | |
| #define | get_unaligned_le32(buf) |
| SOUP porting alias onto ra8_xz_cfg_get_unaligned_le32. | |
| #define | get_le32(buf) |
| SOUP porting alias: aligned LE32 load via the unaligned helper. | |
Enumerations | |
| enum | ra8_xz_cfg_shift_t : uint8_t { k_ra8_xz_cfg_shift_b1 = 8U , k_ra8_xz_cfg_shift_b2 = 16U , k_ra8_xz_cfg_shift_b3 = 24U } |
| Byte-lane shift distances for the little-endian load shim. More... | |
Functions | |
| static uint32_t | ra8_xz_cfg_get_unaligned_le32 (const uint8_t *buf) |
| Load an unaligned little-endian 32-bit value byte by byte. | |
First-party porting header for the vendored xz-embedded decoder.
xz-embedded (SOUP, apps/shared_libs/third_party/xz_embedded/) is written against the Linux kernel environment; outside the kernel its private header includes a platform-supplied "xz_config.h" for the allocator, byte-order, and compiler shims. This is that platform header for ra8-firmware. It exists so the vendored tree stays byte-identical to upstream (no local patches; the SBOM records modified: false) while the decoder's allocations route through the zero-heap bump arena in unarch_xz_pool.h (NASA P10 Rule 3 – this firmware traps _sbrk).
The macro names below (kmalloc, memeq, min_t, ...) are not this project's choice: they are the exact porting contract the SOUP sources consume, so they cannot be renamed to project conventions. Every macro here is the allowed "conditional compilation / porting seam" kind – none defines a bare integer constant.
Feature selection (compile-time, decode-only):
Definition in file xz_config.h.
| #define __always_inline [[gnu::always_inline]] inline |
Kernel-style force-inline marker used by the SOUP hot paths.
Always inline.
Kept as a plain attribute-inline mapping; the decoder is fast enough on the M85 without further tuning.
Definition at line 194 of file xz_config.h.
| #define fallthrough [[fallthrough]] |
Explicit switch-case fall-through marker for the SOUP sources.
Fallthrough.
Maps to the C23 attribute so -Wimplicit-fallthrough stays meaningful inside the vendored decoder.
Definition at line 181 of file xz_config.h.
| #define get_le32 | ( | buf | ) |
SOUP porting alias: aligned LE32 load via the unaligned helper.
Upstream uses the generic unaligned load for aligned accesses too; this keeps that behaviour.
Definition at line 248 of file xz_config.h.
| #define get_unaligned_le32 | ( | buf | ) |
SOUP porting alias onto ra8_xz_cfg_get_unaligned_le32.
Kernel-contract name for the unaligned LE32 load.
Definition at line 238 of file xz_config.h.
| #define kfree | ( | ptr | ) |
xz-embedded free seam – no-op under arena semantics.
The decoder frees only at xz_dec_end, immediately before the wrapper resets the whole arena, so individual frees are void.
Definition at line 107 of file xz_config.h.
| #define kmalloc | ( | size, | |
| flags ) |
xz-embedded allocator seam -> zero-heap bump arena (state structs).
The flags argument is kernel GFP noise and is discarded. A NULL return makes the decoder abort its init cleanly, which the wrapper maps to a bounded ra8_err_t (fail-closed).
Definition at line 97 of file xz_config.h.
| #define memeq | ( | a, | |
| b, | |||
| size ) |
Byte-equality shim the SOUP uses for magic/footer comparison.
Thin memcmp == 0 wrapper (code de-duplication macro).
Definition at line 135 of file xz_config.h.
Referenced by unarch_xz_magic().
| #define memzero | ( | buf, | |
| size ) |
Zero-fill shim the SOUP uses to reset decoder state.
Thin memset(0) wrapper (code de-duplication macro).
Definition at line 144 of file xz_config.h.
| #define min | ( | x, | |
| y ) |
Untyped minimum shim used by the SOUP's buffer clamping.
Minimum.
Evaluates to the smaller of x and y, exactly as the kernel macro the sources were written against (both operands are always same-typed at the call sites).
Definition at line 157 of file xz_config.h.
Referenced by internal_sort_by_chapter_num(), and zoom_scale_cycle().
| #define min_t | ( | type, | |
| x, | |||
| y ) |
Typed minimum shim used by the SOUP's buffer clamping.
Evaluates to the smaller of x and y after casting both to type, exactly as the kernel macro the sources were written against.
Definition at line 169 of file xz_config.h.
| #define vfree | ( | ptr | ) |
xz-embedded large-free seam – no-op under arena semantics.
See kfree; the arena reset reclaims everything at once.
Definition at line 126 of file xz_config.h.
| #define vmalloc | ( | size | ) |
xz-embedded large-allocation seam (dictionary) -> same bump arena.
Only the XZ_PREALLOC dictionary comes through here; its size is policy-bounded by the wrapper before init.
Definition at line 117 of file xz_config.h.
| #define XZ_DEC_PREALLOC |
Enable xz-embedded's preallocated-dictionary streaming mode.
Multi-call decoding with the decoder state and dictionary allocated once at init (from the caller scratch via the pool) and never grown. The only mode the unarch_xz wrapper uses; XZ_DEC_SINGLE / XZ_DEC_DYNALLOC stay disabled.
Definition at line 74 of file xz_config.h.
| #define XZ_USE_CRC64 |
Verify CRC64 block/stream checks (the xz(1) default).
Compiles xz_crc64.c support in so default-created archives are integrity-verified instead of rejected as unsupported.
Definition at line 84 of file xz_config.h.
| enum ra8_xz_cfg_shift_t : uint8_t |
Byte-lane shift distances for the little-endian load shim.
Named per the no-magic-numbers rule; used only by ra8_xz_cfg_get_unaligned_le32.
| Enumerator | |
|---|---|
| k_ra8_xz_cfg_shift_b1 | Second byte lane shift. |
| k_ra8_xz_cfg_shift_b2 | Third byte lane shift. |
| k_ra8_xz_cfg_shift_b3 | Fourth byte lane shift. |
Definition at line 204 of file xz_config.h.
|
inlinestatic |
Load an unaligned little-endian 32-bit value byte by byte.
Portable (alignment- and endian-safe) implementation of the kernel helper the SOUP calls for CRC and header fields.
| [in] | buf | Source bytes (>= 4 readable). |
| uint32_t | Any value; pure assembly of the four input bytes. |
buf addresses at least four readable bytes. buf. Definition at line 224 of file xz_config.h.
References k_ra8_xz_cfg_shift_b1, k_ra8_xz_cfg_shift_b2, and k_ra8_xz_cfg_shift_b3.