You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@esaulenka After a lot of messing around, I found a way to emulate the banked registers. It needs a lot of work tho to improve the decopilation output, but now, it can accurately decompile the init function (Although messy) for an ECU that uses C167 (Daimler EGS52).
macro load_wgpr() {
local addr:2 = CP; # Take value of ContextPointer, treat it as an address
*[register]:2 (addr+0x00) = r0; # Load register values into the memory addresses needed
*[register]:2 (addr+0x02) = r1;
*[register]:2 (addr+0x04) = r2;
*[register]:2 (addr+0x06) = r3;
*[register]:2 (addr+0x08) = r4;
*[register]:2 (addr+0x0A) = r5;
*[register]:2 (addr+0x0C) = r6;
*[register]:2 (addr+0x0E) = r7;
*[register]:2 (addr+0x10) = r8;
*[register]:2 (addr+0x12) = r9;
*[register]:2 (addr+0x14) = r10;
*[register]:2 (addr+0x16) = r11;
*[register]:2 (addr+0x18) = r12;
*[register]:2 (addr+0x1A) = r13;
*[register]:2 (addr+0x1C) = r14;
*[register]:2 (addr+0x1E) = r15;
}
macro save_wgpr() {
local addr:2 = CP; # Take value of ContextPointer, treat it as an address
r0 = *[register]:2 (addr+0x00); # Save value from memory into register
r1 = *[register]:2 (addr+0x02);
r2 = *[register]:2 (addr+0x04);
r3 = *[register]:2 (addr+0x06);
r4 = *[register]:2 (addr+0x08);
r5 = *[register]:2 (addr+0x0A);
r6 = *[register]:2 (addr+0x0C);
r7 = *[register]:2 (addr+0x0E);
r8 = *[register]:2 (addr+0x10);
r9 = *[register]:2 (addr+0x12);
r10 = *[register]:2 (addr+0x14);
r11 = *[register]:2 (addr+0x16);
r12 = *[register]:2 (addr+0x18);
r13 = *[register]:2 (addr+0x1A);
r14 = *[register]:2 (addr+0x1C);
r15 = *[register]:2 (addr+0x1E);
}
usage on a function that requires Rw access:
# Rw n , #data3 08 n:0###
# Rw n , [Rw i +] 08 n:11ii
# Rw n , [Rw i ] 08 n:10ii
# Rw n , Rw m 00 nm
:add Rwn1215, op2_w is op0407=0x0 & Rwn1215 & op2_w & ExtDec {
load_wgpr();
add_w (Rwn1215, op2_w);
save_wgpr();
}
output:
Register check initialization process of EGS52:
Decompiler output now:
Decompiler output before:
The text was updated successfully, but these errors were encountered:
@esaulenka After a lot of messing around, I found a way to emulate the banked registers. It needs a lot of work tho to improve the decopilation output, but now, it can accurately decompile the init function (Although messy) for an ECU that uses C167 (Daimler EGS52).
usage on a function that requires Rw access:
output:
Register check initialization process of EGS52:
Decompiler output now:
Decompiler output before:
The text was updated successfully, but these errors were encountered: