Compare commits

...

7 Commits

Author SHA1 Message Date
Devin AI
6135e25ace decomp-assist: document md5 *index++ decode + zi8uwd/SOBasic/FAAttach/iplKeyboard residuals
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 23:14:31 +00:00
Devin AI
0457e29c7a md5: *index++ per-step index walk + decl-order state vars (ProcessBlock 306v306, 32 ops)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 23:04:15 +00:00
Devin AI
f98313da96 pf_cache: DoWriteNumSector liveness fix (4->2 insn diffs)
Computing last_sector via 'return end_sector - 1' keeps end live across
overlap's subf — base emits addi(end-1) before subf, not a remat.
Residual: lwz/add scratch operand coloring (end r4/psec r5 vs r5/r4).

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 22:57:58 +00:00
Devin AI
55cc54b098 eZiText: ZiDAWGGetSibling 0 diffs via ->middle field access
Orig's high byte uses the ziDawgLongOffset middle field — a named-field
u8 load keeps the dead clrlwi 0x10 mask that cursor[1] folds away.
Remaining: CHARattribute/GetGraphInfo callee-web coloring ties.

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 22:55:19 +00:00
Devin AI
c2c3f13af8 nhttp: compareTokenN guard-to-goto tail (126v124 -> 124v124, 3 diffs)
Orig's -1 return block sits at the tail; the plain if-guard emitted it
inline (blt + inline li r3,-1). if(pos>=limit) goto tail + tail label
reproduces base's bge-to-end layout exactly. Residual: 'A'/'Z' const
materialization position (scheduling micro-tie).

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 22:49:21 +00:00
Devin AI
69481c6abd eZiText: zi8uwd decl-order web-priority (10->8 insn diffs)
Reordered locals so candidate/added decls precede previous/current,
fixing the lbz-vs-clrlwi load ordering. Residual: {word,current}
two-web callee swap (r26/r28) — coloring tie.

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 22:46:28 +00:00
Devin AI
c46e8dfb68 so: SOGetSockName param-direct address form (9->2 insn diffs)
Orig reads address fields through (SOSockAddr*)address casts, not a
local addr pointer — the local spawned an extra callee web and swapped
the r27/r29 bindings. Residual: one marshal-order insn (mr r3 copy
emitted last in base) — scheduler micro-tie.

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-02 22:44:47 +00:00
7 changed files with 62 additions and 38 deletions

View File

