MS-DOS: Doesn't take CS segment into account
rfalke opened this issue · comments
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';
This will have to be rolled into the scannerv2
effort.