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>
29 lines
961 B
C
29 lines
961 B
C
#include "descriptor.h"
|
|
#include <string.h>
|
|
int device_read(const struct descriptor_table *table, unsigned index,
|
|
struct device_record *record) {
|
|
size_t offset;
|
|
const unsigned char *bytes;
|
|
if (table == NULL || record == NULL || table->data == NULL) {
|
|
return RESULT_INPUT;
|
|
}
|
|
if (index >= table->capacity) {
|
|
return RESULT_INPUT;
|
|
}
|
|
offset = (size_t)index * table->alignment;
|
|
if (offset > table->allocation_bytes ||
|
|
table->allocation_bytes - offset < WIRE_BYTES) {
|
|
return RESULT_INPUT;
|
|
}
|
|
bytes = table->data + offset;
|
|
memset(record, 0, sizeof(*record));
|
|
record->slot = (uintptr_t)bytes;
|
|
record->address = wire_u64(bytes);
|
|
record->length = wire_u32(bytes + 8);
|
|
record->control = wire_u32(bytes + 12);
|
|
record->cookie = wire_u64(bytes + 16);
|
|
record->sequence = wire_u32(bytes + 24);
|
|
record->checksum = wire_u32(bytes + 28);
|
|
return RESULT_OK;
|
|
}
|