43 static u32 lmb_patch[32] ALIGNED(64) = {
68 0x00000000, 0x00000000,
69 0x7962424c, 0x00004545,
70 0x00000000, 0x00000000, 0x00000000, 0x00000000
76 void *pStartModule, *pLoadModuleBuffer, *patch_addr, *lf_rpc_dispatch;
86 pStartModule = modload_lib->exports[8];
87 pLoadModuleBuffer = modload_lib->exports[10];
109 if(loadfile_info.text_size < 0x4c4 + 128)
112 lf_rpc_dispatch = (
void *)(loadfile_info.text_start + 0x4c4);
114 if(SifRpcGetOtherData(&RData, (
void*)lf_rpc_dispatch, &
smem_buf, 128, 0)>=0){
116 if(data[0]==0x27bdffe8 && data[1]==0x2c820006 && data[2]==0x14400003 && data[3]==0xafbf0010 && data[5]==0x00001021 && data[6]==0x00041080){
117 void *lf_jump_table_end, *lf_fno_check;
118 unsigned short int JumpTableOffset_hi, JumpTableOffset_lo;
120 lf_fno_check = (
void*)((u8 *)lf_rpc_dispatch+4);
123 JumpTableOffset_hi=*(
unsigned short int*)&data[7];
124 JumpTableOffset_lo=*(
unsigned short int*)&data[9];
126 lf_jump_table_end = (
void*)((JumpTableOffset_hi<<16) + (
short int)JumpTableOffset_lo + 0x18);
130 if ((patch_addr = SifAllocIopHeap(
sizeof lmb_patch)) == NULL)
134 result = (u32)patch_addr + 96;
135 lmb_patch[5] = JAL((u32)pLoadModuleBuffer);
136 lmb_patch[7] = HI16(result);
137 lmb_patch[9] = LO16(result);
138 lmb_patch[15] = JAL((u32)pStartModule);
140 SyncDCache(lmb_patch, (
void *)(lmb_patch + 24));
143 dmat.size=
sizeof(lmb_patch);
144 dmat.dest=patch_addr;
152 smem_write_word(lf_jump_table_end, (u32)patch_addr);
153 smem_write_word(lf_fno_check, 0x2C820007);