One user-space repair task per eligible HWE debug-diag / compile-deploy base ID: 320 admitted (C 218, C++ 97, build scripts 5), 1 skipped by the content filter. Each ships a public spec with a check-to-basis table, at least two defects with single-fix fixtures, a symptom-masking fixture and an alternative correct implementation. Claude re-checked all 320: structure, the HWE quality items and trace6 Docker calibration receipts against current digests (320/320 USABLE). Difficulty is unmeasured. Known follow-up: 212 tasks use 120 ad-hoc family names; the next batch maps them to the canonical list. The batch's 1,256-line progress log stays in its factory report and the 36-local branch batch15-hwe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4.6 KiB
Bounded native buffer layout contract
This project is a C11 software model of a request buffer. DMA_QUANTUM is 32 bytes. Its alignment and byte observations are about native virtual addresses only. They do not establish DMA physical continuity or cache coherency.
Init and storage
dma_layout owns _Alignas(32) raw[384] and at most 12 slots. dma_init(layout,prefix,capacity) accepts a nonnull layout, prefix in 0..31, and capacity in 0..256. The active buffer starts at raw+prefix and extends for exactly capacity bytes. It zeroes the whole layout and sets cursor/count to zero. Invalid init returns DMA_BAD_ARGUMENT without touching the nonnull layout. dma_reset keeps prefix/capacity, zeroes the active buffer and slots, and sets cursor/count to zero. A null layout is invalid. All routines are deterministic for valid initialized objects.
Reserve
dma_reserve accepts a nonnull layout/index/payload and a nonzero length. A successful reservation starts at the first address on or after active base plus current cursor divisible by 32. Its occupied span is the least multiple of 32 at least length; the entire occupied span, including padding, must fit inside the active buffer. The next cursor is the end of that span relative to active base. Store slot index, relative offset, length, span, tag, active=1, and return the actual pointer into raw. Initial payload and padding bytes are zero. No slot may be made if count is 12. A request with null pointers or zero length returns DMA_BAD_ARGUMENT; insufficient slots or full span returns DMA_NO_SPACE. Failure leaves layout, index, and payload unchanged.
Bounds and data
Slots have stable indices 0..count-1. dma_get_slot and dma_data return null for null layout, out-of-range, or inactive slots. dma_write and dma_read accept zero length with null source/target, but require nonnull pointer for nonzero length. They access only [offset, offset+length) inside the selected slot payload. Invalid index returns DMA_BAD_SLOT; invalid range or required null data pointer returns DMA_BAD_RANGE; null layout returns DMA_BAD_ARGUMENT. Failure changes no bytes. dma_fill and dma_xor operate on the selected slot's entire payload, never padding. The value and tag are arbitrary bytes. dma_checksum returns FNV-1a 32-bit, starting 2166136261 and multiplying by 16777619 after xor with each payload byte; invalid output pointer is DMA_BAD_ARGUMENT. Output pointer remains unchanged on failure. No routine reads or writes outside the active buffer.
Summary
dma_summarize returns current count, sum of payload lengths, sum of occupied spans, capacity-cursor, and the FNV-1a checksum over each active slot in index order: first its tag, then each payload byte. A null output pointer is invalid. Returned records and summary are observations; unused raw bytes after capacity are unspecified except immediately after a successful init, which zeroes the entire layout.
Transfers and queries
dma_copy moves length bytes from a source slot range to a target slot range in the same layout. Both ranges must be inside payload lengths; overlapping ranges behave as memmove, including a copy within one slot. Zero length is valid when both offsets are at most their payload lengths. An invalid slot returns DMA_BAD_SLOT, an invalid range returns DMA_BAD_RANGE, and null layout returns DMA_BAD_ARGUMENT. Failure leaves all bytes unchanged. dma_swap exchanges two entire payloads only when both selected slots exist and have equal lengths; unequal lengths return DMA_BAD_RANGE without changes. Swapping a slot with itself is a successful no-op. Padding and tags are unchanged.
dma_compare compares the two payloads bytewise as unsigned bytes, returning -1, 0, or +1 through a nonnull out; when their common prefix is identical, shorter payload sorts first. dma_find returns the first zero-based payload offset of a matching byte through a nonnull out; if absent it returns DMA_NOT_FOUND and leaves out unchanged. dma_set_tag changes the selected slot tag only. All three return DMA_BAD_ARGUMENT for null layout or required null output, and DMA_BAD_SLOT for an invalid slot; failures leave output and layout unchanged.
Probe
make uses the native C11 compiler and produces dma_probe. ./dma_probe reads one ASCII request per line from stdin and prints raw observations to stdout. Its line format and accepted commands are documented by ./dma_probe --help. Nonzero process status means malformed input. make clean removes only its build outputs. The probe is for local reproduction; it does not establish ARM or hardware behavior. It may print diagnostics on stderr.