decomp(so): match SOGetSockName and link SOBasic (grok-so) #1240

Merged
coah80 merged 1 commits from agent/w0929/grok-so-land into main 2026-10-06 18:27:09 +00:00
4 changed files with 37 additions and 3 deletions

View File

@@ -11,6 +11,9 @@ splits: 'config/43U/splits.txt'
ldscript_template: 'config/ldscript_ipl2.lcf'
force_active:
- SORead
- SOFcntl
- SOInetPtoN
- SOGetSockOpt
- SOSetInterfaceOpt
- fprintf

View File

@@ -1096,7 +1096,7 @@ config.libs = [
),
RevoEXLib("so", [
Object(Matching, "so/SOCommon.c"),
Object(NonMatching, "so/SOBasic.c"),
Object(Matching, "so/SOBasic.c"),
Object(Matching, "so/SOInformation.c"),
Object(Matching, "so/SOOption.c"),
]

View File

@@ -150,8 +150,8 @@ int SOGetSockName(int socket, void* address) {
if(!request) result=-49;
else {
request->socket=socket;
reply=&request->address;
memcpy(reply,addr,addr->len);
reply=(SOSockAddr*)(((u8*)request)+32);
memcpy(((u8*)request)+32,addr,addr->len);
result=IOS_Ioctl(rm,7,request,4,reply,addr->len);
if(result>=0) memcpy(addr,reply,reply->len);
SOiFree(12,request,size);

View File

@@ -0,0 +1,31 @@
# grok-so SOGetSockName
baseline differing: 3 / 63
only first memcpy arg order: ours mr r3,r28 / mr r4,r27 / lbz r5; target mr r4 / lbz r5 / mr r3
len local after reply: 3 / 63
source local then len local: 3 / 63
len local then source local: 3 / 63
memcpy source is the void* parameter: 5 / 63 (also swaps the entry saves)
source and length both from the void* parameter: 5 / 63
reply assigned before socket store: 3 / 63
memcpy dest &request->address, reply assigned after: 6 / 63
memcpy dest &request->address, reply assigned before: 3 / 63
reply assigned inside the dest argument: 3 / 63
length ((u8*)addr)[0]: 3 / 63
length *(u8*)addr: 3 / 63
dest cast to void*: 3 / 63
length cast to unsigned long: 3 / 63
const source local: 3 / 63
u8* dest local: 14 / 63
reply = (SOSockAddr*)((u8*)request+32), memcpy from reply: 3 / 63
reply and memcpy dest both (u8*)request+32: 0 / 63
len local before reply: 3 / 63
len local before socket store: 3 / 63, register shift
socketBlock+32, sizeof, and [32]: 3 / 63
u8* raw local plus 32: 3 / 63
reply and memcpy dest both ((u8*)request)+32: 0 / 63, style check clean, all 22 functions 0
kept ((u8*)request)+32. Field address schedules the destination move first; the byte offset schedules it last.
Linking stripped SORead, SOFcntl and SOInetPtoN (nothing live calls them) and shifted the DOL by 660 code bytes. config/43U/config.yml force_active keeps them, same as SOGetSockOpt. DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d.