decomp(cntcache): CNTCACHEClear in C (asm placeholder removed) (worker f91deefd)

This commit is contained in:
coah
2026-10-09 18:22:11 +00:00
parent be309e8f72
commit c3d64f7259
4 changed files with 342 additions and 220 deletions

View File

@@ -1,7 +1,7 @@
# Assembly inventory
4.3U, 2026-10-09. 165 functions contain 167 assembly
bodies/blocks: 162 ORIGINAL functions and 3 PLACEHOLDER functions.
4.3U, 2026-10-09. 164 functions contain 166 assembly
bodies/blocks: 162 ORIGINAL functions and 2 PLACEHOLDER functions.
Run `python3 tools/check_asm_inventory.py`. Completion requires exit 0, complete
coverage and zero placeholders. The checker also rejects stale/duplicate rows,
@@ -88,7 +88,6 @@ found. Historical logs absent from this branch have commit IDs and excerpts in
| `libs/RVL_SDK/src/base/PPCArch.c` | `PPCSetFpIEEEMode` | ORIGINAL | Special-register or synchronization operation: `mtfsb0 FPSCR_NI_BIT`. |
| `libs/RVL_SDK/src/base/PPCArch.c` | `PPCSetFpNonIEEEMode` | ORIGINAL | Special-register or synchronization operation: `mtfsb1 FPSCR_NI_BIT`. |
| `libs/RVL_SDK/src/base/PPCArch.c` | `PPCMthid4` | ORIGINAL | Both branches write HID4 with mtspr; the fallback preserves the Broadway H4A bit. |
| `libs/RVL_SDK/src/cntcache/cntcache.c` | `CNTCACHEClear` | PLACEHOLDER | NAND/token logic; best C 47/151 differing, 149/151 instructions; pool solved with stripped writer literals, two post-delete compares missing, [rx30][rx30], [opus-cntc](../tools/decomp-assist/opus-cntc.attempts.md). |
| `libs/RVL_SDK/src/db/db.c` | `__DBExceptionDestination` | ORIGINAL | mfmsr/mtmsr enable address translation before the exception-handler tail branch. |
| `libs/RVL_SDK/src/gx/GXLight.c` | `PushLight` | ORIGINAL | psq_l/psq_st transfers paired-single values for the GX command stream. |
| `libs/RVL_SDK/src/gx/GXTransform.c` | `WriteProjPS` | ORIGINAL | psq_l/psq_st transfers paired-single values for the GX command stream. |
@@ -194,7 +193,6 @@ found. Historical logs absent from this branch have commit IDs and excerpts in
[rx17]: ../tools/decomp-assist/rx36.attempts.md#rx17
[rx24]: ../tools/decomp-assist/rx36.attempts.md#rx24
[rx30]: ../tools/decomp-assist/rx36.attempts.md#rx30
[rx36-osinit]: ../tools/decomp-assist/rx36.attempts.md#osinit
[sdk-init]: https://github.com/doldecomp/ogws/blob/master/src/revolution/OS/__ppc_eabi_init.c
[runtime]: https://github.com/doldecomp/ogws/blob/master/src/runtime/runtime.c

View File

@@ -8,7 +8,7 @@ extern "C" {
#endif
void CNTCACHEInit(int unk0, int unk1);
void CNTCACHEClear();
s32 CNTCACHEClear(void);
#ifdef __cplusplus
}

View File

