I'm reverse engineering some ColdFire MCF5206 (68K-like) code that makes heavy use of function pointers, e.g.:
000006e0 46 fc 27 00 move #0x2700,SR
000006e4 4f ef ff f0 lea (-0x10,SP),SP
000006e8 48 d7 03 03 movem.l { D0 D1 A0 A1},(SP=>local_10)
000006ec 70 03 moveq #0x3,D0
000006ee 13 c0 20 00 01 11 move.b D0b,(SIM.TIMER[0].TER).l
000006f4 52 b9 01 00 01 5c addq.l #0x1,(g_timer1_val).l
000006fa 20 79 01 00 01 50 movea.l (g_timer1_fn2).l,A0
00000700 4e 90 jsr (A0)
00000702 20 79 01 00 01 4c movea.l (g_timer1_fn1).l,A0
00000708 4e 90 jsr (A0)
0000070a 4c d7 03 03 movem.l (SP=>local_10),{ D0 D1 A0 A1}
0000070e 4f ef 00 10 lea (0x10,SP),SP
00000712 4e 73 rte
However the decompiled code gives this output:
void vec_irq_l5(void)
{
SIM.TIMER[0].TER = 3;
g_timer1_val = g_timer1_val + 1;
(*g_timer1_fn2)(g_timer1_fn2,3);
(*g_timer1_fn1)(g_timer1_fn1);
return;
}
i.e. it is assuming that register A0 is always passed first, and in the first function call it has also assumed that D0 (value 3) is being passed. In reality the two indirect functions are of type void (fn*)(void)
.
Can I tell Ghidra not to do this, and to only consider stack parameters for these indirect calls?