Compare commits

...

1 Commits

8 changed files with 527 additions and 469 deletions

View File

@@ -44,6 +44,18 @@ block_relocations:
- source: .data:0x8165E19C
add_relocations:
- source: .text:0x8152C08C
type: ha
target: __ArenaLo
- source: .text:0x8152C090
type: l
target: __ArenaLo
- source: .text:0x8152C134
type: ha
target: __ArenaLo
- source: .text:0x8152C138
type: l
target: __ArenaLo
- source: .data:0x8165E15C
type: abs
target: csAninationFile__Q29textinput7toolbar

View File

@@ -1,7 +1,7 @@
# Assembly inventory
Audit of `ad5100a5`, 4.3U, 2026-10-05. 175 functions contain 178 assembly
bodies/blocks: 162 ORIGINAL functions and 13 PLACEHOLDER functions.
4.3U, 2026-10-05. 173 functions contain 175 assembly
bodies/blocks: 162 ORIGINAL functions and 11 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,
@@ -37,7 +37,6 @@ found. Historical logs absent from this branch have commit IDs and excerpts in
| `libs/NW4R/include/nw4r/math/types.h` | `VEC3Scale` | ORIGINAL | psq_l/ps_muls0/psq_st implements paired-single vector/matrix operations. |
| `libs/NW4R/src/math/math_arithmetic.cpp` | `FrSqrt` | ORIGINAL | frsqrte plus fixed refinement matches the public [NW4R arithmetic assembly][arithmetic-cpp]. |
| `libs/NW4R/src/math/math_types.cpp` | `MTX44Identity` | ORIGINAL | psq_st/ps_merge01/ps_merge10 implements paired-single vector/matrix operations. |
| `libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main.c` | `TMCJPEGDEC_parse_sof` | PLACEHOLDER | JPEG frame parsing; diagnostic C 98.05381%, 223/223 instructions, 34 differences, temporary incomplete extern, [rx19](../tools/decomp-assist/rx19.attempts.md). |
| `libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main.c` | `TMCJPEGDEC_err_restart` | PLACEHOLDER | JPEG marker scan; best C 95.73913%, 114/115 instructions, folded exit branch, [rx19](../tools/decomp-assist/rx19.attempts.md), [rx24][rx24]. |
| `libs/RVL_SDK/include/revolution/os/OSFastCast.h` | `OSInitFastCast` | ORIGINAL | mtspr programs the GQR quantization registers. |
| `libs/RVL_SDK/include/revolution/os/OSFastCast.h` | `__OSu16tof32` | ORIGINAL | psq_l uses a GQR integer conversion format for the fast cast. |
@@ -113,7 +112,6 @@ found. Historical logs absent from this branch have commit IDs and excerpts in
| `libs/RVL_SDK/src/mtx/vec.c` | `PSVECNormalize` | ORIGINAL | psq_l/ps_mul/ps_madd/ps_sum0 implements paired-single vector/matrix operations. |
| `libs/RVL_SDK/src/mtx/vec.c` | `PSVECCrossProduct` | ORIGINAL | psq_l/ps_merge10/ps_mul/ps_muls0 implements paired-single vector/matrix operations. |
| `libs/RVL_SDK/src/os/OS.c` | `__OSFPRInit` | ORIGINAL | mfmsr/mtmsr enable the FPU; psq_l initializes paired registers and mtfsf initializes FPSCR. |
| `libs/RVL_SDK/src/os/OS.c` | `OSInit` | PLACEHOLDER | Two lis/addi blocks pin __ArenaLo to 0x816a9800; C score unrecorded, [rx36 audit][rx36-osinit]. |
| `libs/RVL_SDK/src/os/OS.c` | `__OSDBIntegrator` | ORIGINAL | nofralloc debug-vector fragment changes MSR and transfers through the saved hook LR. |
| `libs/RVL_SDK/src/os/OS.c` | `__OSDBJump` | ORIGINAL | Single absolute bla __OSDBJumpTarget between entry labels copied into exception vectors. |
| `libs/RVL_SDK/src/os/OS.c` | `OSExceptionVector` | ORIGINAL | Saves interrupted state, sets SRR0/SRR1 and executes rfi into the exception handler. |

View File

@@ -252,11 +252,20 @@ s32 TMCJPEGDEC_set_converterY8U8V8(TMCCJPEGDecWork* work);
s32 TMCJPEGDEC_set_converterRGB565(TMCCJPEGDecWork* work);
s32 TMCJPEGDEC_set_converterRGBA8(TMCCJPEGDecWork* work);
#ifdef TMC_JPEG_FRAME_PARSER
extern const u8 TMCJPEGDEC_SampleH_N[6][4];
extern const u8 TMCJPEGDEC_SampleV_N[6][4];
#else
extern const u8 TMCJPEGDEC_SampleH_N[24];
extern const u8 TMCJPEGDEC_SampleV_N[24];
#endif
extern const u8 TMCJPEGDEC_Zigzag_data[64];
extern const u32 TMCJPEGDEC_Zigzag_loop[64];
#ifdef TMC_JPEG_FRAME_PARSER
extern const u8 TMCJPEGDEC_SampleComps[];
#else
extern const u8 TMCJPEGDEC_SampleComps[6];
#endif
#ifdef __cplusplus
}

View File

