File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -37,13 +37,22 @@ void initialize() {
37
37
(*_ctors[i])();
38
38
39
39
// Set OSDynLoad_Acquire and OSDynLoad_FindExport
40
- OS_SPECIFICS-> addr_OSDynLoad_Acquire = ( u32 )(BLOSDynLoad_Acquire & 0x03FFFFFC );
41
- OS_SPECIFICS-> addr_OSDynLoad_FindExport = ( u32 )(BOSDynLoad_FindExport & 0x03FFFFFC ) ;
40
+ $( uintptr_t )( const u32 * instr)(
41
+ uintptr_t ret = *instr & 0x03FFFFFCU ;
42
42
43
- if (!(BLOSDynLoad_Acquire & 2 ))
44
- OS_SPECIFICS->addr_OSDynLoad_Acquire += (u32 )&BLOSDynLoad_Acquire;
45
- if (!(BOSDynLoad_FindExport & 2 ))
46
- OS_SPECIFICS->addr_OSDynLoad_FindExport += (u32 )&BOSDynLoad_FindExport;
43
+ if (!(*instr & 2 )) {
44
+ // sign extend offset
45
+ if (ret & 0x02000000U )
46
+ ret |= 0xFE000000U ;
47
+
48
+ // make relative
49
+ ret += (uintptr_t )instr;
50
+ }
51
+
52
+ return ret;
53
+ ) extractAddrFromInstr;
54
+ OS_SPECIFICS->addr_OSDynLoad_Acquire = extractAddrFromInstr (&BLOSDynLoad_Acquire);
55
+ OS_SPECIFICS->addr_OSDynLoad_FindExport = extractAddrFromInstr (&BOSDynLoad_FindExport);
47
56
48
57
// Init RPL libraries
49
58
InitOSFunctionPointers ();
You can’t perform that action at this time.
0 commit comments