@@ -1,4 +1,5 @@
#include <revolution/os.h>
#include <revolution/verdefs.h>
#include <private/nand.h>
#include <revolution/nand.h>
#include <private/es.h>
@@ -7,37 +8,21 @@
#include <stdlib.h>
#include <string.h>
char scCntCacheStrs[0xd0] = {
0x3c, 0x3c, 0x20, 0x52, 0x56, 0x4c, 0x5f, 0x53, 0x44, 0x4b, 0x20, 0x2d, 0x20, 0x43, 0x4e, 0x54,
0x43, 0x41, 0x43, 0x48, 0x45, 0x20, 0x09, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x62,
0x75, 0x69, 0x6c, 0x64, 0x3a, 0x20, 0x41, 0x70, 0x72, 0x20, 0x32, 0x30, 0x20, 0x32, 0x30, 0x31,
0x30, 0x20, 0x31, 0x34, 0x3a, 0x31, 0x35, 0x3a, 0x32, 0x38, 0x20, 0x28, 0x30, 0x78, 0x34, 0x31,
0x39, 0x39, 0x5f, 0x36, 0x30, 0x38, 0x33, 0x31, 0x29, 0x20, 0x3e, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x32, 0x2f, 0x63, 0x6e, 0x74, 0x63, 0x61, 0x63, 0x68,
0x65, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, 0x00, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x69,
0x74, 0x6c, 0x65, 0x20, 0x00, 0x00, 0x00, 0x00, 0x25, 0x30, 0x31, 0x36, 0x6c, 0x6c, 0x78, 0x20,
0x00, 0x00, 0x00, 0x00, 0x2f, 0x74, 0x6d, 0x70, 0x2f, 0x63, 0x6e, 0x74, 0x63, 0x61, 0x63, 0x68,
0x65, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, 0x00, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x32,
0x00, 0x00, 0x00, 0x00, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
0x74, 0x20, 0x00, 0x00, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x00,
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x00
};
char scCntCacheTitleDataFmt[0x16] = {
0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x2f, 0x25, 0x30, 0x38, 0x78, 0x2f, 0x25, 0x30, 0x38, 0x78,
0x2f, 0x64, 0x61, 0x74, 0x61, 0x00,
};
const char* __CNTCACHEVersion = scCntCacheStrs;
char scCntCacheSpaceNl[3] = {0x20, 0x0a, 0x00};
#define CNTCACHE_FILE "/shared2/cntcache.txt"
#define CNTCACHE_TMP_FILE "/tmp/cntcache.txt"
#define CNTCACHE_DIR "/shared2"
#define CNTCACHE_READ_SIZE 0x400
#define CNTCACHE_LINE_SIZE 0x40
#define CNTCACHE_RESULT_IO_ERROR (-5299)
extern void _savegpr_23();
extern void _restgpr_23();
SDKDefineVersion(CNTCACHE, "Apr 20 2010", "14:15:28");
OSMutex _CNTCACHEMutex;
long long _CNTCACHEUnused816997A8;
int _CNTCACHEUnused816997A4;
BOOL _CNTCACHEInitialized;
void CNTCACHEClear();
s32 CNTCACHEClear(void);
BOOL _CNTCACHEIsTitleRemovable(ESTitleId titleId);
void _CNTCACHEDeleteTitle();
void _CNTCACHEDeleteContent();
@@ -61,203 +46,243 @@ void CNTCACHEInit(int cacheValue, int cacheHighWord) {
_CNTCACHEUnused816997A4 = cacheValue;
*((int*)&_CNTCACHEUnused816997A8) = cacheHighWord;
}
asm void CNTCACHEClear() {
clrlwi r11, r1, 0x1b
mr r12, r1
subfic r11, r11, -0x500
stwux r1, r1, r11
mflr r0
mr r11, r12
stw r0, 4(r12)
bl _savegpr_23
lis r30, scCntCacheStrs@ha
lis r3, _CNTCACHEMutex@ha
addi r30, r30, scCntCacheStrs@l
li r29, 0
addi r3, r3, _CNTCACHEMutex@l
bl OSLockMutex
addi r3, r30, 0x50
addi r4, r1, 0x24
li r27, 1
li r5, 3
bl NANDPrivateOpen
cmpwi r3, -0xc
mr r28, r3
bne L_d4
li r28, 0
b L_28c
L_d4:
cmpwi r3, 0
beq L_e0
b L_268
L_e0:
addi r3, r1, 0x24
addi r4, r1, 0x20
bl NANDGetLength
cmpwi r3, 0
mr r28, r3
beq L_fc
b L_268
L_fc:
li r26, 0
li r31, 0
b L_25c
L_108:
lwz r25, 0x20(r1)
cmplwi r25, 0x400
ble L_118
li r25, 0x400
L_118:
addi r24, r1, 0xc0
addi r0, r25, 0x1f
addi r3, r1, 0x24
mr r4, r24
rlwinm r5, r0, 0, 0, 0x1a
bl NANDRead
cmpw r3, r25
beq L_140
li r28, -0x14b3
b L_268
L_140:
mr r4, r24
li r28, 0
mtctr r25
cmplwi r25, 0
ble L_16c
L_154:
lbz r0, 0(r4)
cmpwi r0, 0xa
bne L_164
b L_170
L_164:
addi r4, r4, 1
bdnz L_154
L_16c:
li r4, 0
L_170:
cmpwi r4, 0
bne L_224
li r28, 0
b L_268
b L_224
L_184:
stb r31, 0(r4)
subf r23, r24, r4
mr r3, r24
la r4, scCntCacheSpaceNl
bl strtok
cmpwi r3, 0
mr r29, r3
beq L_1d4
addi r4, r30, 0xb4
bl strcmp
cmpwi r3, 0
bne L_1bc
bl _CNTCACHEDeleteTitle
b L_1d4
L_1bc:
mr r3, r29
addi r4, r30, 0xc0
bl strcmp
cmpwi r3, 0
bne L_1d4
bl _CNTCACHEDeleteContent
L_1d4:
lwz r0, 0x20(r1)
addi r23, r23, 1
add r24, r24, r23
subf r0, r23, r0
subf r25, r23, r25
mr r4, r24
stw r0, 0x20(r1)
add r26, r26, r23
mtctr r25
cmplwi r25, 0
ble L_218
L_200:
lbz r0, 0(r4)
cmpwi r0, 0xa
bne L_210
b L_21c
L_210:
addi r4, r4, 1
bdnz L_200
L_218:
li r4, 0
L_21c:
cmpwi r4, 0
beq L_22c
L_224:
cmpwi r25, 0
bgt L_184
L_22c:
lwz r0, 0x20(r1)
cmpwi r0, 0
beq L_25c
mr r4, r26
addi r3, r1, 0x24
li r5, 0
bl NANDSeek
cmplw r3, r26
beq L_258
li r28, -0x14b3
b L_268
L_258:
li r28, 0
L_25c:
lwz r0, 0x20(r1)
cmpwi r0, 0
bne L_108
L_268:
addi r3, r1, 0x24
bl NANDClose
addi r3, r30, 0x50
li r29, 0
bl NANDPrivateDelete
cmpwi r3, 0
addi r3, r30, 0x84
bl NANDPrivateDelete
cmpwi r3, 0
L_28c:
cmpwi r29, 0
beq L_29c
addi r3, r1, 0x24
bl NANDClose
L_29c:
cmpwi r27, 0
beq L_2b0
lis r3, _CNTCACHEMutex@ha
addi r3, r3, _CNTCACHEMutex@l
bl OSUnlockMutex
L_2b0:
mr r3, r28
lwz r10, 0(r1)
mr r11, r10
bl _restgpr_23
lwz r0, 4(r10)
mtlr r0
mr r1, r10
blr
static s32 ReadCacheFile(char* buf, u32 bufSize, u32* length) {
NANDFileInfo info;
s32 result;
*length = 0;
result = NANDPrivateOpen(CNTCACHE_FILE, &info, NAND_ACCESS_READ);
if (result == NAND_RESULT_NOEXISTS) {
return NAND_RESULT_OK;
}
if (result != NAND_RESULT_OK) {
return result;
}
result = NANDGetLength(&info, length);
if (result == NAND_RESULT_OK && *length > bufSize) {
result = NAND_RESULT_MAXBLOCKS;
}
if (result == NAND_RESULT_OK && NANDRead(&info, buf, OSRoundUp32B(*length)) != *length) {
result = CNTCACHE_RESULT_IO_ERROR;
}
NANDClose(&info);
return result;
}
static s32 WriteCacheFile(const char* buf, u32 length);
s32 CNTCACHEAddDeleteTitle(ESTitleId titleId) {
char buf[CNTCACHE_READ_SIZE + CNTCACHE_LINE_SIZE] ALIGN32;
u32 length;
s32 result;
OSLockMutex(&_CNTCACHEMutex);
result = ReadCacheFile(buf, CNTCACHE_READ_SIZE, &length);
if (result == NAND_RESULT_OK) {
strcpy(buf + length, "DeleteTitle ");
length += strlen(buf + length);
length += sprintf(buf + length, "%016llx ", titleId);
buf[length++] = '\n';
result = WriteCacheFile(buf, length);
}
OSUnlockMutex(&_CNTCACHEMutex);
return result;
}
static s32 WriteCacheFile(const char* buf, u32 length) {
NANDFileInfo info;
s32 result;
NANDPrivateDelete(CNTCACHE_TMP_FILE);
result = NANDPrivateCreate(CNTCACHE_TMP_FILE, NAND_PERM_USER | NAND_PERM_GROUP, 0);
if (result != NAND_RESULT_OK) {
return result;
}
result = NANDPrivateOpen(CNTCACHE_TMP_FILE, &info, NAND_ACCESS_WRITE);
if (result != NAND_RESULT_OK) {
return result;
}
if (NANDWrite(&info, buf, length) != length) {
result = CNTCACHE_RESULT_IO_ERROR;
}
NANDClose(&info);
if (result != NAND_RESULT_OK) {
return result;
}
return NANDPrivateMove(CNTCACHE_TMP_FILE, CNTCACHE_DIR);
}
s32 CNTCACHEAddDeleteContent(ESTitleId titleId, const char* indices) {
char buf[CNTCACHE_READ_SIZE + CNTCACHE_LINE_SIZE] ALIGN32;
u32 length;
s32 result;
if (strlen(indices) > CNTCACHE_LINE_SIZE / 2) {
return NAND_RESULT_INVALID;
}
OSLockMutex(&_CNTCACHEMutex);
result = ReadCacheFile(buf, CNTCACHE_READ_SIZE, &length);
if (result == NAND_RESULT_OK) {
strcpy(buf + length, "DeleteContent ");
length += strlen(buf + length);
length += sprintf(buf + length, "%016llx ", titleId);
strcpy(buf + length, indices);
length += strlen(buf + length);
buf[length++] = '\n';
result = WriteCacheFile(buf, length);
}
OSUnlockMutex(&_CNTCACHEMutex);
return result;
}
static char* FindLineEnd(char* str, u32 length) {
u32 i;
for (i = 0; i < length; i++) {
if (*str == '\n') {
return str;
}
str++;
}
return NULL;
}
static inline BOOL DeleteCacheFile(const char* path) {
if (NANDPrivateDelete(path) != NAND_RESULT_OK) {
return FALSE;
}
return TRUE;
}
s32 CNTCACHEClear(void) {
NANDFileInfo info;
char* command;
s32 result;
BOOL locked = FALSE;
BOOL opened = FALSE;
u32 fileLength;
u32 offset;
s32 readLength;
char* line;
char* lineEnd;
u32 lineLength;
u8 buf[CNTCACHE_READ_SIZE] ALIGN32;
OSLockMutex(&_CNTCACHEMutex);
locked = TRUE;
result = NANDPrivateOpen(CNTCACHE_FILE, &info, NAND_ACCESS_RW);
if (result == NAND_RESULT_NOEXISTS) {
result = NAND_RESULT_OK;
goto end;
}
switch (result) {
case NAND_RESULT_OK:
opened = TRUE;
break;
default:
goto close;
}
result = NANDGetLength(&info, &fileLength);
switch (result) {
case NAND_RESULT_OK:
break;
default:
goto close;
}
offset = 0;
while (fileLength != 0) {
readLength = fileLength > sizeof(buf) ? sizeof(buf) : fileLength;
line = (char*)buf;
result = NANDRead(&info, buf, OSRoundUp32B(readLength));
if (result != readLength) {
result = CNTCACHE_RESULT_IO_ERROR;
goto close;
}
result = NAND_RESULT_OK;
lineEnd = FindLineEnd(line, readLength);
if (!lineEnd) {
result = NAND_RESULT_OK;
goto close;
}
while (readLength > 0) {
*lineEnd = '\0';
lineLength = lineEnd - line;
command = strtok(line, " \n");
if (command) {
if (strcmp(command, "DeleteTitle") == 0) {
_CNTCACHEDeleteTitle();
} else if (strcmp(command, "DeleteContent") == 0) {
_CNTCACHEDeleteContent();
}
}
lineLength++;
line += lineLength;
fileLength -= lineLength;
readLength -= lineLength;
offset += lineLength;
lineEnd = FindLineEnd(line, readLength);
if (!lineEnd) {
break;
}
}
if (fileLength != 0) {
result = NANDSeek(&info, offset, NAND_SEEK_BEG);
if (result != offset) {
result = CNTCACHE_RESULT_IO_ERROR;
goto close;
}
result = NAND_RESULT_OK;
}
}
close:
NANDClose(&info);
opened = FALSE;
DeleteCacheFile(CNTCACHE_FILE);
DeleteCacheFile(CNTCACHE_TMP_FILE);
end:
if (opened) {
NANDClose(&info);
}
if (locked) {
OSUnlockMutex(&_CNTCACHEMutex);
}
return result;
}
void _CNTCACHEDeleteTitle() {
char* token = strtok(NULL, scCntCacheSpaceNl);
char* token;
while (token != NULL) {
for (token = strtok(NULL, " \n"); token != NULL; token = strtok(NULL, " \n")) {
ESTitleId titleId;
int removable;
errno = 0;
titleId = strtoull(token, NULL, 16);
if (errno == 0 && (u32)ES_TITLE_TYPE(titleId) != 1) {
removable = _CNTCACHEIsTitleRemovable(titleId);
if (removable == 1) {
ES_DeleteTitle(titleId);
} else if (removable == 0) {
ES_DeleteTitleContent(titleId);
}
if (errno != 0 || (u32)ES_TITLE_TYPE(titleId) == 1) {
continue;
}
removable = _CNTCACHEIsTitleRemovable(titleId);
if (removable == 1) {
ES_DeleteTitle(titleId);
} else if (removable == 0) {
ES_DeleteTitleContent(titleId);
}
token = strtok(NULL, scCntCacheSpaceNl);
}
}
@@ -267,7 +292,7 @@ static s32 GetSaveDataUsage(ESTitleId titleId) {
u32 usedBlocks = 1;
u32 usedINodes = 1;
snprintf(nandPath, (int)sizeof(nandPath), scCntCacheTitleDataFmt, NANDTitleIdHi(titleId), NANDTitleIdLo(titleId));
snprintf(nandPath, (int)sizeof(nandPath), "/title/%08x/%08x/data", NANDTitleIdHi(titleId), NANDTitleIdLo(titleId));
ret = NANDSecretGetUsage(nandPath, &usedBlocks, &usedINodes);
if (ret == NAND_RESULT_NOEXISTS) {
@@ -322,7 +347,7 @@ void _CNTCACHEDeleteContent() {
ESError result;
char* token;
token = strtok(NULL, scCntCacheSpaceNl);
token = strtok(NULL, " \n");
errno = 0;
titleId = strtoull(token, NULL, 16);
if (errno == 0 && NANDTitleIdHi(titleId) == 0x00010005) {
@@ -333,7 +358,7 @@ void _CNTCACHEDeleteContent() {
}
if (result == ES_ERR_OK && ES_GetTmdView(titleId, tmd, &size) == ES_ERR_OK) {
if ((tmd->head.titleType & 8) && (tmd->head.titleType & 0x10)) {
token = strtok(NULL, scCntCacheSpaceNl);
token = strtok(NULL, " \n");
while (token) {
u32 index;
u32 i;
@@ -353,7 +378,7 @@ void _CNTCACHEDeleteContent() {
}
}
}
token = strtok(NULL, scCntCacheSpaceNl);
token = strtok(NULL, " \n");
}
}
memset(buf, 0, OSRoundUp32B(size));

View File

@@ -0,0 +1,99 @@
# a2c-cntc2 attempts: CNTCACHEClear asm -> C
Owned `CNTCACHEClear` in `libs/RVL_SDK/src/cntcache/cntcache.c`. Branch
agent/w1009/a2c-cntc2 at ab9cdd32, worktree data-d8. Start: asm placeholder.
History read: opus-cntc, sol-cntc (R1-R3), a2c-cntc, levers 35-38, rejected exact
11cdd576 (six out-parameter carrier).
Result: CNTCACHEClear exact in plain C, 0/151 differing, 151/151 instructions.
All five unit functions exact, pool identical 9/9.
## What blocked earlier attempts
Two shapes, traced with mwdbg (capture `_mwdbg/runs/a2c-cntc2-A`):
- Registers. The target's coloring order needs the parsing locals (lineLength,
line, readLength, offset) numbered below opened, locked and result. MWCC numbers a
function's own named locals first (reverse declaration order) and inlinee locals
after them, as `@` temporaries. With the loop in an inline helper the helper
locals always sit above the flags and are colored first: helper with ordinary
locals = 44/151, 151 instructions. That is why 11cdd576 needed out-parameters.
With the loop written directly in CNTCACHEClear every saved register matches
(variant B), but two instructions go missing.
- Branches. After NANDPrivateOpen and NANDGetLength the target has
`beq +8; b close`. An `if (result != OK) goto close` compiles to `bne close`
(149/151). The `beq +8; b` form only survives when the block held something that
disappears after branch optimization. Tried: ret/result split (extra mr),
guarded steps (`if (result == OK)` chains, bne), dead flag store in the error block
(fixes one site only and is dead code).
## The fix: switch dispatch
A single-case `switch (result) { case NAND_RESULT_OK: ...; break; default: goto close; }`
compiles to `cmpwi; beq case; b default`, which is exactly the target. Precedent in
the same SDK: RFL_NANDAccess.c opencallback_ uses
`switch (create) { case NAND_RESULT_OK: ...; default: ...; }` and emits the same
`cmpwi r3,0; mr r28,r3; beq +8; b` sequence (found by scanning every matched SDK
object for branch-over-branch). Results:
| Variant | CNTCACHEClear |
| --- | --- |
| direct C, `if` checks (B) | 127/151, 149 insns |
| direct C, switch checks (S1) | 0/151 |
| one switch with NOEXISTS, OK, default (S2/S3) | binary-search dispatch, wrong |
| `opened = TRUE` in `case NAND_RESULT_OK` | 0/151 |
## Post-delete compares
Target: `bl NANDPrivateDelete; cmpwi r3,0` with no branch, twice.
| Form | Result |
| --- | --- |
| plain call / empty if / `return x == OK` helper | 149 insns |
| `static inline BOOL DeleteCacheFile`: `if (NANDPrivateDelete(path) != OK) return FALSE; return TRUE;` | 0/151 |
| NOEXISTS-to-OK helper | 2 diffs (compares -12) |
Kept the BOOL helper; the caller ignores the result (best-effort cleanup). The
redundant `if (result != OK) return result; return OK;` helper from sol-cntc is gone.
## Declaration order and flags
Required relative order (reverse declaration = vreg order): command before result,
result before locked, locked before opened, then offset, readLength, line, lineLength.
lineEnd, info, fileLength and buf positions are free (P1, P3-P6 all exact). Kept
`info, command, result, locked, opened, fileLength, offset, readLength, line,
lineEnd, lineLength, buf`. `BOOL locked = FALSE; BOOL opened = FALSE;` initializers
are exact too. Both flags are set and tested: `locked = TRUE` after OSLockMutex,
`opened = TRUE` on a successful open, `opened = FALSE` after NANDClose.
Command declared after result or block-scoped = 40/151.
## Companion changes
- String pool: the blob `scCntCacheStrs` became literals plus SDKDefineVersion.
The five literals used only by stripped functions ("DeleteTitle ", "%016llx ",
"/tmp/cntcache.txt", "/shared2", "DeleteContent ") come from the reconstructed
writers ReadCacheFile, WriteCacheFile, CNTCACHEAddDeleteTitle and
CNTCACHEAddDeleteContent, as in 11cdd576 and the policy for linker-stripped
functions (#1242, #1248, #1249). The linker strips them; the DOL is unchanged.
- `_CNTCACHEDeleteTitle` written as `for` + `continue` (inline score 16): the while
form scores 15 and is auto-inlined into C CNTCACHEClear (184 insns).
- `revolution/cntcache.h`: `s32 CNTCACHEClear(void)` (target returns the status in r3).
- docs/asm-inventory.md: CNTCACHEClear row and its `[rx30]` reference removed; header
165 functions / 167 blocks / 162 ORIGINAL / 3 PLACEHOLDER. origin/main be309e8f
removed Manager::hasChannel with the same header text, so after a rebase the header
must read 164 / 166 / 162 / 2.
## Validation (worktree, base ab9cdd32)
- odiff CNTCACHEClear 0/151; ctxdiff 151/151 insns, diffs 0.
- objdiff unit: code 1828/1828, data 280/280, functions 5/5, complete code/data 100%,
sections .text/.data/.sdata/.bss/.sbss 100%.
- pool_diff: POOL IDENTICAL 9/9. .data/.sdata bytes equal the target (target adds
only alignment tail).
- Full build ok, main.dol SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.
- check_decomp_complete.py: DECOMPLETE_OK.
- check_asm_inventory.py: counts and rows consistent; exit 1 only for the 3 remaining
placeholders (jdec_main, iplSaveDataManager, iplSystem).
- gate.py libs/RVL_SDK/src/cntcache/cntcache --quick: GATE PASS. Full build ok, DOL
SHA1 matches, pool identical, instruction-exact 5/5, 0 regressions vs
baseline-ab9cdd32, 0 forbidden patterns, 0 readability warnings.