@@ -1,3 +1,4 @@
#define TMC_JPEG_FRAME_PARSER
#include <tmc_jpeg_internal.h>
extern void* memset(void* dest, s32 val, u32 count);
@@ -655,484 +656,171 @@ static s32 TMCJPEGDEC_parse_dqt(TMCCJPEGDecWork* work) {
return 0;
}
#ifdef __MWERKS__
static asm s32 TMCJPEGDEC_parse_sof(register TMCCJPEGDecWork* work) {
nofralloc
stwu r1, -0x30(r1)
mflr r0
stw r0, 0x34(r1)
stmw r25, 0x14(r1)
mr r27, r3
addi r29, r3, 0x17f0
addi r28, r3, 0x2c
addi r3, r1, 0xa
mr r4, r27
bl TMCJPEGDEC_get_wbyte
cmpwi r3, 0
bge _parse_sof_have_length
b _parse_sof_return
_parse_sof_have_length:
lhz r0, 0xa(r1)
cmplwi r0, 2
bge _parse_sof_have_precision
li r3, -0x50
b _parse_sof_return
_parse_sof_have_precision:
mr r4, r27
addi r3, r1, 8
bl TMCJPEGDEC_get_byte
cmpwi r3, 0
bge _parse_sof_check_precision
b _parse_sof_return
_parse_sof_check_precision:
lbz r0, 8(r1)
cmplwi r0, 8
beq _parse_sof_get_height
li r3, -0x50
b _parse_sof_return
_parse_sof_get_height:
mr r4, r27
addi r3, r1, 0xa
bl TMCJPEGDEC_get_wbyte
cmpwi r3, 0
bge _parse_sof_store_height
b _parse_sof_return
_parse_sof_store_height:
lhz r0, 0xa(r1)
mr r4, r27
addi r3, r1, 0xa
sth r0, 2(r29)
bl TMCJPEGDEC_get_wbyte
cmpwi r3, 0
bge _parse_sof_store_width
b _parse_sof_return
_parse_sof_store_width:
lhz r0, 0xa(r1)
mr r4, r27
addi r3, r1, 8
sth r0, 0(r29)
bl TMCJPEGDEC_get_byte
cmpwi r3, 0
bge _parse_sof_store_components
b _parse_sof_return
_parse_sof_store_components:
lbz r0, 8(r1)
cmpwi r0, 0
stb r0, 0x1a(r29)
ble _parse_sof_bad_header
cmpwi r0, 4
ble _parse_sof_components_valid
_parse_sof_bad_header:
li r3, -0x50
b _parse_sof_return
_parse_sof_components_valid:
li r30, 0
li r31, 0
li r25, 0
b _parse_sof_component_condition
_parse_sof_component_loop:
mr r4, r27
addi r3, r1, 8
bl TMCJPEGDEC_get_byte
cmpwi r3, 0
bge _parse_sof_have_component_id
b _parse_sof_return
_parse_sof_have_component_id:
lbz r0, 8(r1)
add r26, r28, r25
mr r4, r27
addi r3, r1, 8
stb r0, 0x14(r26)
bl TMCJPEGDEC_get_byte
cmpwi r3, 0
bge _parse_sof_have_sampling
b _parse_sof_return
_parse_sof_have_sampling:
lbz r0, 8(r1)
add r4, r29, r25
srawi r3, r0, 4
clrlwi r0, r0, 0x1c
stb r3, 0x20(r4)
cmpw r3, r31
stb r0, 0x24(r4)
ble _parse_sof_check_v_sampling
mr r31, r3
_parse_sof_check_v_sampling:
lbz r0, 0x24(r4)
cmpw r0, r30
ble _parse_sof_get_qtable
mr r30, r0
_parse_sof_get_qtable:
mr r4, r27
addi r3, r1, 8
bl TMCJPEGDEC_get_byte
cmpwi r3, 0
bge _parse_sof_store_qtable
b _parse_sof_return
_parse_sof_store_qtable:
lbz r0, 8(r1)
addi r25, r25, 1
stb r0, 0x18(r26)
_parse_sof_component_condition:
lbz r0, 0x1a(r29)
cmpw r25, r0
blt _parse_sof_component_loop
clrlwi. r0, r31, 0x10
beq _parse_sof_bad_sampling
clrlwi. r0, r30, 0x10
bne _parse_sof_sampling_valid
_parse_sof_bad_sampling:
li r3, -0x50
b _parse_sof_return
_parse_sof_sampling_valid:
li r0, 6
lis r6, TMCJPEGDEC_SampleComps@ha
lis r7, TMCJPEGDEC_SampleH_N@ha
lis r8, TMCJPEGDEC_SampleV_N@ha
stb r31, 0x28(r29)
addi r6, r6, TMCJPEGDEC_SampleComps@l
addi r7, r7, TMCJPEGDEC_SampleH_N@l
addi r8, r8, TMCJPEGDEC_SampleV_N@l
stb r30, 0x29(r29)
li r10, 0
stb r0, 0xc(r29)
_parse_sof_sample_loop:
lbz r5, 0x1a(r29)
lbz r0, 0(r6)
cmplw r5, r0
bne _parse_sof_sample_next
mr r4, r7
mr r3, r8
li r11, 0
mtctr r5
cmpwi r5, 0
ble _parse_sof_sample_match
_parse_sof_sample_compare:
add r9, r29, r11
lbz r0, 0(r4)
lbz r5, 0x20(r9)
cmplw r5, r0
bne _parse_sof_sample_next
lbz r5, 0x24(r9)
lbz r0, 0(r3)
cmplw r5, r0
bne _parse_sof_sample_next
addi r11, r11, 1
addi r3, r3, 1
addi r4, r4, 1
bdnz _parse_sof_sample_compare
_parse_sof_sample_match:
stb r10, 0xc(r29)
_parse_sof_sample_next:
addi r10, r10, 1
addi r7, r7, 4
cmpwi r10, 6
addi r8, r8, 4
addi r6, r6, 1
blt _parse_sof_sample_loop
lbz r0, 0xc(r29)
cmplwi r0, 6
bne _parse_sof_setup_mcu
li r3, -0x70
b _parse_sof_return
_parse_sof_setup_mcu:
lhz r9, 0(r29)
rlwinm r8, r31, 3, 0x18, 0x1c
rlwinm r12, r30, 3, 0x18, 0x1c
lhz r11, 2(r29)
divw r6, r9, r8
stb r8, 0xd(r29)
lbz r5, 0x180a(r27)
addi r3, r27, 0x17f0
addi r0, r27, 0x2c
stb r12, 0xe(r29)
clrlwi r10, r6, 0x10
li r4, 0
mullw r6, r6, r8
divw r7, r11, r12
subf r6, r6, r9
stb r6, 0x18(r29)
mullw r9, r7, r12
clrlwi r8, r7, 0x10
clrlwi r7, r6, 0x18
neg r6, r7
subf r11, r9, r11
or r9, r6, r7
stb r11, 0x19(r29)
clrlwi r7, r11, 0x18
neg r6, r7
srwi r9, r9, 0x1f
or r6, r6, r7
add r9, r10, r9
srwi r6, r6, 0x1f
sth r9, 0x10(r29)
add r8, r8, r6
clrlwi r7, r9, 0x10
clrlwi r6, r8, 0x10
sth r8, 0x12(r29)
mullw r6, r7, r6
stw r6, 0x14(r29)
mtctr r5
cmpwi r5, 0
ble _parse_sof_component_check_done
_parse_sof_component_check:
add r5, r3, r4
lbz r6, 0x20(r5)
cmplwi r6, 1
blt _parse_sof_bad_component
cmplwi r6, 4
ble _parse_sof_check_v_factor
_parse_sof_bad_component:
li r3, -0x50
b _parse_sof_return
_parse_sof_check_v_factor:
lbz r5, 0x24(r5)
cmplwi r5, 1
blt _parse_sof_bad_v_factor
cmplwi r5, 4
ble _parse_sof_check_qtable
_parse_sof_bad_v_factor:
li r3, -0x50
b _parse_sof_return
_parse_sof_check_qtable:
add r5, r0, r4
lbz r5, 0x18(r5)
cmplwi r5, 4
ble _parse_sof_next_check
li r3, -0x50
b _parse_sof_return
_parse_sof_next_check:
addi r4, r4, 1
bdnz _parse_sof_component_check
_parse_sof_component_check_done:
li r3, 0
_parse_sof_return:
lmw r25, 0x14(r1)
lwz r0, 0x34(r1)
mtlr r0
addi r1, r1, 0x30
blr
static inline void initFrameGeometry(TMCJpegFrameInfo* frameInfo, s32 maxHSamp, s32 maxVSamp) {
u8 mcuWidth;
u8 mcuHeight;
u16 frameWidth;
u16 frameHeight;
s32 columnQuotient;
s32 rowQuotient;
u16 columns;
u16 rows;
mcuWidth = maxHSamp * 8;
mcuHeight = maxVSamp * 8;
frameWidth = frameInfo->frameWidth;
frameHeight = frameInfo->frameHeight;
columnQuotient = frameWidth / mcuWidth;
rowQuotient = frameHeight / mcuHeight;
columns = columnQuotient;
rows = rowQuotient;
frameInfo->mcuXCount = mcuWidth;
frameInfo->mcuXRem = mcuHeight;
frameInfo->remX = frameWidth - columnQuotient * mcuWidth;
frameInfo->remY = frameHeight - rowQuotient * mcuHeight;
frameInfo->mcuYCount = columns + (frameInfo->remX != 0);
frameInfo->mcuXCount2 = rows + (frameInfo->remY != 0);
frameInfo->mcuTotal = (u32)frameInfo->mcuYCount * frameInfo->mcuXCount2;
}
#else
static s32 TMCJPEGDEC_parse_sof(TMCCJPEGDecWork* work) {
TMCJpegFrameInfo* frameInfo = (TMCJpegFrameInfo*)&work->frameWidth;
u16 len;
u8 precision;
u16 height;
u16 width;
u8 compCount;
s32 r;
static inline s32 storeSampling(TMCJpegFrameInfo* frame, s32 index, u8 packed) {
s32 horizontal = packed >> 4;
frame->hSampFactor[index] = horizontal;
frame->vSampFactor[index] = packed & 15;
return horizontal;
}
typedef struct {
u8 map[4];
u32 dcPredict[4];
u8 id[4];
u8 quantTable[4];
u8 dcTable[4];
u8 acTable[4];
} TMCFrameComponents;
static inline s32 validateFrameComponents(TMCCJPEGDecWork* work) {
s32 idx;
TMCJpegFrameInfo* frameInfo = (TMCJpegFrameInfo*)&work->frameWidth;
TMCFrameComponents* components = (TMCFrameComponents*)work->compMap;
for (idx = 0; idx < frameInfo->compCount; idx++) {
if (frameInfo->hSampFactor[idx] < 1 || frameInfo->hSampFactor[idx] > 4) {
return TMCC_ERROR_HEADER;
}
if (frameInfo->vSampFactor[idx] < 1 || frameInfo->vSampFactor[idx] > 4) {
return TMCC_ERROR_HEADER;
}
if (components->quantTable[idx] > 4) {
return TMCC_ERROR_HEADER;
}
}
return 0;
}
static s32 TMCJPEGDEC_parse_sof(TMCCJPEGDecWork* work) {
s32 maxHSamp;
s32 maxVSamp;
u32 idx;
TMCJpegFrameInfo* frameInfo = (TMCJpegFrameInfo*)&work->frameWidth;
TMCFrameComponents* components = (TMCFrameComponents*)work->compMap;
u16 value;
u8 byte;
s32 r;
s32 idx;
r = TMCJPEGDEC_get_wbyte(&value, work);
if (r < 0) {
return r;
}
if (value < 2) {
return TMCC_ERROR_HEADER;
}
r = TMCJPEGDEC_get_byte(&byte, work);
if (r < 0) {
return r;
}
if (byte != 8) {
return TMCC_ERROR_HEADER;
}
r = TMCJPEGDEC_get_wbyte(&value, work);
if (r < 0) {
return r;
}
frameInfo->frameHeight = value;
r = TMCJPEGDEC_get_wbyte(&value, work);
if (r < 0) {
return r;
}
frameInfo->frameWidth = value;
r = TMCJPEGDEC_get_byte(&byte, work);
if (r < 0) {
return r;
}
frameInfo->compCount = byte;
if ((s32)frameInfo->compCount <= 0 || (s32)frameInfo->compCount > 4) {
return TMCC_ERROR_HEADER;
}
maxHSamp = 0;
maxVSamp = 0;
r = TMCJPEGDEC_get_wbyte(&len, work);
if (r < 0) {
return r;
}
if (len < 2) {
return TMCC_ERROR_HEADER;
}
r = TMCJPEGDEC_get_byte(&precision, work);
if (r < 0) {
return r;
}
if (precision != 8) {
return TMCC_ERROR_HEADER;
}
r = TMCJPEGDEC_get_wbyte(&height, work);
if (r < 0) {
return r;
}
frameInfo->frameHeight = height;
r = TMCJPEGDEC_get_wbyte(&width, work);
if (r < 0) {
return r;
}
frameInfo->frameWidth = width;
r = TMCJPEGDEC_get_byte(&compCount, work);
if (r < 0) {
return r;
}
if (compCount <= 0 || compCount > 4) {
return TMCC_ERROR_HEADER;
}
frameInfo->compCount = compCount;
for (idx = 0; idx < compCount; idx++) {
u8 compId;
u8 hSamp;
u8 vSamp;
u8 qTbl;
r = TMCJPEGDEC_get_byte(&compId, work);
maxHSamp = 0;
for (idx = 0; idx < frameInfo->compCount; idx++) {
s32 hSamp;
s32 vSamp;
r = TMCJPEGDEC_get_byte(&byte, work);
if (r < 0) {
return r;
}
work->compId[idx] = compId;
r = TMCJPEGDEC_get_byte(&hSamp, work);
components->id[idx] = byte;
r = TMCJPEGDEC_get_byte(&byte, work);
if (r < 0) {
return r;
}
vSamp = hSamp & 0xF;
hSamp = hSamp >> 4;
frameInfo->hSampFactor[idx] = hSamp;
frameInfo->vSampFactor[idx] = vSamp;
if (hSamp > maxHSamp)
hSamp = storeSampling(frameInfo, idx, byte);
if (hSamp > maxHSamp) {
maxHSamp = hSamp;
if (vSamp > maxVSamp)
}
vSamp = frameInfo->vSampFactor[idx];
if (vSamp > maxVSamp) {
maxVSamp = vSamp;
r = TMCJPEGDEC_get_byte(&qTbl, work);
}
r = TMCJPEGDEC_get_byte(&byte, work);
if (r < 0) {
return r;
}
work->compQTbl[idx] = qTbl;
components->quantTable[idx] = byte;
}
if (maxHSamp == 0 || maxVSamp == 0) {
if ((u16)maxHSamp == 0 || (u16)maxVSamp == 0) {
return TMCC_ERROR_HEADER;
}
frameInfo->maxHSamp = maxHSamp;
frameInfo->maxVSamp = maxVSamp;
frameInfo->componentCount = 6;
{
u32 sampleIdx;
for (sampleIdx = 0; sampleIdx < 6; sampleIdx++) {
u32 c;
u8 match;
if (frameInfo->compCount != TMCJPEGDEC_SampleComps[sampleIdx]) {
continue;
}
match = TRUE;
for (c = 0; c < frameInfo->compCount; c++) {
if (frameInfo->hSampFactor[c] != TMCJPEGDEC_SampleH_N[sampleIdx * 4 + c] ||
frameInfo->vSampFactor[c] != TMCJPEGDEC_SampleV_N[sampleIdx * 4 + c]) {
match = FALSE;
break;
s32 sample;
for (sample = 0; sample < 6; sample++) {
s32 component;
u32 factor;
if (frameInfo->compCount == TMCJPEGDEC_SampleComps[sample]) {
for (component = 0; component < frameInfo->compCount; component++) {
factor = frameInfo->hSampFactor[component];
if (factor != TMCJPEGDEC_SampleH_N[sample][component]) {
goto nextSample;
}
factor = frameInfo->vSampFactor[component];
if (factor != TMCJPEGDEC_SampleV_N[sample][component]) {
goto nextSample;
}
}
frameInfo->componentCount = sample;
}
if (match) {
frameInfo->componentCount = sampleIdx;
break;
}
nextSample:
continue;
}
}
if (frameInfo->componentCount == 6) {
return -0x70;
return TMCC_ERROR_FORMAT;
}
{
u16 fw = frameInfo->frameWidth;
u16 fh = frameInfo->frameHeight;
u8 mcuX = (maxHSamp & 0x07) << 3;
u8 mcuY = (maxVSamp & 0x07) << 3;
u16 mcuCountX;
u16 mcuCountY;
u16 remX;
u16 remY;
u32 compCount2;
frameInfo->mcuXCount = mcuX;
frameInfo->mcuXRem = mcuY;
mcuCountX = fw / mcuX;
mcuCountY = fh / mcuY;
remX = fw - mcuCountX * mcuX;
remY = fh - mcuCountY * mcuY;
work->remX = remX;
work->remY = remY;
{
u16 xr = (remX != 0) ? 1 : 0;
u16 yr = (remY != 0) ? 1 : 0;
mcuCountX += xr;
mcuCountY += yr;
frameInfo->mcuYCount = mcuCountX;
frameInfo->mcuXCount2 = mcuCountY;
work->mcuTotal = (u32)mcuCountX * (u32)mcuCountY;
}
compCount2 = frameInfo->compCount;
for (idx = 0; idx < compCount2; idx++) {
u8 hSamp2;
u8 vSamp2;
u8 qTbl2;
hSamp2 = frameInfo->hSampFactor[idx];
if (hSamp2 < 1 || hSamp2 > 4) {
return TMCC_ERROR_HEADER;
}
vSamp2 = frameInfo->vSampFactor[idx];
if (vSamp2 < 1 || vSamp2 > 4) {
return TMCC_ERROR_HEADER;
}
qTbl2 = work->compQTbl[idx];
if (qTbl2 > 4) {
return TMCC_ERROR_HEADER;
}
}
}
return 0;
initFrameGeometry(frameInfo, maxHSamp, maxVSamp);
return validateFrameComponents(work);
}
#endif
static s32 TMCJPEGDEC_parse_sos(TMCCJPEGDecWork* work) {
typedef struct {

View File

@@ -577,15 +577,7 @@ void OSInit() {
arenaAddr = RAMReadPtr(OSPhysicalToCached(OS_ADDR_AVAILABLE_MEM1_START));
if (arenaAddr == NULL) {
register void* arenaLo;
#ifdef __MWERKS__
asm {
lis arenaLo, -0x7E95
addi arenaLo, arenaLo, -0x6800
}
#else
arenaLo = __ArenaLo;
#endif
void* arenaLo = __ArenaLo;
if (OSIsMEM1Region(arenaLo)) {
void* tmp = BootInfo->arenaLo;
arenaAddr = tmp == NULL ? arenaLo : tmp;
@@ -612,15 +604,7 @@ void OSInit() {
arenaAddr = RAMReadPtr(OSPhysicalToCached(OS_ADDR_AVAILABLE_MEM2_START));
if (arenaAddr != NULL) {
register void* arenaLo;
#ifdef __MWERKS__
asm {
lis arenaLo, -0x7E95
addi arenaLo, arenaLo, -0x6800
}
#else
arenaLo = __ArenaLo;
#endif
void* arenaLo = __ArenaLo;
if (OSIsMEM2Region(arenaLo)) {
arenaAddr = arenaLo;

View File

@@ -0,0 +1,297 @@
# rx41 de-asm attempts
Worktree data-d4, branch agent/w1005/rx41. Starting HEAD and fetched origin/main fef6f996.
Assigned OSInit, _CNTCACHEIsTitleRemovable, _CNTCACHEDeleteContent, TMCJPEGDEC_parse_sof. All three units are Matching.
Existing untracked g2 attempts/baseline/final logs were present before this run and are outside this task.
Acceptance: each conversion needs exact-name objdiff 100.0%, ctxdiff diffs 0, identical pools, full gate with no drops and DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. Remove its inventory row and run the checker. Commit conversions separately. Preserve asm for every rejected C candidate.
Read AGENTS.md, levers.md, unslop and writing-for-agents. No workers spawned. Source experiments stay in this worktree or /tmp/rx41.
Prior evidence: da5/da7 cache attempts, rx36 extracts of missing rx18 log, rx19/da4b SOF trials. OS reference OS_OS.c in ogws_sdk initializes MEM1/MEM2 using __ArenaLo; its debug-stack fallback is _db_stack_end.
OSInit / os-01-linker-symbol: Use the existing __ArenaLo linker symbol, matching ogws SDK arena initialization. objdiff 99.96296%; 270/270 instructions, 4 positional differences; POOL IDENTICAL up to 29 (mine=29 base=29).
OSInit / os-02-fixed-address: Diagnostic constant address, checking constant folding and address-load form; no source installed. objdiff 90.23704%; 246/270 instructions, 199 positional differences; POOL IDENTICAL up to 29 (mine=29 base=29).
OSInit / os-03-address-helper: Linker address through inline identity helper tests address materialization; expected extraction-only mismatch. objdiff 99.96296%; 270/270 instructions, 4 positional differences; POOL IDENTICAL up to 29 (mine=29 base=29).
TMCJPEGDEC_parse_sof / sof-00-prior: Fresh prior geometry candidate on current unit; incomplete extern remains local to the trial. objdiff 98.05381%; 223/223 instructions, 34 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
## OSInit conversion
The two address pairs at 0x8152C08C/90 and 0x8152C134/38 resolve to 0x816a9800. config/ldscript_ipl2.lcf already defines __ArenaLo as the aligned end of the debugger stack. The linked ELF has _stack_end=0x81699800 and _stack_addr=0x816a7800; adding the linker script's 0x2000 debug stack gives 0x816a9800. The ogws OS_OS.c reference uses __ArenaLo for the same MEM1/MEM2 region checks.
The extracted target was missing four linker-symbol relocations. Added only those HA/LO relocations in config/43U/config.yml. No symbol sizes, sections, labels, linker addresses or flags changed. decomp-toolkit supports an unresolved external target in add_relocations; checked src/cmd/dol.rs apply_add_relocations and src/obj/relocations.rs in encounter/decomp-toolkit. Only OS.o changed among 1027 freshly extracted objects.
After extraction correction, direct __ArenaLo C gives 270/270 instructions, ctxdiff diffs 0, identical 29-string pool. The inline identity helper is unnecessary and was rejected. Ghidra was regenerated in /tmp/rx41 and read; without the missing relocation it folds the address-dependent region branches, confirming why C with a literal cannot represent the original compiler input.
TMCJPEGDEC_parse_sof / sof-01-named-value-0: Name and reuse actual sampling value, or name component count, to change allocator priority without changing reads. objdiff 98.085205%; 223/223 instructions, 34 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-01-named-value-1: Name and reuse actual sampling value, or name component count, to change allocator priority without changing reads. objdiff 98.05381%; 223/223 instructions, 34 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-01-named-value-2: Name and reuse actual sampling value, or name component count, to change allocator priority without changing reads. objdiff 97.807175%; 223/223 instructions, 34 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-02-selection-helper: Move the complete sampling-table selection into one real inline helper. objdiff 97.807175%; 223/223 instructions, 40 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
OSInit full clean gate PASS: OS 21/21 instruction-exact, code 5084/5084, data 1240/1240; cache 5/5, JPEG main 13/13. DOL SHA1 remains 26116613f624061ba99c8d1a299aaa6efa85670d; 0 regressions, 0 forbidden additions, 0 readability warnings. Inventory checker reports complete coverage and 12 remaining placeholders, with no stale/unlisted rows; exit 1 is the expected whole-tree completion failure. OSInit removed from inventory.
_CNTCACHEIsTitleRemovable / rem-00-typed-helper: Reconstruct aligned path/TMD buffers and shared NAND classifier using current SDK types. objdiff 89.60976%; 80/82 instructions, 69 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEDeleteContent / del-00-typed-helper: Reconstruct title/content parsing and typed TMD traversal with cleanup label. objdiff 95.793106%; 143/145 instructions, 90 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
TMCJPEGDEC_parse_sof / sof-03-cursor-scope-0: Outer-scope H/V cursors before table pointers, with component increment made explicit when selected. objdiff 97.97309%; 223/223 instructions, 35 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-03-cursor-scope-1: Outer-scope H/V cursors before table pointers, with component increment made explicit when selected. objdiff 97.97309%; 223/223 instructions, 35 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-03-cursor-scope-2: Outer-scope H/V cursors before table pointers, with component increment made explicit when selected. objdiff 98.01794%; 223/223 instructions, 34 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-03-cursor-scope-3: Outer-scope H/V cursors before table pointers, with component increment made explicit when selected. objdiff 98.01794%; 223/223 instructions, 34 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-04-source-order-0: Initialize sampling table pointers in the target relocation order; explicitly order component increment as selected. objdiff 97.950676%; 223/223 instructions, 38 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-04-source-order-1: Initialize sampling table pointers in the target relocation order; explicitly order component increment as selected. objdiff 97.950676%; 223/223 instructions, 38 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-04-source-order-2: Initialize sampling table pointers in the target relocation order; explicitly order component increment as selected. objdiff 97.90583%; 223/223 instructions, 39 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
_CNTCACHEIsTitleRemovable / rem-01-boundary-0: Pass title by const pointer instead of value, retaining real title ownership. objdiff 89.60976%; 80/82 instructions, 69 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEIsTitleRemovable / rem-01-boundary-1: Initialize NAND sentinel counts from the initial state; diagnostic copy-lifetime test. objdiff 91.92683%; 82/82 instructions, 23 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEDeleteContent / del-01-boundary-0: Const-pointer title argument keeps the usage helper independent of caller mask lifetime. objdiff 95.793106%; 143/145 instructions, 90 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEIsTitleRemovable / rem-01-boundary-2: Pass the initial state through the NAND helper and update it on return. objdiff 89.54878%; 82/82 instructions, 34 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEDeleteContent / del-01-boundary-1: Name the parsed title type before the validity guard to separate masks. objdiff 93.10345%; 143/145 instructions, 91 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEIsTitleRemovable / rem-01-boundary-3: Reuse the formatting result local for the NAND return code. objdiff 89.60976%; 80/82 instructions, 69 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEDeleteContent / del-01-boundary-2: Initial state reuse tests the missing NAND-result copy, keeping target sentinel values. objdiff 95.26897%; 144/145 instructions, 113 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
TMCJPEGDEC_parse_sof / sof-05-row-helper-0: Inline actual sampling-row match, reused factor value, and target increment order; parameter order (0, 1, 2, 3). objdiff 97.92825%; 223/223 instructions, 38 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-05-row-helper-1: Inline actual sampling-row match, reused factor value, and target increment order; parameter order (1, 2, 0, 3). objdiff 97.92825%; 223/223 instructions, 38 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-05-row-helper-2: Inline actual sampling-row match, reused factor value, and target increment order; parameter order (2, 1, 0, 3). objdiff 97.860985%; 223/223 instructions, 40 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-05-row-helper-3: Inline actual sampling-row match, reused factor value, and target increment order; parameter order (3, 0, 1, 2). objdiff 97.92825%; 223/223 instructions, 38 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-05-row-helper-4: Inline actual sampling-row match, reused factor value, and target increment order; parameter order (1, 0, 2, 3). objdiff 97.92825%; 223/223 instructions, 38 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-05-row-helper-5: Inline actual sampling-row match, reused factor value, and target increment order; parameter order (2, 0, 1, 3). objdiff 97.860985%; 223/223 instructions, 40 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
_CNTCACHEIsTitleRemovable / rem-02-enum-state-0: Separate NAND errors from the explicit three-state classification with enum types; width and values preserved. objdiff 89.60976%; 80/82 instructions, 69 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEDeleteContent / del-02-title-fields-0: Equivalent high/low title-word extraction changes mask expression identity at the real path-format boundary. objdiff 95.793106%; 143/145 instructions, 90 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEIsTitleRemovable / rem-02-enum-state-1: Separate NAND errors from the explicit three-state classification with enum types; width and values preserved. objdiff 89.60976%; 80/82 instructions, 69 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEDeleteContent / del-02-title-fields-1: Equivalent high/low title-word extraction changes mask expression identity at the real path-format boundary. objdiff 95.793106%; 143/145 instructions, 90 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEIsTitleRemovable / rem-02-enum-state-2: Separate NAND errors from the explicit three-state classification with enum types; width and values preserved. objdiff 89.60976%; 80/82 instructions, 69 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEDeleteContent / del-02-title-fields-2: Equivalent high/low title-word extraction changes mask expression identity at the real path-format boundary. objdiff 95.793106%; 143/145 instructions, 90 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEIsTitleRemovable / rem-02-enum-state-3: Separate NAND errors from the explicit three-state classification with enum types; width and values preserved. objdiff 89.60976%; 80/82 instructions, 69 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEDeleteContent / del-02-title-fields-3: Equivalent high/low title-word extraction changes mask expression identity at the real path-format boundary. objdiff 95.793106%; 143/145 instructions, 90 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEDeleteContent / del-02-title-fields-4: Equivalent high/low title-word extraction changes mask expression identity at the real path-format boundary. objdiff 95.793106%; 143/145 instructions, 90 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
TMCJPEGDEC_parse_sof / sof-06-direct-inner-0: Remove named inner pointer cursors and use direct indexed sampling arrays, leaving outer table walks unchanged. objdiff 98.37668%; 223/223 instructions, 24 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
_CNTCACHEIsTitleRemovable / rem-03-state-lifetime-0: Try a real state/error lifetime or const title boundary without adding instructions or changing SDK layouts by hand. objdiff 87.71951%; 81/82 instructions, 39 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
TMCJPEGDEC_parse_sof / sof-06-direct-inner-1: Remove named inner pointer cursors and use direct indexed sampling arrays, leaving outer table walks unchanged. objdiff 98.37668%; 223/223 instructions, 24 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
_CNTCACHEIsTitleRemovable / rem-03-state-lifetime-1: Try a real state/error lifetime or const title boundary without adding instructions or changing SDK layouts by hand. objdiff 88.37805%; 81/82 instructions, 45 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
TMCJPEGDEC_parse_sof / sof-06-direct-inner-2: Remove named inner pointer cursors and use direct indexed sampling arrays, leaving outer table walks unchanged. objdiff 98.37668%; 223/223 instructions, 24 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
_CNTCACHEIsTitleRemovable / rem-03-state-lifetime-2: Try a real state/error lifetime or const title boundary without adding instructions or changing SDK layouts by hand. objdiff 89.60976%; 80/82 instructions, 69 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
TMCJPEGDEC_parse_sof / sof-06-direct-inner-3: Remove named inner pointer cursors and use direct indexed sampling arrays, leaving outer table walks unchanged. objdiff 98.37668%; 223/223 instructions, 24 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
_CNTCACHEIsTitleRemovable / rem-03-state-lifetime-3: Try a real state/error lifetime or const title boundary without adding instructions or changing SDK layouts by hand. objdiff 85.085365%; 81/82 instructions, 39 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
TMCJPEGDEC_parse_sof / sof-07-direct-outer-1: Use sample indices directly for selected outer arrays while preserving inner indexed component reads; mask 1. objdiff 98.3991%; 223/223 instructions, 23 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-08-geometry-quotients-0: Name full-width quotient intermediates or alter real geometry integer lifetime without changing bounded arithmetic. objdiff 99.52018%; 223/223 instructions, 15 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-07-direct-outer-2: Use sample indices directly for selected outer arrays while preserving inner indexed component reads; mask 2. objdiff 96.56054%; 224/223 instructions, 124 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-08-geometry-quotients-1: Name full-width quotient intermediates or alter real geometry integer lifetime without changing bounded arithmetic. objdiff 98.37668%; 223/223 instructions, 24 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-07-direct-outer-3: Use sample indices directly for selected outer arrays while preserving inner indexed component reads; mask 3. objdiff 96.65022%; 224/223 instructions, 124 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-08-geometry-quotients-2: Name full-width quotient intermediates or alter real geometry integer lifetime without changing bounded arithmetic. objdiff 98.37668%; 223/223 instructions, 24 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-07-direct-outer-4: Use sample indices directly for selected outer arrays while preserving inner indexed component reads; mask 4. objdiff 96.53812%; 224/223 instructions, 124 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-08-geometry-quotients-3: Name full-width quotient intermediates or alter real geometry integer lifetime without changing bounded arithmetic. objdiff 98.37668%; 223/223 instructions, 24 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-07-direct-outer-5: Use sample indices directly for selected outer arrays while preserving inner indexed component reads; mask 5. objdiff 96.6278%; 224/223 instructions, 124 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-08-geometry-quotients-4: Name full-width quotient intermediates or alter real geometry integer lifetime without changing bounded arithmetic. objdiff 97.4574%; 223/223 instructions, 27 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-07-direct-outer-6: Use sample indices directly for selected outer arrays while preserving inner indexed component reads; mask 6. objdiff 96.59193%; 223/223 instructions, 47 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-07-direct-outer-7: Use sample indices directly for selected outer arrays while preserving inner indexed component reads; mask 7. objdiff 96.70403%; 223/223 instructions, 44 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-09-sampling-boundary-0: Preserve exact geometry while moving only the first differing sampling value across a natural inline/local boundary. objdiff 99.5426%; 223/223 instructions, 14 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-09-sampling-boundary-1: Preserve exact geometry while moving only the first differing sampling value across a natural inline/local boundary. objdiff 99.52018%; 223/223 instructions, 15 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-09-sampling-boundary-2: Preserve exact geometry while moving only the first differing sampling value across a natural inline/local boundary. objdiff 99.52018%; 223/223 instructions, 15 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-09-sampling-boundary-3: Preserve exact geometry while moving only the first differing sampling value across a natural inline/local boundary. objdiff 97.41704%; 225/223 instructions, 119 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-09-sampling-boundary-4: Preserve exact geometry while moving only the first differing sampling value across a natural inline/local boundary. objdiff 99.52018%; 223/223 instructions, 15 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-09-sampling-boundary-5: Preserve exact geometry while moving only the first differing sampling value across a natural inline/local boundary. objdiff 99.52018%; 223/223 instructions, 15 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
_CNTCACHEIsTitleRemovable / rem-04-classification-flow-0: Use structured switch/do-while/early-return classification to test return-copy formation. objdiff 88.268295%; 81/82 instructions, 35 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEDeleteContent / del-03-classification-flow-0: Use structured classifier flow inside the existing content loop to test the missing state copy. objdiff 95.034485%; 144/145 instructions, 90 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEIsTitleRemovable / rem-04-classification-flow-1: Use structured switch/do-while/early-return classification to test return-copy formation. objdiff 89.60976%; 80/82 instructions, 69 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEDeleteContent / del-03-classification-flow-1: Use structured classifier flow inside the existing content loop to test the missing state copy. objdiff 95.793106%; 143/145 instructions, 90 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEIsTitleRemovable / rem-04-classification-flow-2: Use structured switch/do-while/early-return classification to test return-copy formation. objdiff 88.268295%; 81/82 instructions, 38 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEDeleteContent / del-03-classification-flow-2: Use structured classifier flow inside the existing content loop to test the missing state copy. objdiff 95.034485%; 144/145 instructions, 90 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEIsTitleRemovable / rem-04-classification-flow-3: Use structured switch/do-while/early-return classification to test return-copy formation. objdiff 85.87805%; 79/82 instructions, 66 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEDeleteContent / del-03-classification-flow-3: Use structured classifier flow inside the existing content loop to test the missing state copy. objdiff 93.68276%; 142/145 instructions, 89 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
TMCJPEGDEC_parse_sof / sof-10-search-review: Fresh measurement of current no-type-mutation search result; review declaration and loop changes before retaining any result. objdiff 99.58744%; 223/223 instructions, 15 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-11-indexed-selection-helper-0: Move indexed sampling search as a unit across a real helper boundary, with const pointer parameter variant. objdiff 99.40807%; 223/223 instructions, 18 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-11-indexed-selection-helper-1: Move indexed sampling search as a unit across a real helper boundary, with const pointer parameter variant. objdiff 99.340805%; 223/223 instructions, 20 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-11-indexed-selection-helper-2: Move indexed sampling search as a unit across a real helper boundary, with const pointer parameter variant. objdiff 97.91928%; 224/223 instructions, 115 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-11-indexed-selection-helper-3: Move indexed sampling search as a unit across a real helper boundary, with const pointer parameter variant. objdiff 97.85202%; 224/223 instructions, 117 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-12-table-parameters-0: Pass actual sampling tables as selector parameters to move their address-expression register identities; order (0, 1, 2). objdiff 99.565025%; 223/223 instructions, 12 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-12-table-parameters-1: Pass actual sampling tables as selector parameters to move their address-expression register identities; order (0, 2, 1). objdiff 99.565025%; 223/223 instructions, 13 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-12-table-parameters-2: Pass actual sampling tables as selector parameters to move their address-expression register identities; order (1, 0, 2). objdiff 99.565025%; 223/223 instructions, 14 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-12-table-parameters-3: Pass actual sampling tables as selector parameters to move their address-expression register identities; order (1, 2, 0). objdiff 99.632286%; 223/223 instructions, 14 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-12-table-parameters-4: Pass actual sampling tables as selector parameters to move their address-expression register identities; order (2, 0, 1). objdiff 99.49776%; 223/223 instructions, 15 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-12-table-parameters-5: Pass actual sampling tables as selector parameters to move their address-expression register identities; order (2, 1, 0). objdiff 99.565025%; 223/223 instructions, 14 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-13-helper-lifetimes-0: Adjust only actual selector index/factor lifetimes and typed table access; preserve all reads and geometry. objdiff 99.45291%; 223/223 instructions, 16 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-13-helper-lifetimes-1: Adjust only actual selector index/factor lifetimes and typed table access; preserve all reads and geometry. objdiff 99.45291%; 223/223 instructions, 16 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-13-helper-lifetimes-2: Adjust only actual selector index/factor lifetimes and typed table access; preserve all reads and geometry. objdiff 99.565025%; 223/223 instructions, 12 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-13-helper-lifetimes-3: Adjust only actual selector index/factor lifetimes and typed table access; preserve all reads and geometry. objdiff 99.565025%; 223/223 instructions, 12 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-13-helper-lifetimes-4: Adjust only actual selector index/factor lifetimes and typed table access; preserve all reads and geometry. objdiff 96.753365%; 226/223 instructions, 123 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-13-helper-lifetimes-5: Adjust only actual selector index/factor lifetimes and typed table access; preserve all reads and geometry. objdiff 99.565025%; 223/223 instructions, 12 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-14-table-argument-locals-0: Materialize real table arguments in local source order before the selector call; order (0, 1, 2). objdiff 99.565025%; 223/223 instructions, 12 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-14-table-argument-locals-1: Materialize real table arguments in local source order before the selector call; order (0, 2, 1). objdiff 99.565025%; 223/223 instructions, 12 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-14-table-argument-locals-2: Materialize real table arguments in local source order before the selector call; order (1, 0, 2). objdiff 99.565025%; 223/223 instructions, 12 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-14-table-argument-locals-3: Materialize real table arguments in local source order before the selector call; order (1, 2, 0). objdiff 99.565025%; 223/223 instructions, 12 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-14-table-argument-locals-4: Materialize real table arguments in local source order before the selector call; order (2, 0, 1). objdiff 99.565025%; 223/223 instructions, 12 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-14-table-argument-locals-5: Materialize real table arguments in local source order before the selector call; order (2, 1, 0). objdiff 99.565025%; 223/223 instructions, 12 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-15-combined-latch-0: Keep each sampling cursor advance in the for-loop update clause; order (0, 1, 2). objdiff 99.52018%; 223/223 instructions, 15 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-15-combined-latch-1: Keep each sampling cursor advance in the for-loop update clause; order (0, 2, 1). objdiff 99.565025%; 223/223 instructions, 15 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-15-combined-latch-2: Keep each sampling cursor advance in the for-loop update clause; order (1, 0, 2). objdiff 99.52018%; 223/223 instructions, 15 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-15-combined-latch-3: Keep each sampling cursor advance in the for-loop update clause; order (1, 2, 0). objdiff 99.60986%; 223/223 instructions, 14 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-15-combined-latch-4: Keep each sampling cursor advance in the for-loop update clause; order (2, 0, 1). objdiff 99.529144%; 223/223 instructions, 15 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-15-combined-latch-5: Keep each sampling cursor advance in the for-loop update clause; order (2, 1, 0). objdiff 99.57399%; 223/223 instructions, 14 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
_CNTCACHEIsTitleRemovable / rem-05-title-values-0: Make real high/low title words explicit around the diagnostic state initialization; compare allocator lifetime and instruction scheduling. objdiff 93.70731%; 82/82 instructions, 23 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEIsTitleRemovable / rem-05-title-values-1: Make real high/low title words explicit around the diagnostic state initialization; compare allocator lifetime and instruction scheduling. objdiff 87.42683%; 80/82 instructions, 69 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEIsTitleRemovable / rem-05-title-values-2: Make real high/low title words explicit around the diagnostic state initialization; compare allocator lifetime and instruction scheduling. objdiff 93.70731%; 82/82 instructions, 23 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEIsTitleRemovable / rem-05-title-values-3: Make real high/low title words explicit around the diagnostic state initialization; compare allocator lifetime and instruction scheduling. objdiff 87.42683%; 80/82 instructions, 69 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEIsTitleRemovable / rem-05-title-values-4: Make real high/low title words explicit around the diagnostic state initialization; compare allocator lifetime and instruction scheduling. objdiff 89.60976%; 80/82 instructions, 69 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
_CNTCACHEIsTitleRemovable / rem-05-title-values-5: Make real high/low title words explicit around the diagnostic state initialization; compare allocator lifetime and instruction scheduling. objdiff 91.39024%; 80/82 instructions, 69 positional differences; POOL IDENTICAL up to 9 (mine=9 base=9).
TMCJPEGDEC_parse_sof / sof-16-sampling-row-type-0: Model each real four-component sampling row as u8[4] in a private header; no table data or other translation unit changes. objdiff 99.52018%; 223/223 instructions, 15 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-16-sampling-row-type-1: Model each real four-component sampling row as u8[4] in a private header; no table data or other translation unit changes. objdiff 99.529144%; 223/223 instructions, 15 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-16-sampling-row-type-2: Model each real four-component sampling row as u8[4] in a private header; no table data or other translation unit changes. objdiff 99.5426%; 223/223 instructions, 14 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-16-sampling-row-type-3: Model each real four-component sampling row as u8[4] in a private header; no table data or other translation unit changes. objdiff 100.0%; 223/223 instructions, 0 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
TMCJPEGDEC_parse_sof / sof-17-readable-exact: Replace the final empty label with a normal continue statement; preserve the exact row-table C implementation. objdiff 100.0%; 223/223 instructions, 0 positional differences; POOL IDENTICAL up to 0 (mine=0 base=0).
## TMCJPEGDEC_parse_sof conversion
The winning source uses six rows of four components for both sampling-factor tables, with direct [sample][component] access. jpformat.c already writes the 24 bytes as six four-byte rows; SampleComps contains six component counts. The target increments each factor-table base by four and its count-table base by one. This is a recovered array shape, with no object-size, section, initializer, or address change.
The parser-only TMC_JPEG_FRAME_PARSER macro exposes [6][4] table declarations and an incomplete SampleComps extern. The incomplete extern matches the target's lis/addi addressing rather than the small-data optimization of a known six-byte array. All other translation units keep their original declarations. The parser uses the existing work/frame fields and a typed component view matching the contiguous map/DC/id/quantization fields.
Direct inner array indexing removed pointer-cursor register differences. Named signed full-width quotient intermediates fixed MCU geometry scheduling while u16 rows/columns preserve the target narrowing. The 2D sampling rows then resolved every remaining register difference. sof-16-sampling-row-type-3 and its readable continue-statement form sof-17-readable-exact both measure 100.0%, 223/223 instructions, diffs 0, data 256/256, empty identical pools, all 13 unit functions exact. The source object built normally with the guarded live header also has ctxdiff diffs 0.
## Search and coverage
Private srcsearch.py changes only definition selection, skipping prototypes, and disables signedness mutations for runs after the first SOF search. Shared search code and its CPU limiter were unchanged. Search runs completed 224 SOF trials at 98.085205%, 207 removable-helper trials at 89.54878%, 207 delete-content trials at 95.793106%, and 216 improved SOF trials at 99.58744%. The search label SOLUTION means equal instruction counts, not exactness. A later selector-helper search was still queued when the independent row-type source became exact; it was stopped as redundant. No non-exact search candidate was installed.
The allocator trace of the prior SOF source was read: named H/V cursors occupy r10/r11 while table walks occupy r5/r6/r7; direct indexing makes those cursors compiler temporaries and recovers the target r4/r3 allocation. A fresh removable trace request waited on the shared debugger lock without starting the emulator, then was canceled. No new trace was obtained; earlier rx18 coalescing evidence remains advisory. The launcher copy would have written captures only under /tmp/rx41 and acquired the shared lock read-only.
Levers reviewed: natural inline boundaries, signedness/width and enums, const inputs, separate/reused locals, declaration order, block scope, counted loops, prior SDK art, real array shape, no cached element pointers, source search and allocator traces. Ghidra exports were read for every assigned function. OSInit was regenerated with a private project directory. A public search for both cache functions returned no source. The eZiText-only, thunk, extab/jump-table, original uninitialized-value, cross-thread volatile, and BSS-order levers do not apply to these routines. Compiler flags and unrelated source remained unchanged. Only the four documented OS relocation additions modify configuration.
Compiled manual coverage:
- OSInit: 3 compiled trials, 3 distinct sources; best 99.96296%, 270/270 instructions, 4 positional differences. Source /tmp/rx41/os-03-address-helper/.
- TMCJPEGDEC_parse_sof: 74 compiled trials, 74 distinct sources; best 100.0%, 223/223 instructions, 0 positional differences. Source /tmp/rx41/sof-17-readable-exact/.
- _CNTCACHEIsTitleRemovable: 23 compiled trials, 23 distinct sources; best 93.70731%, 82/82 instructions, 23 positional differences. Source /tmp/rx41/rem-05-title-values-2/.
- _CNTCACHEDeleteContent: 13 compiled trials, 13 distinct sources; best 95.793106%, 143/145 instructions, 90 positional differences. Source /tmp/rx41/del-02-title-fields-4/.
OSInit's three temporary-source measurements precede the extraction correction; its installed C is 100.0% after the four proven __ArenaLo relocations. Both remaining functions exceed three distinct compiled attempts. Their original asm stays in place, with no claim that either requires assembly.
_CNTCACHEIsTitleRemovable remains open: best diagnostic 93.70731%, 82/82 instructions, 23 differences. Reusing state for sentinel initialization prevents coalescing but forces state into r7 rather than target r4 and changes initial scheduling. The ordinary helper form remains 89.60976%, 80/82, missing the two copies. Enum/const/classifier/real title-field variants did not resolve the allocation.
_CNTCACHEDeleteContent remains open: best 95.793106%, 143/145 instructions. MWCC shares the all-ones title-word mask across the token loop and removes the classifier's result copy, saving two instructions and shifting saved-register allocation. Signed/unsigned equivalent field expressions, structured classifier control flow, separate title words and helper parameters did not recover the target.
## Final validation
The final full gate, without --quick, passes for all three assigned units. Full output: [rx41.final-gate.txt](rx41.final-gate.txt). All string pools are identical. Regressions, forbidden additions and readability warnings are zero. DOL SHA1 is 26116613f624061ba99c8d1a299aaa6efa85670d.
Fresh exact-name objdiff after that clean build gives OSInit 100.0% and TMCJPEGDEC_parse_sof 100.0%. Fresh ctxdiff gives OSInit 270/270 instructions, diffs 0, and parse_sof 223/223, diffs 0.
Before -> after, including the preserved asm:
| Unit | Instruction-exact functions | Exact code bytes | Data bytes |
| --- | --- | --- | --- |
| OS | 21/21 -> 21/21 | 5084/5084 -> 5084/5084 | 1240/1240 -> 1240/1240 |
| cntcache | 5/5 -> 5/5 | 1828/1828 -> 1828/1828 | 280/280 -> 280/280 |
| jdec_main | 13/13 -> 13/13 | 5604/5604 -> 5604/5604 | 256/256 -> 256/256 |
Totals stay 39/39 instruction-exact, 12516/12516 code and 1776/1776 data because asm already counted as exact. Two of the four assigned functions now use C, removing three asm bodies/blocks. OSInit conversion commit: 5511f305.
The source-object snapshot before the final clean rebuild already contained the accepted JPEG object. All 1027 compiled objects reproduce byte-identically after the clean rebuild and final header guard adjustment. Every other translation unit is unchanged. The cache source has no diff.
The inventory has complete coverage: 173 functions, 175 bodies/blocks, 162 ORIGINAL and 11 PLACEHOLDER. Both converted rows are removed. tools/check_asm_inventory.py exits 1 only for the 11 remaining placeholders; there are no stale, duplicate or unlisted entries. The two cache functions are unresolved C reconstruction, not original-assembly exemptions.
All rejected sources and exact measurement artifacts remain under /tmp/rx41. The pre-existing untracked g2 files are untouched. No push, PR, merge, rebase, other-worktree source edit or subagent was performed.

View File

@@ -0,0 +1,35 @@
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[libs/RVL_SDK/src/os/OS] pool: IDENTICAL
[libs/RVL_SDK/src/os/OS] objdiff: code 5084/5084 data 1240/1240 functions 21/21 fuzzy 100.0000 linked code 5084
[libs/RVL_SDK/src/os/OS] instruction-exact functions: 21/21
[libs/RVL_SDK/src/os/OS] section .bss size 112 match 100.0
[libs/RVL_SDK/src/os/OS] section .data size 1008 match 100.0
[libs/RVL_SDK/src/os/OS] section .sbss size 72 match 100.0
[libs/RVL_SDK/src/os/OS] section .sdata size 48 match 100.0
[libs/RVL_SDK/src/os/OS] section .text size 5084 match 100.0
[libs/RVL_SDK/src/os/OS] baseline: code 5084/5084 data 1240 functions 21 fuzzy 100.0000
[libs/RVL_SDK/src/cntcache/cntcache] pool: IDENTICAL
[libs/RVL_SDK/src/cntcache/cntcache] objdiff: code 1828/1828 data 280/280 functions 5/5 fuzzy 100.0000 linked code 1828
[libs/RVL_SDK/src/cntcache/cntcache] instruction-exact functions: 5/5
[libs/RVL_SDK/src/cntcache/cntcache] section .bss size 24 match 100.0
[libs/RVL_SDK/src/cntcache/cntcache] section .data size 232 match 100.0
[libs/RVL_SDK/src/cntcache/cntcache] section .sbss size 16 match 100.0
[libs/RVL_SDK/src/cntcache/cntcache] section .sdata size 8 match 100.0
[libs/RVL_SDK/src/cntcache/cntcache] section .text size 1828 match 100.0
[libs/RVL_SDK/src/cntcache/cntcache] baseline: code 1828/1828 data 280 functions 5 fuzzy 100.0000
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] pool: IDENTICAL
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] objdiff: code 5604/5604 data 256/256 functions 13/13 fuzzy 100.0000 linked code 5604
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] instruction-exact functions: 13/13
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] section .rodata size 256 match 100.0
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] section .text size 5604 match 100.0
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] baseline: code 5604/5604 data 256 functions 13 fuzzy 100.0000
regressions vs baseline: 0
global matched_code_percent: 93.99622 -> 93.99622
global fuzzy_match_percent: 99.81744 -> 99.81744
global complete_code_percent: 80.08451 -> 80.08451
global matched_data_percent: 99.99410 -> 99.99410
forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
note: config touched: config/43U/config.yml (orchestrator reviews every config/symbols change)
GATE PASS

View File

@@ -0,0 +1,35 @@
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[libs/RVL_SDK/src/os/OS] pool: IDENTICAL
[libs/RVL_SDK/src/os/OS] objdiff: code 5084/5084 data 1240/1240 functions 21/21 fuzzy 100.0000 linked code 5084
[libs/RVL_SDK/src/os/OS] instruction-exact functions: 21/21
[libs/RVL_SDK/src/os/OS] section .bss size 112 match 100.0
[libs/RVL_SDK/src/os/OS] section .data size 1008 match 100.0
[libs/RVL_SDK/src/os/OS] section .sbss size 72 match 100.0
[libs/RVL_SDK/src/os/OS] section .sdata size 48 match 100.0
[libs/RVL_SDK/src/os/OS] section .text size 5084 match 100.0
[libs/RVL_SDK/src/os/OS] baseline: code 5084/5084 data 1240 functions 21 fuzzy 100.0000
[libs/RVL_SDK/src/cntcache/cntcache] pool: IDENTICAL
[libs/RVL_SDK/src/cntcache/cntcache] objdiff: code 1828/1828 data 280/280 functions 5/5 fuzzy 100.0000 linked code 1828
[libs/RVL_SDK/src/cntcache/cntcache] instruction-exact functions: 5/5
[libs/RVL_SDK/src/cntcache/cntcache] section .bss size 24 match 100.0
[libs/RVL_SDK/src/cntcache/cntcache] section .data size 232 match 100.0
[libs/RVL_SDK/src/cntcache/cntcache] section .sbss size 16 match 100.0
[libs/RVL_SDK/src/cntcache/cntcache] section .sdata size 8 match 100.0
[libs/RVL_SDK/src/cntcache/cntcache] section .text size 1828 match 100.0
[libs/RVL_SDK/src/cntcache/cntcache] baseline: code 1828/1828 data 280 functions 5 fuzzy 100.0000
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] pool: IDENTICAL
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] objdiff: code 5604/5604 data 256/256 functions 13/13 fuzzy 100.0000 linked code 5604
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] instruction-exact functions: 13/13
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] section .rodata size 256 match 100.0
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] section .text size 5604 match 100.0
[libs/RVLMiddleware/TMC_JPEG/src/jpegdec/jdec_main] baseline: code 5604/5604 data 256 functions 13 fuzzy 100.0000
regressions vs baseline: 0
global matched_code_percent: 93.99622 -> 93.99622
global fuzzy_match_percent: 99.81744 -> 99.81744
global complete_code_percent: 80.08451 -> 80.08451
global matched_data_percent: 99.99410 -> 99.99410
forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
note: config touched: config/43U/config.yml (orchestrator reviews every config/symbols change)
GATE PASS