Ghidra: Disassembly and Decompiler does not share equates

Created on 4 Apr 2019  路  2Comments  路  Source: NationalSecurityAgency/ghidra

Describe the bug
On the same code example I used in #304, I found that if I define some value in the disassembler, the decompiler will not use the equate value

To Reproduce

                             void __cdecl16near _display_control(uint flags)
                               assume DS = 0xec25
             void              <VOID>         <RETURN>
             uint              Stack[0x2]:2   flags
                             _display_control
       e000:a672 55              PUSH       BP
       e000:a673 8b ec           MOV        BP,SP
       e000:a675 8b 5e 04        MOV        BX,word ptr [BP + flags]
       e000:a678 b4 00           MOV        AH,DISPLAY_CONTROL
       e000:a67a cd 12           INT        INT_DISP
       e000:a67c 5d              POP        BP
       e000:a67d c3              RET

I'm replacing some value by #define value, like on the INT INT_DISP but the decompiler still show swi(0x12):

void __cdecl16near _display_control(uint flags)

{
  code *pcVar1;

  pcVar1 = (code *)swi(0x12);
  (*pcVar1)();
  return;
}

Expected behavior
Equate should be shared between both view

Screenshots
See above

Attachments
N/A

Environment (please complete the following information):

  • OS: Debian linux
  • Java Version: 11.0
  • Ghidra Version: 9.0

Additional context
N/A

Bug

Most helpful comment

Mapping of equates into the decompiler is broken for 16-bit x86 programs. This seems to be a side-effect of the segmented address space. Working on a patch.

All 2 comments

Mapping of equates into the decompiler is broken for 16-bit x86 programs. This seems to be a side-effect of the segmented address space. Working on a patch.

Fix in master

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tambry picture tambry  路  3Comments

forkoz picture forkoz  路  3Comments

Merculous picture Merculous  路  3Comments

pd0wm picture pd0wm  路  3Comments

CalcProgrammer1 picture CalcProgrammer1  路  3Comments