Compare commits
3 Commits
cleanup/ip
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7897ea3b8e | ||
|
|
38a2a5d2fd | ||
|
|
d07aa5093a |
@@ -212,25 +212,20 @@ void ConvertDaysToDate(u16* year, u8* month, u8* day, s32 days) {
|
|||||||
days = previousDays;
|
days = previousDays;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*year = *year + 1;
|
*(volatile u16*)year += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
s32 previousDays = days;
|
s32 previousDays = days;
|
||||||
if (*month == 2) {
|
if (*month == 2 && IsLeapYear(*year)) {
|
||||||
BOOL leapYear = IsLeapYear(*year);
|
days -= 29;
|
||||||
if (leapYear) {
|
|
||||||
days -= 29;
|
|
||||||
} else {
|
|
||||||
days -= DAYS_OF_MONTH[*month - 1];
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
days -= DAYS_OF_MONTH[*month - 1];
|
days -= DAYS_OF_MONTH[*month - 1];
|
||||||
}
|
}
|
||||||
if (days < 0) {
|
if (days < 0) {
|
||||||
*day += previousDays;
|
*(volatile u8*)day += previousDays;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*month = *month + 1;
|
*(volatile u8*)month += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -596,9 +596,9 @@ static NWC24Err DecodeWord(char* charsetData, u32 charsetCapacity, char* decoded
|
|||||||
NWC24Err NWC24DecodeMIMEHeaderFieldBody(u8* charsetData, u32 charsetDataSize, u8* decoded, u32 decodedCapacity, u32* decodedSize, u8* encoded,
|
NWC24Err NWC24DecodeMIMEHeaderFieldBody(u8* charsetData, u32 charsetDataSize, u8* decoded, u32 decodedCapacity, u32* decodedSize, u8* encoded,
|
||||||
u32 encodedSize) {
|
u32 encodedSize) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
char* input;
|
|
||||||
s32 inputSize;
|
|
||||||
u8* output;
|
u8* output;
|
||||||
|
s32 inputSize;
|
||||||
|
char* input;
|
||||||
s32 remainingCapacity;
|
s32 remainingCapacity;
|
||||||
|
|
||||||
if (decodedSize == NULL) {
|
if (decodedSize == NULL) {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ NWC24Err NWC24ReadMsgField(const NWC24MsgObj* msg, char* fieldName, u8* output,
|
|||||||
NWC24Err closeResult;
|
NWC24Err closeResult;
|
||||||
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
|
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
|
||||||
return NWC24_ERR_LIB_NOT_OPENED;
|
return NWC24_ERR_LIB_NOT_OPENED;
|
||||||
if (!(privateMsg->type & 0x200))
|
if (!(((volatile NWC24MsgObjPrivate*)privateMsg)->type & 0x200))
|
||||||
return NWC24_ERR_PROTECTED;
|
return NWC24_ERR_PROTECTED;
|
||||||
result = SelectMBox(privateMsg, &type);
|
result = SelectMBox(privateMsg, &type);
|
||||||
switch (result) {
|
switch (result) {
|
||||||
@@ -276,11 +276,11 @@ NWC24Err NWC24ReadMsgFromAddr(const NWC24MsgObj* msg, char* address, u32 capacit
|
|||||||
NWC24Err result, closeResult;
|
NWC24Err result, closeResult;
|
||||||
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
|
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
|
||||||
return NWC24_ERR_LIB_NOT_OPENED;
|
return NWC24_ERR_LIB_NOT_OPENED;
|
||||||
if (!(privateMsg->type & 0x200))
|
if (!(((volatile NWC24MsgObjPrivate*)privateMsg)->type & 0x200))
|
||||||
return NWC24_ERR_PROTECTED;
|
return NWC24_ERR_PROTECTED;
|
||||||
buffer = NWC24WorkP->stringWork;
|
buffer = NWC24WorkP->stringWork;
|
||||||
Mail_memset(buffer, 0, 1024);
|
Mail_memset(buffer, 0, 1024);
|
||||||
if (!(privateMsg->type & 2))
|
if (!(((volatile NWC24MsgObjPrivate*)privateMsg)->type & 2))
|
||||||
return NWC24_ERR_NOT_SUPPORTED;
|
return NWC24_ERR_NOT_SUPPORTED;
|
||||||
result = SelectMBox(privateMsg, &type);
|
result = SelectMBox(privateMsg, &type);
|
||||||
switch (result) {
|
switch (result) {
|
||||||
@@ -319,7 +319,7 @@ NWC24Err NWC24ReadMsgSubject(const NWC24MsgObj* msg, char* subject, u32 capacity
|
|||||||
NWC24Err result, closeResult;
|
NWC24Err result, closeResult;
|
||||||
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
|
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
|
||||||
return NWC24_ERR_LIB_NOT_OPENED;
|
return NWC24_ERR_LIB_NOT_OPENED;
|
||||||
if (!(privateMsg->type & 0x200))
|
if (!(((volatile NWC24MsgObjPrivate*)privateMsg)->type & 0x200))
|
||||||
return NWC24_ERR_PROTECTED;
|
return NWC24_ERR_PROTECTED;
|
||||||
result = SelectMBox(privateMsg, &type);
|
result = SelectMBox(privateMsg, &type);
|
||||||
switch (result) {
|
switch (result) {
|
||||||
@@ -396,7 +396,7 @@ static NWC24Err ReadMsgTextInternal(const NWC24MsgObj* msg, char* text, u32 capa
|
|||||||
char* buffer;
|
char* buffer;
|
||||||
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
|
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
|
||||||
return NWC24_ERR_LIB_NOT_OPENED;
|
return NWC24_ERR_LIB_NOT_OPENED;
|
||||||
if (!(privateMsg->type & 0x200))
|
if (!(((volatile NWC24MsgObjPrivate*)privateMsg)->type & 0x200))
|
||||||
return NWC24_ERR_PROTECTED;
|
return NWC24_ERR_PROTECTED;
|
||||||
buffer = NWC24WorkP->stringWork;
|
buffer = NWC24WorkP->stringWork;
|
||||||
*encoding = 0;
|
*encoding = 0;
|
||||||
@@ -483,7 +483,7 @@ NWC24Err NWC24ReadMsgAttached(const NWC24MsgObj* msg, u32 index, u8* output, u32
|
|||||||
NWC24Err result, closeResult;
|
NWC24Err result, closeResult;
|
||||||
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
|
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
|
||||||
return NWC24_ERR_LIB_NOT_OPENED;
|
return NWC24_ERR_LIB_NOT_OPENED;
|
||||||
if (!(privateMsg->type & 0x200))
|
if (!(((volatile NWC24MsgObjPrivate*)privateMsg)->type & 0x200))
|
||||||
return NWC24_ERR_PROTECTED;
|
return NWC24_ERR_PROTECTED;
|
||||||
if (index >= privateMsg->numAttached)
|
if (index >= privateMsg->numAttached)
|
||||||
return NWC24_ERR_NOT_FOUND;
|
return NWC24_ERR_NOT_FOUND;
|
||||||
@@ -505,11 +505,8 @@ NWC24Err NWC24ReadMsgAttached(const NWC24MsgObj* msg, u32 index, u8* output, u32
|
|||||||
}
|
}
|
||||||
decodedSize = 0;
|
decodedSize = 0;
|
||||||
result = ReadBase64Data(&file, &privateMsg->attached[index], output, capacity, &decodedSize);
|
result = ReadBase64Data(&file, &privateMsg->attached[index], output, capacity, &decodedSize);
|
||||||
switch (result) {
|
if (result == NWC24_OK) {
|
||||||
case NWC24_OK:
|
if (decodedSize != privateMsg->attachedSize[index]) { result = NWC24_ERR_FORMAT; }
|
||||||
if (decodedSize != privateMsg->attachedSize[index]) { result = NWC24_ERR_FORMAT; }
|
|
||||||
break;
|
|
||||||
default: break;
|
|
||||||
}
|
}
|
||||||
closeResult = NWC24iMBoxCloseMsg(&file);
|
closeResult = NWC24iMBoxCloseMsg(&file);
|
||||||
if (result == NWC24_OK)
|
if (result == NWC24_OK)
|
||||||
|
|||||||
@@ -743,7 +743,6 @@ NWC24Err NWC24iSetMsgSubjectQP(NWC24MsgObj* msg, const u16* subject, u32 subject
|
|||||||
u32 workSize, NWC24Charset charset, char* charsetName) {
|
u32 workSize, NWC24Charset charset, char* charsetName) {
|
||||||
u32 workHalf;
|
u32 workHalf;
|
||||||
u32 sourceOffset;
|
u32 sourceOffset;
|
||||||
u32 secondSize;
|
|
||||||
u8* second;
|
u8* second;
|
||||||
u32 subjectLength;
|
u32 subjectLength;
|
||||||
u32 lineLength;
|
u32 lineLength;
|
||||||
@@ -751,6 +750,7 @@ NWC24Err NWC24iSetMsgSubjectQP(NWC24MsgObj* msg, const u16* subject, u32 subject
|
|||||||
u32 total;
|
u32 total;
|
||||||
u32 combinedLength;
|
u32 combinedLength;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
u32 secondSize;
|
||||||
u32 charsetLength;
|
u32 charsetLength;
|
||||||
NWC24Err result;
|
NWC24Err result;
|
||||||
|
|
||||||
@@ -828,8 +828,8 @@ NWC24Err NWC24iSetMsgSubjectBase64(NWC24MsgObj* msg, const u16* subject, u32 sub
|
|||||||
NWC24Err result;
|
NWC24Err result;
|
||||||
|
|
||||||
workHalf = workSize >> 1;
|
workHalf = workSize >> 1;
|
||||||
secondSize = workSize - workHalf;
|
|
||||||
second = work + workHalf;
|
second = work + workHalf;
|
||||||
|
secondSize = workSize - workHalf;
|
||||||
charsetLength = strlen(charsetName);
|
charsetLength = strlen(charsetName);
|
||||||
lineLength = ((0x36 - charsetLength) * 3) >> 2;
|
lineLength = ((0x36 - charsetLength) * 3) >> 2;
|
||||||
if (lineLength > workHalf) {
|
if (lineLength > workHalf) {
|
||||||
@@ -838,9 +838,9 @@ NWC24Err NWC24iSetMsgSubjectBase64(NWC24MsgObj* msg, const u16* subject, u32 sub
|
|||||||
workHalf = lineLength + 1;
|
workHalf = lineLength + 1;
|
||||||
subjectLength = subjectSize;
|
subjectLength = subjectSize;
|
||||||
result = NWC24iConvertFromInternalEncoding(work, &workHalf, subject, &subjectLength, charsetName, 0x40, region, alternative);
|
result = NWC24iConvertFromInternalEncoding(work, &workHalf, subject, &subjectLength, charsetName, 0x40, region, alternative);
|
||||||
switch (result) { case NWC24_OK: case NWC24_ERR_OVERFLOW: break; default: goto done; }
|
if (result == NWC24_OK || result == NWC24_ERR_OVERFLOW) {} else { goto done; }
|
||||||
result = NWC24EncodeWord(second, secondSize, &outputLength, charsetName, 0x40, 'B', work, workHalf - 1);
|
result = NWC24EncodeWord(second, secondSize, &outputLength, charsetName, 0x40, 'B', work, workHalf - 1);
|
||||||
switch (result) { case NWC24_OK: break; default: goto done; }
|
if (result == NWC24_OK) {} else { goto done; }
|
||||||
{
|
{
|
||||||
sourceOffset = subjectLength;
|
sourceOffset = subjectLength;
|
||||||
if (sourceOffset == subjectSize) {
|
if (sourceOffset == subjectSize) {
|
||||||
@@ -861,9 +861,9 @@ NWC24Err NWC24iSetMsgSubjectBase64(NWC24MsgObj* msg, const u16* subject, u32 sub
|
|||||||
second[total++] = ' ';
|
second[total++] = ' ';
|
||||||
result = NWC24iConvertFromInternalEncoding(work, &workHalf, subject + sourceOffset, &subjectLength, charsetName, 0x40, region,
|
result = NWC24iConvertFromInternalEncoding(work, &workHalf, subject + sourceOffset, &subjectLength, charsetName, 0x40, region,
|
||||||
alternative);
|
alternative);
|
||||||
switch (result) { case NWC24_OK: case NWC24_ERR_OVERFLOW: break; default: goto done; }
|
if (result == NWC24_OK || result == NWC24_ERR_OVERFLOW) {} else { goto done; }
|
||||||
result = NWC24EncodeWord(second + total, secondSize - total, &outputLength, charsetName, 0x40, 'B', work, workHalf - 1);
|
result = NWC24EncodeWord(second + total, secondSize - total, &outputLength, charsetName, 0x40, 'B', work, workHalf - 1);
|
||||||
switch (result) { case NWC24_OK: break; default: goto done; }
|
if (result == NWC24_OK) {} else { goto done; }
|
||||||
total = total + outputLength - 1;
|
total = total + outputLength - 1;
|
||||||
}
|
}
|
||||||
result = NWC24SetMsgSubject(msg, (char*)second, total);
|
result = NWC24SetMsgSubject(msg, (char*)second, total);
|
||||||
|
|||||||
@@ -9,3 +9,31 @@
|
|||||||
- NWC24CommitMsgInternal/WriteMIMEAttachHeader: ndiff-0, residual fuzzy from one r23<->r24 home swap at ~0x770 (cascade from earlier live range).
|
- NWC24CommitMsgInternal/WriteMIMEAttachHeader: ndiff-0, residual fuzzy from one r23<->r24 home swap at ~0x770 (cascade from earlier live range).
|
||||||
- NWC24MsgSubject fns: reg-name/arg-staging diffs only; ReadMsgSubjectPublic missing `mr r8,r26` staging; iSetMsgSubjectBase64 +12 same-stream.
|
- NWC24MsgSubject fns: reg-name/arg-staging diffs only; ReadMsgSubjectPublic missing `mr r8,r26` staging; iSetMsgSubjectBase64 +12 same-stream.
|
||||||
- ConvertDaysToDate: 57 regname diffs + one extra tail block (`*month++` + b) vs orig's fall-through return.
|
- ConvertDaysToDate: 57 regname diffs + one extra tail block (`*month++` + b) vs orig's fall-through return.
|
||||||
|
|
||||||
|
## net2 wave — volatile-guard isolation SOLVED the SelectMBox reload family (2026-10-01)
|
||||||
|
- LEVER: `((volatile NWC24MsgObjPrivate*)privateMsg)->type` on the *guard* `& 0x200`/`& 2` reads (NOT inside SelectMBox). A volatile first-read can't CSE into the inlined SelectMBox's `->type` reads, so it loads into r0 (dead after rlwinm.) and SelectMBox's own load gets pinned r3 and reused for its second flag test — exactly the base layout. Fixed NWC24ReadMsgField, NWC24ReadMsgSubject, NWC24ReadMsgFromAddr (insn-equal), ReadMsgTextInternal (177->178/178), ReadMsgAttached (insn-equal). Apply per-site: volatile where the load must NOT be the pinned one. Volatile *inside* SelectMBox poisons all inline sites (forces a 3rd load) — removed; the standalone double-load comes from the `*type` store alias barrier anyway.
|
||||||
|
- `switch(result){case OK: ...}` with empty default on the ReadBase64Data result: base fuses default-skip to `bne`; writing it as plain `if (result == NWC24_OK)` matches.
|
||||||
|
- ReadMsgTextInternal `if (len==0) len=text.size`: base emits `beq->then; b->join` (sunk then-block + stray b). Ternary, else-if empty-if, and explicit `if()goto;goto;` labels ALL fold to fused `bne` — unfused-beq/b wall.
|
||||||
|
- iSetMsgSubjectBase64 `beq;beq;b` 3-insn two-branch OR (==OK||==OVERFLOW ok else done): every source form folds (`||`+else, two positive gotos, else-if chain -> beq;bne); `switch` emits double-beq but adds a sign-split `bge` (+1); `(u32)`-cast switch keeps the bge. Splitting the OR across a second variable name folds too (copy-prop). Wall = unfused-branch family.
|
||||||
|
- iSetMsgSubjectQP: pure whole-fn r30<->r31 rotation (secondSize vs lineLength); decl-order moves had no effect or made it worse.
|
||||||
|
- DecodeMIMEHeaderFieldBody: r29<->r31 park-order tie (decodedSize vs input); init-stmt reorder cascades into r28<->r30. Parked.
|
||||||
|
- iMBoxCheck oldestId store-forward: `*(volatile u32*)&mailbox.oldestId` at the DeleteMsg call site STILL forwards (provable-local stack slot) — confirmed wall, not a lever.
|
||||||
|
- IsMsgObjReadable: 5-diff pure scheduling (entry->type load position vs prologue stores); volatile version adds +1 + cascade. Parked.
|
||||||
|
- ReadMsgAttached residual: r27<->r28 (index home) + base keeps scaled index (idx*4 in r27) and recomputes `add r3,r29,r27` per attachedSize access while mine keeps the pointer (+1 insn). Ptr-vs-scaled-index liveness tie.
|
||||||
|
|
||||||
|
## net2 wave 2 — volatile compound-assign forces reload-on-store (2026-10-01)
|
||||||
|
|
||||||
|
`*(volatile u16*)year += 1;` on pointer params forces `lhz;addi;sth` reload
|
||||||
|
per iteration — MWCC otherwise forwards the stored value in a register across
|
||||||
|
loop back-edges (ConvertDaysToDate: *year, *month, *day stores). This is the
|
||||||
|
same family as volatile-guard reads: volatile kills store-forwarding.
|
||||||
|
|
||||||
|
`*month == 2 && IsLeapYear(*year)` &&-form shares the `else { days -= DIM }`
|
||||||
|
block between the month!=2 and !leap paths (one add+lbz+subf block, matching
|
||||||
|
base) — writing the subtract in two nested else-branches duplicates it.
|
||||||
|
|
||||||
|
ConvertDaysToDate residual (+1 insn): MWCC emits `bge` with the day+= block
|
||||||
|
inline; base emits `blt` to a forward day+= block next to the epilogue.
|
||||||
|
break/goto-tail/post-loop forms all re-sink the block inline — parked as
|
||||||
|
block-placement tie-break. iDateToOSCalendarTime: r0<->r5 rename (year vs
|
||||||
|
isLeapYear flag pin) — parked.
|
||||||
|
|||||||
Reference in New Issue
Block a user