@@ -14,11 +14,11 @@ typedef struct ziUserDictionary {
void Zi8Memset(ziPtr, ziU32, ziU32);
ziBool Zi8_81480224(ziUserWord* word ZI_NEED_WORK) {
ziUserWord* candidate;
ziUwdNode* added;
ziU8 length;
ziUwdNode* previous;
ziUwdNode* current;
ziUwdNode* added;
ziUserWord* candidate;
ziU8 position;
if (ZI_WORK->uwdCount >= 32) {
Zi8LogError(0x19D, __zi8_work_data);

View File

@@ -78,7 +78,7 @@ ziU8* ZiDAWGGetSibling(ziU8* cursor) {
if ((*cursor & 0x80) != 0) {
node += (((const ziDawgLongOffset*)cursor)->flags & 0x7f) * 0x10000 +
(((ziU32)(ziU16)cursor[1] << 8) +
(((ziU32)(ziU16)((const ziDawgLongOffset*)cursor)->middle << 8) +
((const ziDawgLongOffset*)cursor)->low) + 0x8000;
} else {
node = cursor[1] + (node + (ziU16)*cursor * 0x100);

View File

@@ -551,12 +551,11 @@ pf_s32 PFCACHE_DoWriteSector(PF_VOLUME* p_vol, PF_CACHE_PAGE** pp_head, const pf
#pragma dont_inline reset
static inline pf_u32 PFCACHE_RecordPageEndOverlap(PF_CACHE_PAGE* p_page, pf_u32 end_sector, pf_u32* p_num_success, pf_u32* p_num_rest_sector) {
pf_u32 last_sector = end_sector - 1;
pf_u32 num_overlap = end_sector - p_page->sector;
*p_num_success += num_overlap;
*p_num_rest_sector -= num_overlap;
p_page->stat |= 2;
return last_sector;
return end_sector - 1;
}
pf_s32 PFCACHE_DoWriteNumSectorAndFreeIfNeeded(PF_VOLUME* p_vol, PF_CACHE_PAGE** pp_head, const pf_u8* p_buf, pf_u32 sector,

View File

@@ -80,12 +80,12 @@ static inline u32 rotateSum(u32 state, const u32* word, u32 constant, int shift)
static void ProcessBlock(NETMD5Context* context) {
static u32 constants[64] = {0xD76AA478, 0xE8C7B756, 0x242070DB, 0xC1BDCEEE, 0xF57C0FAF, 0x4787C62A, 0xA8304613, 0xFD469501, 0x698098D8, 0x8B44F7AF, 0xFFFF5BB1, 0x895CD7BE, 0x6B901122, 0xFD987193, 0xA679438E, 0x49B40821, 0xF61E2562, 0xC040B340, 0x265E5A51, 0xE9B6C7AA, 0xD62F105D, 0x02441453, 0xD8A1E681, 0xE7D3FBC8, 0x21E1CDE6, 0xC33707D6, 0xF4D50D87, 0x455A14ED, 0xA9E3E905, 0xFCEFA3F8, 0x676F02D9, 0x8D2A4C8A, 0xFFFA3942, 0x8771F681, 0x6D9D6122, 0xFDE5380C, 0xA4BEEA44, 0x4BDECFA9, 0xF6BB4B60, 0xBEBFBC70, 0x289B7EC6, 0xEAA127FA, 0xD4EF3085, 0x04881D05, 0xD9D4D039, 0xE6DB99E5, 0x1FA27CF8, 0xC4AC5665, 0xF4292244, 0x432AFF97, 0xAB9423A7, 0xFC93A039, 0x655B59C3, 0x8F0CCC92, 0xFFEFF47D, 0x85845DD1, 0x6FA87E4F, 0xFE2CE6E0, 0xA3014314, 0x4E0811A1, 0xF7537E82, 0xBD3AF235, 0x2AD7D2BB, 0xEB86D391};
static u32 indices[48] = {0x00000001, 0x00000006, 0x0000000B, 0x00000000, 0x00000005, 0x0000000A, 0x0000000F, 0x00000004, 0x00000009, 0x0000000E, 0x00000003, 0x00000008, 0x0000000D, 0x00000002, 0x00000007, 0x0000000C, 0x00000005, 0x00000008, 0x0000000B, 0x0000000E, 0x00000001, 0x00000004, 0x00000007, 0x0000000A, 0x0000000D, 0x00000000, 0x00000003, 0x00000006, 0x00000009, 0x0000000C, 0x0000000F, 0x00000002, 0x00000000, 0x00000007, 0x0000000E, 0x00000005, 0x0000000C, 0x00000003, 0x0000000A, 0x00000001, 0x00000008, 0x0000000F, 0x00000006, 0x0000000D, 0x00000004, 0x0000000B, 0x00000002, 0x00000009};
u32 a = context->a, b = context->b, c = context->c, d = context->d;
u32* word;
u32* constant;
u32* index;
int round;
u32 b = context->b, c = context->c, d = context->d, a = context->a;
const u32* word;
u32* block;
u32* constant;
const u32* index;
int round;
block = context->buffer32;
word = block;
constant = constants;
@@ -97,22 +97,22 @@ static void ProcessBlock(NETMD5Context* context) {
}
index = indices;
for (round = 0; round < 4; ++round) {
STEP(a,b,c,d,(b & d) | (c & ~d),block + *index,5); ++index; ++constant;
STEP(d,a,b,c,(a & c) | (b & ~c),block + *index,9); ++index; ++constant;
STEP(c,d,a,b,(d & b) | (a & ~b),block + *index,14); ++index; ++constant;
STEP(b,c,d,a,(c & a) | (d & ~a),block + *index,20); ++index; ++constant;
STEP(a,b,c,d,(b & d) | (c & ~d),block + *index++,5); ++constant;
STEP(d,a,b,c,(a & c) | (b & ~c),block + *index++,9); ++constant;
STEP(c,d,a,b,(d & b) | (a & ~b),block + *index++,14); ++constant;
STEP(b,c,d,a,(c & a) | (d & ~a),block + *index++,20); ++constant;
}
for (round = 0; round < 4; ++round) {
STEP(a,b,c,d,d ^ b ^ c,block + *index,4); ++index; ++constant;
STEP(d,a,b,c,c ^ a ^ b,block + *index,11); ++index; ++constant;
STEP(c,d,a,b,b ^ d ^ a,block + *index,16); ++index; ++constant;
STEP(b,c,d,a,a ^ c ^ d,block + *index,23); ++index; ++constant;
STEP(a,b,c,d,d ^ b ^ c,block + *index++,4); ++constant;
STEP(d,a,b,c,c ^ a ^ b,block + *index++,11); ++constant;
STEP(c,d,a,b,b ^ d ^ a,block + *index++,16); ++constant;
STEP(b,c,d,a,a ^ c ^ d,block + *index++,23); ++constant;
}
for (round = 0; round < 4; ++round) {
STEP(a,b,c,d,c ^ (b | ~d),block + *index,6); ++index; ++constant;
STEP(d,a,b,c,b ^ (a | ~c),block + *index,10); ++index; ++constant;
STEP(c,d,a,b,a ^ (d | ~b),block + *index,15); ++index; ++constant;
STEP(b,c,d,a,d ^ (c | ~a),block + *index,21); ++index; ++constant;
STEP(a,b,c,d,c ^ (b | ~d),block + *index++,6); ++constant;
STEP(d,a,b,c,b ^ (a | ~c),block + *index++,10); ++constant;
STEP(c,d,a,b,a ^ (d | ~b),block + *index++,15); ++constant;
STEP(b,c,d,a,d ^ (c | ~a),block + *index++,21); ++constant;
}
context->a += a;
context->b += b;

View File

@@ -77,16 +77,18 @@ s32 NHTTPi_compareTokenN_HdrRecvBuf(const NHTTPResponseInfo* response, s32 posit
s32 offset;
int character;
if (position < limit) {
FindHeaderBlock(response, position, &block, &offset);
character = ReadHeaderChar(response, &block, &offset);
while (LowerCase((s8)character) == LowerCase(*token)) {
if (*token == 0 || *token == ' ' || *token == delimiter || position == limit - 1) return 0;
character = ReadHeaderChar(response, &block, &offset);
++position;
++token;
}
if (position >= limit) {
goto tail;
}
FindHeaderBlock(response, position, &block, &offset);
character = ReadHeaderChar(response, &block, &offset);
while (LowerCase((s8)character) == LowerCase(*token)) {
if (*token == 0 || *token == ' ' || *token == delimiter || position == limit - 1) return 0;
character = ReadHeaderChar(response, &block, &offset);
++position;
++token;
}
tail:
return -1;
}

View File

@@ -140,20 +140,18 @@ int SOGetSockName(int socket, void* address) {
s32 rm;
NameRequest* request;
SOSockAddr* reply;
SOSockAddr* addr;
addr=address;
if((result=SOiPrepare(NULL,&rm))==0) {
if(!addr || addr->len>8 || addr->len<8) result=-28;
if(!address || ((SOSockAddr*)address)->len>8 || ((SOSockAddr*)address)->len<8) result=-28;
else {
size=(addr->len+63)&~31;
size=(((SOSockAddr*)address)->len+63)&~31;
request=SOiAlloc(12,size);
if(!request) result=-49;
else {
request->socket=socket;
reply=&request->address;
memcpy(reply,addr,addr->len);
result=IOS_Ioctl(rm,7,request,4,reply,addr->len);
if(result>=0) memcpy(addr,reply,reply->len);
memcpy(reply,address,((SOSockAddr*)address)->len);
result=IOS_Ioctl(rm,7,request,4,reply,((SOSockAddr*)address)->len);
if(result>=0) memcpy(address,reply,reply->len);
SOiFree(12,request,size);
}
}

View File

@@ -163,3 +163,28 @@ FINAL POOL libs/RevoEX/src/net/md5: POOL IDENTICAL up to 0 (mine=0 base=0) |
FINAL OPEN AUDIT ProcessBlock: objdiff=43.290848%, 7 distinct successful source hashes; structural/exact,lengths=((225, 300), 294, 306); 294/306 retained instructions, frame0x20. Indexed addresses, duplicated swapped loads, associated rotation sums and sequential cursor scheduling differ. Honest typed helper/materialized addresses reach306/306; seven source variants and93 declaration builds leave36 structural differences.
COMPLETENESS AUDIT PASS: all 7 remaining functions have at least3 distinct successful source-level attempts logged in this MAX round; build failures excluded. No experimental source/header changes retained. No untried function remains.
FINAL FULL GATE PASS: all4 owned units, clean43U build, SHA1 26116613f624061ba99c8d1a299aaa6efa85670d; exact30/31,11/14,0/2,3/4; matched_code9404,1388,0,600; matched_data4416,112,0,456. Regression0, forbidden0, readability0. NHTTPi_intToStr95/95 ctxdiff0 after clean build. Seven remaining functions audited14/6/19/10/8/8/7 distinct successful MAX source attempts, all at least3. No additional source changes after final gate.
## md5 ProcessBlock — w1010/smallflips round (0457e29c)
- DECODE: base's per-step `addi r4,r4,4` index-pointer advances are `*index++`
post-increment inside the STEP arg (`block + *index++`); separate `++index`
stmts get merged to one `addi +16` per unrolled iteration by MWCC. With the
increment inside the expression: 294/306 -> 306/306 exact SIZE.
- Also landed: `u32 b,c,d,a` state-decl order (a last) -> 32 ops; ptr decls
`word; block; constant; index; round;` (block last) -> 32; states-first is
load-bearing (ptrs-first decl = 62).
- Residual 32 ops: pure web-coloring {word:r4/r7, block:r8/r9, const:r9/r8,
a:r0 stays, b/c/d shifted by word's home}. ~10 decl/assign/type forms tried.
- zidawg1 CHARattribute {ctx<->key} r30/r31 + GetGraphInfo {ctx,graph,result}
r25/r26/r29: decl-order, alias, for-loop forms all invariant (7/9 ops).
- zi8uwd: `word->priority > candidate->priority` IS orig's operand order
(base `bgt`); `position[candidate->text]`/`*(position+text)` forms don't
flip the `add` operand order; `*(position+4+(u8*)candidate)` does flip it
but reshuffles webs to 15 ops. Kept `<` form at 8 ops.
- SOGetSockName: memcpy arg-materialization order (mr r3 last vs first):
inline dest, temp len, ptr-arith dest — all invariant (2 ops).
- FAAttach: index r0-vs-r5 scratch home — inline-index (129), u32/two-stmt/
decl-init (121-126), store-order swap — all invariant or regress (6 ops).
- iplKeyboard create: base saves 6 callee regs (arcLink->r26 separate from
multiArc->r30); mine coalesces to 5. allocator-hoist, no-paren new,
split-decl forms invariant (48 ops). Extra weak emissions (onEvent/onInput/
onOutOfLength/3 dtors) are upstream state, not leaf-introduced.