Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MS-DOS: Doesn't take CS segment into account #1250

Open
rfalke opened this issue Mar 13, 2023 · 1 comment
Open

MS-DOS: Doesn't take CS segment into account #1250

rfalke opened this issue Mar 13, 2023 · 1 comment
Assignees
Labels
enhancement This is a feature request
Milestone

Comments

@rfalke
Copy link

rfalke commented Mar 13, 2023

Reko version: b3d6f88
Subject: https://github.com/rfalke/decompiler-subjects/tree/master/from_holdec/i386_16bit_segment/ia32_mz

The output function is called two times with a far call. The linear address is the same but the CS is different. The CS is used in the output function and outputs first 'a' and then 'q' ('a'+16).

Reko doesn't reflect this twist:

void fn0800_0000()
{
	fn0800_0017();
	fn0800_0017();
	msdos_terminate(0x00);
}

void fn0800_0017()
{
	msdos_direct_console_output(seg0800->b0021);
}

char g_b0021 = 'a'; // 0800:0021

I assume that there are multiple ways to model this (if it is supported at all):

  • (1) pass the CS (implicitly set in the far call) as an explicit parameter
    • (1a) only do this if there are more than one far call to this function
  • (2) duplicate the output function for each far call

Sample output for (2):

void fn0800_0000()
{
	fn0800_0017();
	fn0801_0007();
	msdos_terminate(0x00);
}

void fn0800_0017()
{
	msdos_direct_console_output(seg0800->b0021);
}

void fn0801_0007()
{
	msdos_direct_console_output(seg0801->b00??);
}

char g_b0021 = 'a'; // 0800:0021
char g_b00?? = 'q';
@uxmal uxmal self-assigned this Apr 18, 2023
@uxmal uxmal added the enhancement This is a feature request label Apr 18, 2023
@uxmal uxmal added this to the scannerv2 milestone Apr 18, 2023
@uxmal
Copy link
Owner

uxmal commented Apr 18, 2023

This will have to be rolled into the scannerv2 effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is a feature request
Projects
None yet
Development

No branches or pull requests

2 participants