|
Download docs/research/MESSAGE_WIDTHS.md from nmarshall/urt-rs: direct link, hf CLI and curl.
- Browser
- Download file 7.73 kB
-
https://huggingface.co/nmarshall/urt-rs/resolve/main/docs/research/MESSAGE_WIDTHS.md
- Command line
-
hf download hf://nmarshall/urt-rs/docs/research/MESSAGE_WIDTHS.md
-
curl -L -o MESSAGE_WIDTHS.md https://huggingface.co/nmarshall/urt-rs/resolve/main/docs/research/MESSAGE_WIDTHS.md
7.73 kB
| # Message initialization, OOB stores and mixed-width codecs | |
| Reproduce with `python3 scripts/analyze_message_widths.py`; validate with `python3 scripts/test_message_widths.py`. [message-widths.json](message-widths.json) retains twenty source/disassembly-hash-verified graphs across both Linux ELF64 engines, 24 initialization probes, four clear probes, 78 OOB probes and 328 compressed writer/reader compositions. It hashes the supplied [model-derived codebook report](HUFFMAN_CODEBOOK.md). | |
| These are synthetic native instruction compositions over explicitly supplied memory/registers, with caller-register restoration at stopped helper boundaries. Save/restore prologues and epilogues are excluded. No original process or native callee executes. The compressed seed tree is MODEL-DERIVED; complete native seed training, real packets and runtime/all-platform conformance remain open. Supplied buffers are oversized and zero initialized, not evidence of the original buffer lifecycle. | |
| ## WIDTH-001 — Message record initialization and clear (RE-369) | |
| The warm MSG_Init/MSG_InitOOB path is evaluated with msgInit already one. Each zeroes the entire 40-byte record, writes the supplied 64-bit data pointer at +16 and supplied maxsize word at +24. MSG_InitOOB then sets the mode word at +8 to one; ordinary initialization leaves zero. Size probes retain supplied size words 0, 64 and 0xffffffff without validation in this slice. This does not establish valid caller capacities. | |
| The recovered local ELF64 layout is: | |
| | Offset | Bytes | Observed use | | |
| | --- | --- | --- | | |
| | +0 | 4 | Cleared initialization word; allowoverflow semantics remain to be verified | | |
| | +4 | 4 | Writer overflow flag | | |
| | +8 | 4 | OOB mode word | | |
| | +12 | 4 | Cleared padding/unidentified record bytes | | |
| | +16 | 8 | Data pointer | | |
| | +24 | 4 | Maximum size | | |
| | +28 | 4 | Current size | | |
| | +32 | 4 | Read count | | |
| | +36 | 4 | Bit cursor | | |
| Cold probes start with msgInit zero and stop at the first Huff_Init request. They observe msgInit set to one before that request, while the supplied message record still retains its original 0xa5 bytes. Cold full training and subsequent record initialization are not composed here; see [initialization analysis](HUFFMAN_INITIALIZATION.md) for bounded schedule evidence. | |
| MSG_Clear zeroes only overflow +4, cursize +28 and bit +36. It retains readcount, mode, maxsize, data pointer and the other record bytes. Record canaries remain unchanged. Buffer contents and complete clear/reset/read-mode lifecycle remain open. | |
| ## WIDTH-002 — OOB writer/reader composition (RE-370) | |
| Each engine has 36 canonical-mode probes: widths 8/16/32/-8/-16/1/7/24/-32, value words zero/0x8196a5ff and starting cursize zero/three. Three more probes use mode word two with positive 8/16/32; this sampled nonzero value takes the same OOB dispatch. Initial bit cursor is deliberately 19, distinct from byte-position accounting. | |
| With ample remaining capacity, accepted widths normalize to 8, 16 or 32. The writer stores the input's low one/two/four bytes at data + signed cursize in little-endian order, increments cursize by the byte count and increments bit by the normalized width. There is no extra padding byte from the compressed cursor formula. Positive and selected negative requests update oldsize by the original requested word; range diagnostics remain separate from message overflow. | |
| Valid-but-unsupported OOB widths 1/7/24 stop before the error epilogue, without changing size, bit or buffer. The error callee and its final arguments are not executed/recovered by this boundary. Width -32 stops at generic writer validation, before mode dispatch or diagnostics; the earlier reader analysis accepted -32. Width-error precedence under insufficient space is covered separately by [writer guards](MESSAGE_BYTE_CODEC.md). | |
| Resetting supplied readcount to the initial byte position and bit to 19 lets MSG_ReadBits read those same output bytes directly. Readcount and bit agree with the writer's final size/bit; negative -8/-16 results sign extend at their full normalized widths. These supplied buffers do not test reading beyond cursize, capacity exhaustion, signed/wrapping offsets or actual network headers. | |
| The evaluator adds narrowly scoped MOVW/BX support (low 16-bit register writes retain upper bits) and implicit-one 32-bit shifts, verified by an independent instruction fixture. Other 16-bit register aliases and high-byte register operations remain unsupported. | |
| ## WIDTH-003 — Raw remainder and Huffman byte composition (RE-371) | |
| Each engine has 164 compressed probes: positive widths 1–32 plus selected negative widths -1/-7/-8/-9/-15/-16/-17/-24/-31, two value words and initial bit positions zero/seven. The first and second modeled objects are relocated to the native encoder/decoder addresses. Both writer and reader instruction slices stop before saved-register restoration and compose every encountered raw-bit or Huffman helper explicitly. | |
| For normalized width W, the writer masks the input to its low W bits. It emits the low W modulo eight bits first, individually and least-significant first through Huff_putBit. It then Huffman-encodes the remaining bytes in low-to-high order. Exact helper requests agree with that decomposition. Independent codeword packing verifies every output byte; actual reader traversal of the supplied tree decodes those bytes, rather than receiving supplied symbols or code lengths at helper boundaries. | |
| Writer size and reader count both become `(signed_bit >> 3) + 1`; bit advances by the raw remainder plus modeled codeword lengths. The initial partial-byte prefix is zero in these fixtures. Dirty-prefix preservation, buffer initialization and required boundary padding remain unverified. | |
| For positive widths, every decoded value equals the input masked to W bits. For selected negative widths, the reader sign tail uses the remaining byte-multiple width after removing the raw remainder, confirming the earlier [reader analysis](MESSAGE_BITS.md) against bytes generated by the writer. Examples for input word 0x8196a5ff and initial bit zero: | |
| | Requested width | Decoded word | | |
| | --- | --- | | |
| | -1 | 0x00000001 | | |
| | -7 | 0x0000007f | | |
| | -9 | 0xffffffff | | |
| | -15 | 0xffffffff | | |
| | -17 | 0xffffa5ff | | |
| | -31 | 0xff96a5ff | | |
| | +32 | 0x8196a5ff | | |
| These are recovered local behaviors, not corrected signed-codec specifications or proof that those negative widths occur in legal game traffic. The sampled paths do not exercise the writer's wider unrolled-loop body or unsupported high-byte register operations. Complete width/value/alias/overflow/wrap branch coverage remains open. | |
| ## Validation and next work | |
| Eight independent tests verify warm/cold record effects and canaries, exact clear retention, OOB width errors/little-endian/sign/cursors, raw-remainder and symbol arguments, independent modeled-codeword packing, signed-tail/diagnostic/accounting effects, paired engine results, and the restricted evaluator extension. The report preserves graph provenance and compact composition trace hashes. | |
| RE-372: recover MSG_WriteByte/Short/Long/Data and read wrappers, string/float/angle/delta/entity/player codecs and snapshot messages; validate capacity/overflow/allowoverflow/clear/read-reset lifecycle, truncation/EOF/dirty-prefix/padding and legal signed-width callers. Complete native seed/codeword validation, actual packets, original-runtime/all-platform and renderer contracts remain open. | |
| Follow-up: [message wrappers](MESSAGE_WRAPPERS.md) recovers bounded scalar forwarding/OOB composition, supplied-result signed/EOF tails and data-writer overflow continuation. Broader RE-372 remains open; RE-376 tracks remaining wrapper/lifecycle and actual packet/platform contracts. | |