#2632·ghidra

cdecl16far calling conventions incorrectly return 4-byte value

Author: neitriCreated Jan 8, 2021Updated Sep 14, 2026
LabelsFeature: Processor/x86Status: TriageFeature: cspec

Describe the bug I create functions with the calling convention _cdecl16far, which returns a 32 bit value (dword, long, char * 32) the result is declared as register AX: 2 (ntr) and the value on the stack. The code shows that the result is transmitted by registers DX: 2, AX: 2 If you select the calling agreement as cdecl16near, then the result is declared correctly DX: 2, AX: 2

To Reproduce Steps to reproduce the behavior:

  1. Open WIN16 exe file
  2. Select function, "Edit Function Signature"
  3. Calling Convention __cdecl16far
  4. Datatype char*32

Expected behavior Storage DX:2,AX:2

Screenshots

Attachments If applicable, please attach any files that caused problems or log files generated by the software.

Environment (please complete the following information):

  • OS: Windows 10 20H2
  • Java Version: 11.0.9.1
  • Ghidra Version: 9.2.1

Additional context Add any other context about the problem here.

Source: NationalSecurityAgency/ghidra