Compare commits
9 Commits
setting-cl
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b8fb8edd4 | ||
|
|
138cdffaea | ||
|
|
27dcd0f954 | ||
|
|
83f17d7e3f | ||
|
|
56cbf0253b | ||
|
|
734b1517f9 | ||
|
|
23a6eac51c | ||
|
|
294ba4491d | ||
|
|
610fc8ccbf |
@@ -13271,7 +13271,7 @@ __nupSetAuditState__FUc = .text:0x815F0444; // type:function size:0x7C scope:loc
|
||||
__nupBase64Encode__FPUcPUcUl = .text:0x815F04C0; // type:function size:0xFC scope:local
|
||||
__nupGetAuditData__FP14NUPContextInfoPPc = .text:0x815F05BC; // type:function size:0x3D0 scope:local
|
||||
__nupGetTmdView__FUxPP9ESTmdView = .text:0x815F098C; // type:function size:0xB4 scope:local
|
||||
__nupGetBootVersion__FP14ESTitleVersion = .text:0x815F0A40; // type:function size:0x28C scope:local
|
||||
__nupGetBootVersion__14NUPContextInfoFP14ESTitleVersion = .text:0x815F0A40; // type:function size:0x28C scope:local
|
||||
__nupGetTicket__FP12NUPTitleInfoPc = .text:0x815F0CCC; // type:function size:0x164 scope:local
|
||||
__nupGetTmd__FP12NUPTitleInfoPc = .text:0x815F0E30; // type:function size:0x1E4 scope:local
|
||||
__nupGetTitleSize__FP12NUPTitleInfo = .text:0x815F1014; // type:function size:0x22C scope:local
|
||||
|
||||
@@ -122,6 +122,7 @@ struct NUPContextInfo {
|
||||
OSThread thread;
|
||||
OSMutex mutex;
|
||||
u64 threadStack[0x400];
|
||||
s32 __nupGetBootVersion(ESTitleVersion* title);
|
||||
};
|
||||
|
||||
static const char* __nupStatusMessage[6] = {
|
||||
@@ -487,7 +488,7 @@ static void __nupBase64Encode(u8* output, u8* input, unsigned long length) {
|
||||
u8* end = input + length;
|
||||
u32 value = 0;
|
||||
u32 count = 0;
|
||||
static char fillByte = '=';
|
||||
static char pad = '=';
|
||||
|
||||
while (input != end) {
|
||||
count++;
|
||||
@@ -496,39 +497,30 @@ static void __nupBase64Encode(u8* output, u8* input, unsigned long length) {
|
||||
if (count < 3) {
|
||||
continue;
|
||||
}
|
||||
u8 encodedSecond = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 12 & 0x3f];
|
||||
u8 encodedFirst = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 18 & 0x3f];
|
||||
output[0] = encodedFirst;
|
||||
u8 encodedThird = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 6 & 0x3f];
|
||||
output[1] = encodedSecond;
|
||||
u8 encodedFourth = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value & 0x3f];
|
||||
output[2] = encodedThird;
|
||||
output[3] = encodedFourth;
|
||||
output[0] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 18 & 0x3f];
|
||||
count = 0;
|
||||
output[1] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 12 & 0x3f];
|
||||
output[2] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 6 & 0x3f];
|
||||
output[3] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value & 0x3f];
|
||||
output += 4;
|
||||
}
|
||||
|
||||
if (count == 2) {
|
||||
value <<= 8;
|
||||
u8 encodedSecond = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 12 & 0x3f];
|
||||
u8 encodedFirst = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 18 & 0x3f];
|
||||
output[0] = encodedFirst;
|
||||
u8 encodedThird = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 6 & 0x3f];
|
||||
output[1] = encodedSecond;
|
||||
output[2] = encodedThird;
|
||||
output[3] = fillByte;
|
||||
output[0] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 18 & 0x3f];
|
||||
output[1] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 12 & 0x3f];
|
||||
output[2] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 6 & 0x3f];
|
||||
output[3] = pad;
|
||||
return;
|
||||
}
|
||||
if (count != 1) {
|
||||
return;
|
||||
}
|
||||
value <<= 16;
|
||||
u8 encodedSecond = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 12 & 0x3f];
|
||||
u8 encodedFirst = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 18 & 0x3f];
|
||||
output[0] = encodedFirst;
|
||||
output[1] = encodedSecond;
|
||||
output[2] = fillByte;
|
||||
output[3] = fillByte;
|
||||
output[0] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 18 & 0x3f];
|
||||
output[1] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[value >> 12 & 0x3f];
|
||||
output[2] = pad;
|
||||
output[3] = pad;
|
||||
}
|
||||
|
||||
static s32 __nupGetAuditData(NUPContextInfo* context, char** auditData) {
|
||||
@@ -725,7 +717,7 @@ static inline s32 __nupSetBootTitleVersion(ESTitleVersion* title) {
|
||||
return result;
|
||||
}
|
||||
|
||||
static s32 __nupGetBootVersion(NUPContextInfo* context, ESTitleVersion* title) {
|
||||
s32 NUPContextInfo::__nupGetBootVersion(ESTitleVersion* title) {
|
||||
s32 result;
|
||||
ESTmdView* tmdView = 0;
|
||||
|
||||
@@ -736,12 +728,12 @@ static s32 __nupGetBootVersion(NUPContextInfo* context, ESTitleVersion* title) {
|
||||
result = __nupSetBootTitleVersion(title);
|
||||
} else {
|
||||
u32 i;
|
||||
for (i = 0; i < context->ownedTitleCount; i++) {
|
||||
if (context->ownedTitleIds[i] == title->titleId) {
|
||||
for (i = 0; i < ownedTitleCount; i++) {
|
||||
if (ownedTitleIds[i] == title->titleId) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i < context->ownedTitleCount) {
|
||||
if (i < ownedTitleCount) {
|
||||
title->hasTicket = 1;
|
||||
}
|
||||
|
||||
@@ -1174,8 +1166,12 @@ static inline s32 __nupGetBoot2Version(u16* version) {
|
||||
s32 result = ES_GetBoot2Version(&bootVersion);
|
||||
if (result == 0) {
|
||||
u16 checkedVersion = bootVersion;
|
||||
*version = checkedVersion;
|
||||
if (checkedVersion != bootVersion) { result = -0x1389; }
|
||||
if (checkedVersion != bootVersion) {
|
||||
result = -0x1389;
|
||||
}
|
||||
if (checkedVersion != bootVersion) {
|
||||
*version = checkedVersion;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1194,7 +1190,7 @@ static inline s32 __nupGetOwnedTitles(NUPContextInfo* context) {
|
||||
}
|
||||
|
||||
static inline s32 __nupCheckTitleVersion(NUPContextInfo* context, NUPTitleInfo* title) {
|
||||
s32 result = __nupGetBootVersion(context, (ESTitleVersion*)title);
|
||||
s32 result = context->__nupGetBootVersion((ESTitleVersion*)title);
|
||||
if (result == 0) {
|
||||
if (title->hasTicket && title->hasTmd && title->hasContent &&
|
||||
title->installedVersion >= title->serverVersion) {
|
||||
@@ -1225,11 +1221,11 @@ static inline void __nupSetStatus(NUPContextInfo* context, s32 status) {
|
||||
extern "C" void* __nupOp(void* argument) {
|
||||
u8* response = 0;
|
||||
ESTmdView* tmdView = 0;
|
||||
u32 currentDeviceId;
|
||||
u32 needsAudit;
|
||||
char* auditData = 0;
|
||||
u32 needsAudit;
|
||||
u32 currentDeviceId;
|
||||
s32 result;
|
||||
u16 serverBootVersion = 0;
|
||||
u16 serverBootVersion;
|
||||
u16 bootTitleVersion;
|
||||
u16 systemMenuVersion;
|
||||
ESTitleId currentTitleId;
|
||||
|
||||
@@ -83,8 +83,8 @@ static u8* __nupNhttpBufFull(u8** buffer, unsigned long* length, unsigned long r
|
||||
}
|
||||
done:
|
||||
if (state->error != 0) {
|
||||
next = NULL;
|
||||
*length = 0;
|
||||
next = NULL;
|
||||
}
|
||||
return next;
|
||||
}
|
||||
@@ -101,12 +101,13 @@ static void __nupNhttpReqDone(int result, void* response, HttpState* state) {
|
||||
}
|
||||
|
||||
static int __nupNhttpOp(char* url, NHTTPReqMethod method, char* headers, u8* body, unsigned long bodyLength, unsigned long limit, ProgressCallback progress, void* progressContext, FlushCallback flush, void* flushContext) {
|
||||
unsigned long transferred, expected;
|
||||
int length;
|
||||
char* responseHeaders = NULL;
|
||||
u8* responseBody = NULL;
|
||||
HttpState state;
|
||||
int status;
|
||||
u8* responseBody = NULL;
|
||||
char* responseHeaders = NULL;
|
||||
int length;
|
||||
unsigned long expected;
|
||||
unsigned long transferred;
|
||||
HttpState state;
|
||||
state.error = 0;
|
||||
state.limit = limit;
|
||||
state.received = 0;
|
||||
@@ -130,16 +131,15 @@ static int __nupNhttpOp(char* url, NHTTPReqMethod method, char* headers, u8* bod
|
||||
if (headerCopy == NULL) { result = -5000; goto cleanup; }
|
||||
memcpy(headerCopy, headers, size);
|
||||
char* field = headerCopy;
|
||||
while (*field != 0) {
|
||||
char* colon = strchr(field, ':');
|
||||
if (colon == NULL) break;
|
||||
char* end = strstr(colon, "\r\n");
|
||||
if (end == NULL) break;
|
||||
char* colon;
|
||||
char* end;
|
||||
char* value;
|
||||
while (*field != 0 && (colon = strchr(field, ':')) != NULL && (end = strstr(colon, "\r\n")) != NULL) {
|
||||
*colon = 0;
|
||||
*end = 0;
|
||||
while (*field && isspace(*field)) field++;
|
||||
do { colon++; } while (*colon && isspace(*colon));
|
||||
if (NHTTPAddHeaderField(request, field, colon) != 0) { result = -7000 - NHTTPGetError(); goto cleanup; }
|
||||
value = colon + 1; while (*value && isspace(*value)) value++;
|
||||
if (NHTTPAddHeaderField(request, field, value) != 0) { result = -7000 - NHTTPGetError(); goto cleanup; }
|
||||
field = end + 2;
|
||||
}
|
||||
}
|
||||
@@ -153,40 +153,44 @@ static int __nupNhttpOp(char* url, NHTTPReqMethod method, char* headers, u8* bod
|
||||
if (method == NHTTP_POST && body != NULL && bodyLength != 0 && NHTTPAddPostDataRaw(request, body, bodyLength) != 0) { result = -7000 - NHTTPGetError(); goto cleanup; }
|
||||
requestId = NHTTPSendRequestAsync(request);
|
||||
if (requestId < 0) {
|
||||
int error = NHTTPGetError();
|
||||
result = -7000 - NHTTPGetError();
|
||||
NHTTPDeleteRequest(request);
|
||||
result = -7000 - error;
|
||||
goto cleanup;
|
||||
}
|
||||
state.lastActivity = OSGetTime();
|
||||
for (;;) {
|
||||
if (NHTTPGetProgress(&expected, &transferred) != 0 && state.done != 0) {
|
||||
if (state.result != 0) { result = -7000 - state.result; goto cleanup; }
|
||||
if (state.response != NULL) {
|
||||
length = NHTTPGetBodyAll(state.response, &responseBody);
|
||||
if (length < 0) { result = -5007; goto cleanup; }
|
||||
__nupNhttpBufFull(&responseBody, (unsigned long*)&length, 0, NULL, NULL, &state);
|
||||
}
|
||||
result = state.error;
|
||||
if (result != 0 || state.response == NULL) goto cleanup;
|
||||
length = NHTTPGetHeaderAll(state.response, &responseHeaders);
|
||||
if (length < 0) { result = -5007; goto cleanup; }
|
||||
char* protocol = strstr(responseHeaders, "HTTP/");
|
||||
if (protocol != NULL && sscanf(protocol, "HTTP/%*d.%*d %d", &status) == 1) {
|
||||
if (status != 200 && status != 202) result = -5000 - status;
|
||||
goto cleanup;
|
||||
while (NHTTPGetProgress(&expected, &transferred) == 0 || state.done == 0) {
|
||||
if (OSGetTime() - state.lastActivity >= OSMillisecondsToTicks((OSTime)90000)) {
|
||||
if (requestId >= 0) {
|
||||
NHTTPCancelRequestAsync(requestId);
|
||||
NCDSleep(OSMillisecondsToTicks(100));
|
||||
}
|
||||
result = -5009;
|
||||
goto cleanup;
|
||||
}
|
||||
NCDSleep(OSMillisecondsToTicks(100));
|
||||
}
|
||||
if (state.result != 0) { result = -7000 - state.result; goto cleanup; }
|
||||
if (state.response != NULL) {
|
||||
length = NHTTPGetBodyAll(state.response, &responseBody);
|
||||
if (length < 0) { result = -5007; goto cleanup; }
|
||||
__nupNhttpBufFull(&responseBody, (unsigned long*)&length, 0, NULL, NULL, &state);
|
||||
}
|
||||
if (state.error != 0) {
|
||||
result = state.error;
|
||||
goto cleanup;
|
||||
}
|
||||
if (state.response == NULL) goto cleanup;
|
||||
length = NHTTPGetHeaderAll(state.response, &responseHeaders);
|
||||
if (length < 0) { result = -5007; goto cleanup; }
|
||||
{
|
||||
char* protocol = strstr(responseHeaders, "HTTP/");
|
||||
if (protocol == NULL || sscanf(protocol, "HTTP/%*d.%*d %d", &status) != 1) {
|
||||
result = -5007;
|
||||
goto cleanup;
|
||||
}
|
||||
if (OSGetTime() - state.lastActivity >= OSMillisecondsToTicks(90000)) break;
|
||||
NCDSleep(OSMillisecondsToTicks(100));
|
||||
if (status != 200 && status != 202) result = -5000 - status;
|
||||
goto cleanup;
|
||||
}
|
||||
if (requestId >= 0) {
|
||||
NHTTPCancelRequestAsync(requestId);
|
||||
NCDSleep(OSMillisecondsToTicks(100));
|
||||
}
|
||||
result = -5009;
|
||||
cleanup:
|
||||
if (state.response != NULL || result == -5009) NHTTPDestroyResponse(state.response);
|
||||
if (headerCopy != NULL) nup::__nupFree(headerCopy);
|
||||
@@ -200,7 +204,7 @@ static long __nupHttpStringFlush(u8* data, unsigned long length, unsigned long r
|
||||
total = length + text->length;
|
||||
long result = 0;
|
||||
if (total > text->capacity) {
|
||||
if (requested >= total) {} else {
|
||||
if (requested < total) {
|
||||
requested = text->growth + total;
|
||||
text->growth <<= 1;
|
||||
if (text->growth < text->maximumGrowth) {} else text->growth = text->maximumGrowth;
|
||||
|
||||
@@ -19,17 +19,20 @@ typedef struct HMACContext {
|
||||
u8 key[64];
|
||||
} HMACContext;
|
||||
|
||||
char hmac_file_name[] = "hmac.c";
|
||||
char hmac_newline[] = "\n";
|
||||
|
||||
void NETHMACInit(HMACContext* context, const DigestInterface* interface, const void* key, u32 length) {
|
||||
u8 innerKey[64];
|
||||
u32 i;
|
||||
u32 keyLength;
|
||||
void* work = context->digestContext;
|
||||
u8* work = context->digestContext;
|
||||
const char* function = "NETHMACInit";
|
||||
context->interface = *interface;
|
||||
if (context->interface.contextSize > 96 || context->interface.blockSize > 64) {
|
||||
OSReport("%s(%d):[warning in %s]", "hmac.c", 100, function);
|
||||
OSReport("%s(%d):[warning in %s]", hmac_file_name, 100, function);
|
||||
OSReport("specified interface needs too large workmemory.");
|
||||
OSReport("\n");
|
||||
OSReport(hmac_newline);
|
||||
return;
|
||||
}
|
||||
if (length <= context->interface.blockSize) {
|
||||
@@ -44,8 +47,8 @@ void NETHMACInit(HMACContext* context, const DigestInterface* interface, const v
|
||||
keyLength = context->keyLength;
|
||||
for (i=0; i<keyLength; ++i) innerKey[i] = context->key[i] ^ 0x36;
|
||||
memset(innerKey + keyLength, 0x36, context->interface.blockSize - keyLength);
|
||||
context->interface.init(context->digestContext);
|
||||
context->interface.update(context->digestContext, innerKey, context->interface.blockSize);
|
||||
context->interface.init(work);
|
||||
context->interface.update(work, innerKey, context->interface.blockSize);
|
||||
}
|
||||
|
||||
void NETHMACUpdate(HMACContext* context, const void* data, u32 length) {
|
||||
@@ -57,13 +60,13 @@ void NETHMACGetDigest(HMACContext* context, void* digest) {
|
||||
u8 outerKey[64];
|
||||
u32 i;
|
||||
u32 keyLength;
|
||||
void* work = context->digestContext;
|
||||
context->interface.getDigest(work, innerDigest);
|
||||
u8* work = context->digestContext;
|
||||
context->interface.getDigest(context->digestContext, innerDigest);
|
||||
keyLength = context->keyLength;
|
||||
for (i=0; i<keyLength; ++i) outerKey[i] = context->key[i] ^ 0x5c;
|
||||
memset(outerKey + keyLength, 0x5c, context->interface.blockSize - keyLength);
|
||||
context->interface.init(context->digestContext);
|
||||
context->interface.update(context->digestContext, outerKey, context->interface.blockSize);
|
||||
context->interface.init(work);
|
||||
context->interface.update(work, outerKey, context->interface.blockSize);
|
||||
context->interface.update(work, innerDigest, context->interface.digestSize);
|
||||
context->interface.getDigest(work, digest);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,16 @@ void NETMD5GetDigest(NETMD5Context* context, void* digest) {
|
||||
}
|
||||
|
||||
#define ROTATE(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
|
||||
#define STEP(a, b, c, d, f, word, n) ((a) += (f), (a) = (b) + ROTATE(__lwbrx(0, (int)(word)) + (*constant + (a)), n))
|
||||
#define STEP(a, b, c, d, f, word, n) \
|
||||
do { \
|
||||
u32* _p = (word); \
|
||||
u32 _k = *constant; \
|
||||
u32 _xw = __lwbrx(_p, 0); \
|
||||
u32 _wc = __lwbrx(_p, 0) + _k; \
|
||||
(a) += (f); \
|
||||
(a) = (b) + ((_wc + (a)) << (n) | (_xw + (_k + (a))) >> (32 - (n))); \
|
||||
++constant; \
|
||||
} while (0)
|
||||
|
||||
static void ProcessBlock(NETMD5Context* context) {
|
||||
static u32 constants[64] = {0xD76AA478, 0xE8C7B756, 0x242070DB, 0xC1BDCEEE, 0xF57C0FAF, 0x4787C62A, 0xA8304613, 0xFD469501, 0x698098D8, 0x8B44F7AF, 0xFFFF5BB1, 0x895CD7BE, 0x6B901122, 0xFD987193, 0xA679438E, 0x49B40821, 0xF61E2562, 0xC040B340, 0x265E5A51, 0xE9B6C7AA, 0xD62F105D, 0x02441453, 0xD8A1E681, 0xE7D3FBC8, 0x21E1CDE6, 0xC33707D6, 0xF4D50D87, 0x455A14ED, 0xA9E3E905, 0xFCEFA3F8, 0x676F02D9, 0x8D2A4C8A, 0xFFFA3942, 0x8771F681, 0x6D9D6122, 0xFDE5380C, 0xA4BEEA44, 0x4BDECFA9, 0xF6BB4B60, 0xBEBFBC70, 0x289B7EC6, 0xEAA127FA, 0xD4EF3085, 0x04881D05, 0xD9D4D039, 0xE6DB99E5, 0x1FA27CF8, 0xC4AC5665, 0xF4292244, 0x432AFF97, 0xAB9423A7, 0xFC93A039, 0x655B59C3, 0x8F0CCC92, 0xFFEFF47D, 0x85845DD1, 0x6FA87E4F, 0xFE2CE6E0, 0xA3014314, 0x4E0811A1, 0xF7537E82, 0xBD3AF235, 0x2AD7D2BB, 0xEB86D391};
|
||||
@@ -83,30 +92,30 @@ static void ProcessBlock(NETMD5Context* context) {
|
||||
block = context->buffer32;
|
||||
word = block;
|
||||
constant = constants;
|
||||
for (round = 0; round < 4; ++round) {
|
||||
STEP(a,b,c,d,(b & c) | (~b & d),word++,7);
|
||||
STEP(d,a,b,c,(a & b) | (~a & c),word++,12);
|
||||
STEP(c,d,a,b,(d & a) | (~d & b),word++,17);
|
||||
STEP(b,c,d,a,(c & d) | (~c & a),word++,22);
|
||||
}
|
||||
index = indices;
|
||||
for (round = 0; round < 4; ++round) {
|
||||
STEP(a,b,c,d,(b & c) | (~b & d),word,7); ++word; ++constant;
|
||||
STEP(d,a,b,c,(a & b) | (~a & c),word,12); ++word; ++constant;
|
||||
STEP(c,d,a,b,(d & a) | (~d & b),word,17); ++word; ++constant;
|
||||
STEP(b,c,d,a,(c & d) | (~c & a),word,22); ++word; ++constant;
|
||||
STEP(a,b,c,d,(b & d) | (c & ~d),block + *index++,5);
|
||||
STEP(d,a,b,c,(a & c) | (b & ~c),block + *index++,9);
|
||||
STEP(c,d,a,b,(d & b) | (a & ~b),block + *index++,14);
|
||||
STEP(b,c,d,a,(c & a) | (d & ~a),block + *index++,20);
|
||||
}
|
||||
for (round = 0; round < 4; ++round) {
|
||||
STEP(a,b,c,d,(b & d) | (c & ~d),block + *index,5); ++index; ++constant;
|
||||
STEP(d,a,b,c,(a & c) | (b & ~c),block + *index,9); ++index; ++constant;
|
||||
STEP(c,d,a,b,(d & b) | (a & ~b),block + *index,14); ++index; ++constant;
|
||||
STEP(b,c,d,a,(c & a) | (d & ~a),block + *index,20); ++index; ++constant;
|
||||
STEP(a,b,c,d,d ^ b ^ c,block + *index++,4);
|
||||
STEP(d,a,b,c,c ^ a ^ b,block + *index++,11);
|
||||
STEP(c,d,a,b,b ^ d ^ a,block + *index++,16);
|
||||
STEP(b,c,d,a,a ^ c ^ d,block + *index++,23);
|
||||
}
|
||||
for (round = 0; round < 4; ++round) {
|
||||
STEP(a,b,c,d,d ^ b ^ c,block + *index,4); ++index; ++constant;
|
||||
STEP(d,a,b,c,c ^ a ^ b,block + *index,11); ++index; ++constant;
|
||||
STEP(c,d,a,b,b ^ d ^ a,block + *index,16); ++index; ++constant;
|
||||
STEP(b,c,d,a,a ^ c ^ d,block + *index,23); ++index; ++constant;
|
||||
}
|
||||
for (round = 0; round < 4; ++round) {
|
||||
STEP(a,b,c,d,c ^ (b | ~d),block + *index,6); ++index; ++constant;
|
||||
STEP(d,a,b,c,b ^ (a | ~c),block + *index,10); ++index; ++constant;
|
||||
STEP(c,d,a,b,a ^ (d | ~b),block + *index,15); ++index; ++constant;
|
||||
STEP(b,c,d,a,d ^ (c | ~a),block + *index,21); ++index; ++constant;
|
||||
STEP(a,b,c,d,c ^ (b | ~d),block + *index++,6);
|
||||
STEP(d,a,b,c,b ^ (a | ~c),block + *index++,10);
|
||||
STEP(c,d,a,b,a ^ (d | ~b),block + *index++,15);
|
||||
STEP(b,c,d,a,d ^ (c | ~a),block + *index++,21);
|
||||
}
|
||||
context->a += a;
|
||||
context->b += b;
|
||||
|
||||
@@ -13,8 +13,8 @@ int SOiIsBufferAddrCheck(void);
|
||||
void* SOiAlloc(u32, s32);
|
||||
void SOiFree(u32, void*, s32);
|
||||
|
||||
static int soSocketRegistered;
|
||||
const char* __SOCKETVersion="<< RVL_SDK - SOCKET \trelease build: Dec 12 2008 03:06:17 (0x4199_60831) >>";
|
||||
static int soSocketRegistered[2];
|
||||
const char* __SOCKETVersion ="<< RVL_SDK - SOCKET \trelease build: Dec 12 2008 03:06:17 (0x4199_60831) >>";
|
||||
|
||||
typedef struct SocketRequest { int socket; int type; int protocol; } SocketRequest;
|
||||
typedef struct AddressRequest { int socket; int hasAddress; SOSockAddr address; } AddressRequest;
|
||||
@@ -35,9 +35,12 @@ typedef struct RecvRequest {
|
||||
union { struct { int socket; int flags; } command; u8 commandBlock[32]; };
|
||||
SOSockAddr address;
|
||||
} RecvRequest;
|
||||
typedef struct SendCmd {
|
||||
int socket; int flags; int hasAddress; SOSockAddr address;
|
||||
} SendCmd;
|
||||
typedef struct SendRequest {
|
||||
IOSIoVector vectors[4];
|
||||
struct { int socket; int flags; int hasAddress; SOSockAddr address; } command;
|
||||
SendCmd command;
|
||||
} SendRequest;
|
||||
|
||||
static int RecvFrom(const char*, int, void*, int, int, SOSockAddr*);
|
||||
@@ -47,7 +50,7 @@ int SOSocket(int family, int type, int protocol) {
|
||||
s32 rm;
|
||||
SocketRequest* request;
|
||||
int result;
|
||||
if(!soSocketRegistered) { OSRegisterVersion(__SOCKETVersion); soSocketRegistered=1; }
|
||||
if(!soSocketRegistered[0]) { OSRegisterVersion(__SOCKETVersion); soSocketRegistered[0]=1; }
|
||||
if((result=SOiPrepare(NULL,&rm))==0) {
|
||||
if(family==23) result=-5;
|
||||
else {
|
||||
@@ -87,7 +90,7 @@ int SOBind(int socket, void* address) {
|
||||
int result;
|
||||
AddressRequest* request;
|
||||
if((result=SOiPrepare(NULL,&rm))==0) {
|
||||
if(!addr || addr->len>8 || addr->len<8) result=-28;
|
||||
if(!address || addr->len>8 || addr->len<8) result=-28;
|
||||
else {
|
||||
request=SOiAlloc(12,64);
|
||||
if(!request) result=-49;
|
||||
@@ -109,7 +112,7 @@ int SOConnect(int socket, void* address) {
|
||||
int result;
|
||||
AddressRequest* request;
|
||||
if((result=SOiPrepare(NULL,&rm))==0) {
|
||||
if(!addr || addr->len>8 || addr->len<8) result=-28;
|
||||
if(!address || addr->len>8 || addr->len<8) result=-28;
|
||||
else {
|
||||
request=SOiAlloc(12,64);
|
||||
if(!request) result=-49;
|
||||
@@ -125,26 +128,24 @@ int SOConnect(int socket, void* address) {
|
||||
return result;
|
||||
}
|
||||
|
||||
int SOGetSockName(int socket, void* address) {
|
||||
int SOGetSockName(int socket, SOSockAddr* address) {
|
||||
int size;
|
||||
int result;
|
||||
s32 rm;
|
||||
SOSockAddr* addr;
|
||||
SOSockAddr* reply;
|
||||
NameRequest* request;
|
||||
addr=address;
|
||||
SOSockAddr* reply;
|
||||
if((result=SOiPrepare(NULL,&rm))==0) {
|
||||
if(!addr || addr->len>8 || addr->len<8) result=-28;
|
||||
if(!address || address->len>8 || address->len<8) result=-28;
|
||||
else {
|
||||
size=(addr->len+63)&~31;
|
||||
size=(address->len+63)&~31;
|
||||
request=SOiAlloc(12,size);
|
||||
if(!request) result=-49;
|
||||
else {
|
||||
request->socket=socket;
|
||||
reply=&request->address;
|
||||
memcpy(reply,addr,addr->len);
|
||||
result=IOS_Ioctl(rm,7,request,4,reply,addr->len);
|
||||
if(result>=0) memcpy(addr,reply,reply->len);
|
||||
memcpy(reply,address,address->len);
|
||||
result=IOS_Ioctl(rm,7,request,4,reply,address->len);
|
||||
if(result>=0) memcpy(address,reply,reply->len);
|
||||
SOiFree(12,request,size);
|
||||
}
|
||||
}
|
||||
@@ -199,7 +200,7 @@ int SOShutdown(int socket, int how) {
|
||||
|
||||
int SOPoll(SOPollFD* fds, unsigned int count, s64 timeout) {
|
||||
s32 rm;
|
||||
s32 result,bytes,size;
|
||||
s32 size,bytes,result;
|
||||
PollRequest* request;
|
||||
SOPollFD* reply;
|
||||
if((result=SOiPrepare(NULL,&rm))==0) {
|
||||
@@ -256,11 +257,11 @@ char* SOInetNtoA(SOInAddr address) {
|
||||
|
||||
int SOInetPtoN(int family, const char* text, void* address) {
|
||||
s32 rm;
|
||||
int temporary,result,size,bytes;
|
||||
int size,temporary,result,bytes;
|
||||
InetRequest* request;
|
||||
if((result=SOiPrepareTempRm(NULL,&rm,&temporary))==0) {
|
||||
bytes=0;
|
||||
if(family==2) bytes=4;
|
||||
switch(family) { case 2: bytes=4; break; default: break; }
|
||||
if(!bytes) result=-5;
|
||||
else if(!text) result=-28;
|
||||
else {
|
||||
@@ -305,10 +306,10 @@ static inline int DirectBuffer(const void* data, int length) {
|
||||
static int RecvFrom(const char* name, int socket, void* data, int length, int flags, SOSockAddr* address) {
|
||||
s32 rm;
|
||||
int result,size;
|
||||
BOOL direct;
|
||||
RecvRequest* request;
|
||||
void* buffer;
|
||||
SOSockAddr* reply;
|
||||
BOOL direct;
|
||||
if(length>32768) length=32768;
|
||||
if((result=SOiPrepare(name,&rm))==0) {
|
||||
if(address && (address->len>8 || address->len<8)) result=-28;
|
||||
@@ -316,7 +317,7 @@ static int RecvFrom(const char* name, int socket, void* data, int length, int fl
|
||||
else {
|
||||
direct=TRUE;
|
||||
if(length && !DirectBuffer(data,length)) direct=FALSE;
|
||||
size=((address ? address->len : 0)+95)&~31;
|
||||
size=((address==0 ? 0 : address->len)+95)&~31;
|
||||
request=SOiAlloc(12,size);
|
||||
if(!direct) buffer=SOiAlloc(13,(length+31)&~31);
|
||||
else buffer=data;
|
||||
@@ -330,13 +331,12 @@ static int RecvFrom(const char* name, int socket, void* data, int length, int fl
|
||||
request->vectors[2].base=NULL; request->vectors[2].length=0;
|
||||
result=IOS_Ioctlv(rm,12,1,2,request->vectors);
|
||||
} else {
|
||||
memcpy(reply,address,address->len);
|
||||
memcpy(reply,(SOSockAddr*)address,address->len);
|
||||
request->vectors[2].base=(u8*)reply; request->vectors[2].length=address->len;
|
||||
result=IOS_Ioctlv(rm,12,1,2,request->vectors);
|
||||
if(result>=0) {
|
||||
u32 bytes=address->len;
|
||||
if(bytes>reply->len) bytes=reply->len;
|
||||
memcpy(address,reply,bytes);
|
||||
memcpy(address,reply,bytes>reply->len?reply->len:bytes);
|
||||
}
|
||||
}
|
||||
if(result>=0 && !direct) memcpy(data,buffer,length);
|
||||
@@ -362,19 +362,20 @@ static int SendTo(const char* name, int socket, const void* data, int length, in
|
||||
direct=TRUE;
|
||||
if(length && !DirectBuffer(data,length)) direct=FALSE;
|
||||
request=SOiAlloc(12,96);
|
||||
if(!direct) buffer=SOiAlloc(14,(length+31)&~31);
|
||||
if(direct==0) buffer=SOiAlloc(14,(length+31)&~31);
|
||||
else buffer=(void*)data;
|
||||
if(!request || !buffer) result=-49;
|
||||
else {
|
||||
request->command.socket=socket; request->command.flags=flags;
|
||||
if(!address) request->command.hasAddress=0;
|
||||
SendCmd* cmd=&request->command;
|
||||
cmd->socket=socket; cmd->flags=flags;
|
||||
if(!address) cmd->hasAddress=0;
|
||||
else {
|
||||
request->command.hasAddress=1;
|
||||
memcpy(&request->command.address,address,address->len);
|
||||
cmd->hasAddress=1;
|
||||
memcpy(&cmd->address,address,address->len);
|
||||
}
|
||||
if(!direct) memcpy(buffer,data,length);
|
||||
request->vectors[0].base=buffer; request->vectors[0].length=length;
|
||||
request->vectors[1].base=(u8*)&request->command; request->vectors[1].length=40;
|
||||
request->vectors[1].base=(u8*)cmd; request->vectors[1].length=40;
|
||||
result=IOS_Ioctlv(rm,13,2,0,request->vectors);
|
||||
}
|
||||
if(!direct) SOiFree(14,buffer,(length+31)&~31);
|
||||
|
||||
@@ -94,8 +94,12 @@ int SOGetAddrInfo(const char* nodeName, const char* servName, const SOAddrInfo*
|
||||
char* node;
|
||||
char* service;
|
||||
SOAddrInfo* requestHints;
|
||||
int nodeSize,servSize;
|
||||
if((result=SOiPrepare(NULL,&rm))==0) {
|
||||
size=(((NameSize(nodeName)+31)&~31)+((servName ? strlen(nodeName)+32 : 31)&~31)+95)&~31;
|
||||
servSize = servName==0 ? 0 : strlen(nodeName)+1;
|
||||
nodeSize = nodeName==0 ? 0 : strlen(nodeName)+1;
|
||||
size=((nodeSize+31)&~31)+((servSize+31)&~31)+95;
|
||||
size&=~31;
|
||||
request=SOiAlloc(12,size);
|
||||
if(!request) result=-49;
|
||||
else {
|
||||
@@ -103,14 +107,14 @@ int SOGetAddrInfo(const char* nodeName, const char* servName, const SOAddrInfo*
|
||||
if(!reply) { SOiFree(12,request,size); result=-49; }
|
||||
else {
|
||||
node=(char*)request->storage;
|
||||
service=node+((NameSize(nodeName)+31)&~31);
|
||||
requestHints=(SOAddrInfo*)(service+((servName ? strlen(nodeName)+32 : 31)&~31));
|
||||
service=node+(((nodeName==0 ? 0 : strlen(nodeName)+1)+31)&~31);
|
||||
requestHints=(SOAddrInfo*)(service+(((servName==0 ? 0 : strlen(nodeName)+1)+31)&~31));
|
||||
if(nodeName) strcpy(node,nodeName);
|
||||
request->vectors[0].base=nodeName ? (u8*)node : NULL;
|
||||
request->vectors[0].length=nodeName ? strlen(nodeName) : 0;
|
||||
request->vectors[0].length=nodeName==0 ? 0 : strlen(nodeName);
|
||||
if(servName) strcpy(service,servName);
|
||||
request->vectors[1].base=servName ? (u8*)service : NULL;
|
||||
request->vectors[1].length=servName ? strlen(servName) : 0;
|
||||
request->vectors[1].length=servName==0 ? 0 : strlen(servName);
|
||||
if(hints) memcpy(requestHints,hints,32);
|
||||
else memset(requestHints,0,32);
|
||||
if(requestHints->family==0) requestHints->family=2;
|
||||
@@ -121,7 +125,7 @@ int SOGetAddrInfo(const char* nodeName, const char* servName, const SOAddrInfo*
|
||||
request->vectors[3].base=(u8*)reply; request->vectors[3].length=0x834;
|
||||
result=IOS_Ioctlv(rm,24,3,1,request->vectors);
|
||||
if(result>=0) {
|
||||
SOAddrInfo* entry=reply->entries;
|
||||
SOAddrInfo* entry=(SOAddrInfo*)reply;
|
||||
u8* address=reply->addresses;
|
||||
*resultInfo=entry;
|
||||
while(entry) {
|
||||
|
||||
@@ -111,8 +111,8 @@ int SOGetInterfaceOpt(void* interface, int level, int option, void* value, int*
|
||||
else {
|
||||
command=&request->command;
|
||||
command->level=level; command->option=option;
|
||||
returnedLength=&request->length;
|
||||
reply=request->value;
|
||||
returnedLength=(int*)((u8*)command+0x20);
|
||||
reply=(u8*)returnedLength+0x20;
|
||||
*returnedLength=OptionLength(length);
|
||||
request->vectors[0].base=(u8*)command;
|
||||
request->vectors[0].length=8;
|
||||
@@ -152,7 +152,7 @@ int SOSetInterfaceOpt(void* interface, int level, int option, const void* value,
|
||||
else {
|
||||
command=&request->command;
|
||||
command->level=level; command->option=option;
|
||||
reply=request->value;
|
||||
reply=(u8*)command+0x20;
|
||||
if(value) memcpy(reply,value,length);
|
||||
else memset(reply,0,length);
|
||||
request->vectors[0].base=(u8*)command; request->vectors[0].length=8;
|
||||
|
||||
144
tools/decomp-assist/netlib.attempts.md
Normal file
144
tools/decomp-assist/netlib.attempts.md
Normal file
@@ -0,0 +1,144 @@
|
||||
|
||||
## Pass 3 (w0929 worker session)
|
||||
|
||||
### Member-function symbol-name dialect (new lever)
|
||||
Orig .o symbol names come from symbols.txt metadata, not ground truth. Orig's
|
||||
`__nupGetBootVersion__FP14ESTitleVersion` used an old no-class-scope `__F`
|
||||
member dialect; the fn is actually `s32 NUPContextInfo::__nupGetBootVersion(ESTitleVersion*)`.
|
||||
Writing it as a member fn + fixing symbols.txt to the `__14NUPContextInfoF` name
|
||||
made objdiff pair it (None → 99.36, insn-identical, 17 regname diffs remain).
|
||||
Correcting WRONG names in symbols.txt is legitimate (extracted objects never link).
|
||||
|
||||
### Re-tested-condition decode (new lever)
|
||||
`if (x != y) { result = ERR; } if (x != y) { *out = x; }` — re-testing the same
|
||||
comparison emits a dead second `cmplw`. Took `__nupGetBoot2Version`/`__nupOp`
|
||||
from 437 to 438=438 structural match.
|
||||
|
||||
### MD5 dual-lwbrx STEP
|
||||
Orig emits TWO `__lwbrx(word,0)` loads per step: first feeds the `>>` (rotate-low)
|
||||
chain `word + (const + (a+f))`, second feeds `word + const` → `(a+f) + wc` (`<<` side).
|
||||
Capture order matters: `_xw = __lwbrx(w)` (X side) then `_wc = __lwbrx(w) + *const`
|
||||
(Y side), `a += f` between decl and use, `(a) = b + (((a)+_wc) << n | (_xw + (const + a)) >> (32-n))`.
|
||||
Reversed `|` operands pick srwi-base + rlwimi (orig) over slwi+rlwimi. 57.1 → 70.8.
|
||||
Residual: orig's `word` walks in-place (`addi r4,r4,4`) vs MWCC strength-reduced
|
||||
`base + 4k` recomputes; post-inc/_wp capture forms don't defeat it. Documented tie.
|
||||
|
||||
### `!direct` arm-order (SOBasic RecvFrom/SendTo)
|
||||
Orig: `if (!direct) buffer = SOiAlloc(...); else buffer = data;` — alloc in-line,
|
||||
data out-of-line via `bne`. `if(direct) data else alloc` emits opposite layout.
|
||||
SendTo: `if (direct == 0)` form (not `switch(direct){default/case 1}` which emits
|
||||
`cmpwi 1; beq`, nor `!direct` ternary which flips arms back). RecvFrom: `!direct`.
|
||||
Both now instruction-identical (regname-only residual).
|
||||
|
||||
### Interface fn-pointer marshal order (hmac — partial)
|
||||
`context->interface.init(work)` vs `init(context->digestContext)`: reusing the
|
||||
`work` local matches orig's `mr r3,rX`; recomputing emits `addi r3,ctx,0x20`.
|
||||
NETHMACGetDigest orig keeps `context->digestContext` in a callee web for calls
|
||||
1/4/5 and materializes `work` via `mr r31,r30` at first use (web-split copy);
|
||||
my build rematerializes the addi — 3-insn gap, allocator-internal.
|
||||
|
||||
### Cold-block out-of-line (HttpStringFlush — parked)
|
||||
Orig emits `blt → growth-block` + `b → malloc` (growth block detached, cold).
|
||||
`if/else`, positive `if`, `!cond` ternary, `goto` forms all normalize to
|
||||
in-line growth. Same family as the documented select/cold-block walls.
|
||||
|
||||
### Base64Encode / ParseServerInfo / nupOp / GetTitleSize / GetBootVersion
|
||||
All verified: instruction-identical streams (452=452 ParseServerInfo) or tiny
|
||||
scheduling swaps — pure web-rotation / marshal-order ties, no source lever found.
|
||||
|
||||
### AESiEncryptBlock / AESiDecryptBlock / NETAESCreateEx
|
||||
158=158 / structurally complete — remaining diff is the interleave ORDER of the
|
||||
16 table-index `rlwinm` extracts vs `lwzx` loads across the 4 ENCRYPT terms
|
||||
(pure list-scheduler shape); ENCRYPT operand-assoc/order variants don't move it.
|
||||
|
||||
## Pass 4 (orchestrator resume — decode walls)
|
||||
|
||||
### MD5 base-materialization + increment placement (70.8 -> 79.2)
|
||||
Orig materializes `&indices` at the round-2 boundary (`lis/addi` mid-function), not in
|
||||
the prologue — `u32* index` declared at top but `index = indices` assigned BETWEEN
|
||||
loop 1 and loop 2. Orig also schedules `++constant` inside the step body (each step's
|
||||
end), not as a separate statement after STEP — `++constant` moved inside the STEP
|
||||
macro tail. Combined: 70.8 -> 79.2, 307=307 insns. `*++constant`/`*constant++` forms
|
||||
score higher (75.7) but read constants[1..64] — semantically wrong (OOB on last step),
|
||||
rejected. Residual: software-pipelining — orig prefetches next-step `lwz 4(rc)` /
|
||||
`lwz idx` / `lwbrx` into the current step's tail; MWCC won't pipeline with this web
|
||||
set. Tried: block-scoped round webs (C89 — no for-init decls; block-wrap BUILDFAIL
|
||||
fixup attempt regressed), `*index++`/`word++` in expr/macro (74.1), block/wptr
|
||||
elimination via context->buffer32 (70.0), const-1 init (73.1).
|
||||
|
||||
### AES extract/load interleave — all forms regress (60.35 stays)
|
||||
nextA-D temps confirmed (fused per-statement key-xor -> 44). Tried: key+=4 early
|
||||
(57.4), xor order rev (56.0), next-decl rev (58.7), xor operand swap key^next (56.4),
|
||||
for(rounds>1) (53.8), *key++ (57.4), reversed xor chain (52.8), right-assoc (56.0).
|
||||
Orig's interleave mixes extract/lwzx/rotlwi/xor across all 4 terms — MWCC list-
|
||||
scheduler shape, no source lever found. Documented wall.
|
||||
|
||||
### ParseServerInfo — instruction-identical, pure reg rotation (98.11)
|
||||
Normalized diff = 5 symbol-name artifacts only; raw diff = whole-fn callee-web
|
||||
rotation (orig binds &locals to r25/r22/r23 webs, mine r24/r25/r27 + one web escapes
|
||||
to r18). Decl-order rotation inert (all 4 orders = 98.11); per-block start/valueLength
|
||||
locals regressed (94.09) — shared decls confirmed. Documented wall.
|
||||
|
||||
## Pass 5 (orchestrator resume — nup_nhttp gaps)
|
||||
|
||||
### NhttpOp/BufFull/HttpStringFlush structure check
|
||||
All 9 nup_nhttp fns implemented — complete_code 22.6% reflects 3 sub-100 fns' whole
|
||||
sizes, not missing code. Same for nup (53.4%).
|
||||
|
||||
### BufFull 96.44 -> 97.58
|
||||
done-block store order: `*length = 0; next = NULL;` (orig emits `li r0,0; li r30,0;
|
||||
stw r0` — separate zero materializations per use). Residual (3 blocks): cmplw
|
||||
operand order on `received + *length < received` (sum-temp/operand-swap inert),
|
||||
next==NULL alloc cold-block (`beq→alloc;b→merge` vs `bne` — goto/else forms inert),
|
||||
req>=0x8000 set-block same cold-block family. Documented wall.
|
||||
|
||||
### HttpStringFlush 96.88 — cold-block, all forms inert
|
||||
Orig `blt→growth;b→merge` out-of-line growth block. Tried: double-goto
|
||||
(`if(req<total) goto grow; goto alloc;`), single-goto-skip, empty-else — all
|
||||
normalize to in-line `bge`. Same wall as BufFull alloc block.
|
||||
|
||||
### NhttpOp 98.79 — single `li r29,0` placement
|
||||
Orig rematerializes the `*colon=0`/`*end=0` store-zero fresh after memcpy
|
||||
(web-split); mine shares headerCopy's NULL web. `'\0'` literal + late-init
|
||||
headerCopy inert — allocator-internal. Documented tie.
|
||||
|
||||
## Pass 6 — md5 ProcessBlock 74.14 -> 81.68/81.71
|
||||
|
||||
Two decodes landed:
|
||||
- `_k = *constant` as a separate temp BEFORE the lwbrx pair (orig emits `lwz const`
|
||||
first, then the two word loads — a distinct constant web vs folding `*constant`
|
||||
into the _wc expression). 74.14 -> 80.86.
|
||||
- `_p` pointer capture inside STEP + post-increment args at call sites
|
||||
(`STEP(..., word++, 7)` and `STEP(..., block + *index++, 5)`). The `word++`
|
||||
evaluates once into `_p`, so both lwbrx see the same address while the pointer
|
||||
walks in place — reproduces orig's `addi r4,r4,4` per-step in-place walk
|
||||
(vs MWCC's `base+offset` temps from `++word` statements). `wptr` local deleted.
|
||||
index++ likewise folds to orig's stride-16/offset form. -> 81.68.
|
||||
- `(_wc + (a))` operand order -> 81.71.
|
||||
|
||||
Rejected: `++(word)` inside shared macro tail (no-op; semantically wrong for
|
||||
rounds 2-4 anyway), `word[i]` args (type error), xw-before-k decl order (74.13),
|
||||
(a)+=(f) before loads (buildfix attempt broke), shift-assoc `((_xw + _k) + a)` (79.5).
|
||||
|
||||
Residual (32 diff blocks): pure scheduler micro-order — orig prefetches
|
||||
next-step `lwz const`/`lwz idx`/`lwbrx` into the current step's tail; insn count
|
||||
306 = 306. Documented pipelining wall.
|
||||
|
||||
## Pass 6b — hmac globals + remaining wall checks
|
||||
|
||||
### hmac .sdata STB_GLOBAL decode
|
||||
Orig emits `lbl_81697AB0` (7B "hmac.c") + `lbl_81697AB8` (2B "\n") as STB_GLOBAL
|
||||
.sdata objects — real file-scope non-static char arrays in the original source.
|
||||
Decoded as `char hmac_file_name[]` + `char hmac_newline[]`; call sites updated.
|
||||
Codegen unchanged (93.36) — remaining Init diffs are (a) pool/work callee-web
|
||||
swap (r29/r31 rotation family), (b) `i` counter binding r4-vs-r3 in the unrolled
|
||||
xor loop. Levers tried: ptr-idx/ptr-walk loop forms (84-87, regress), int-i
|
||||
(77, regress — wrong cmp type), decl-swap (no-op).
|
||||
|
||||
### Base64Encode 86.54 — parked
|
||||
count→r7-vs-r10 binding + `li` placement among stores + `lbzx` scheduling.
|
||||
declswap/reset-late/count-=3/!=3 all no-op or regress. 63=63 insns otherwise.
|
||||
|
||||
### SOGetSockName 96.67 — parked
|
||||
Single `mr r3,r28` marshal-order placement diff (r3 arg last vs first).
|
||||
63=63 insns, reply-web identical. Scheduler-internal.
|
||||
Reference in New Issue
Block a user