beardypig/ghidra-emotionengine

decompilation: pushing to the stack in function prologue is wonky

beardypig opened this issue · 1 comments

Function prologue is decompiled as

  undefined unaff_s0_qw [16];
  int iVar2;
  undefined8 in_ra;
  
  iVar2 = (int)register0x000001d0;
  _iVar2 = (void **)(longlong)(int)(undefined8 *)(iVar2 + -0x30);
  *(undefined8 *)(iVar2 + -0x10) = in_ra;
                    /* WARNING: Store size is inaccurate */
  *(undefined *)(iVar2 + -0x20) = unaff_s0_qw;

from the following dissasembly

addiu sp,sp,-0x30
sd   ra,0x20(sp)
sq   s0,0x10(sp)

The function epilogue is fine.

Fixed in 81a4ac0.

The <stackpointer /> register has to be set to the same size representation as the memory address space. In this case sp_lo had to be used as the memory space is 32-bit and the sp register is the 64-bit representation.