Add dosbox.conf option to enable logging every XMS call to move/copy memory for debug purposes

This commit is contained in:
Jonathan Campbell
2025-09-02 01:03:18 -07:00
parent 92f306098c
commit bf24d53974
2 changed files with 10 additions and 1 deletions

View File

@@ -4502,6 +4502,9 @@ void DOSBOX_SetupConfigSections(void) {
"This can help with any program with startup code that assumes the segment wraparound of the 8086.\n"
"Depending on DOS configuration the A20 gate may be re-enabled later such as calling INT 21h.");
Pbool = secprop->Add_bool("xms log memmove",Property::Changeable::WhenIdle,false);
Pbool->Set_help("If set, XMS move/copy operations are logged for debugging purposes.");
Pbool = secprop->Add_bool("xms memmove causes flat real mode",Property::Changeable::WhenIdle,true);
Pbool->Set_help("If set, any call to XMS to move/copy memory sets up flat real mode for segment registers DS and ES.");

View File

@@ -97,6 +97,7 @@ bool xms_hma_alloc_non_dos_kernel_control = true;
bool xms_memmove_flatrealmode = false;
bool xms_init_flatrealmode = false;
bool xms_debug_log_memmove = false;
struct XMS_Block {
Bitu size;
@@ -306,7 +307,10 @@ Bitu XMS_MoveMemory(PhysPt bpt) {
* extend past the end of the 8086-accessible conventional memory area. */
if ((destpt+length) > 0x10FFF0u) return XMS_INVALID_LENGTH;
}
// LOG_MSG("XMS move src %X dest %X length %X",srcpt,destpt,length);
if (xms_debug_log_memmove) {
LOG_MSG("XMS move src %X dest %X length %X",(unsigned int)srcpt,(unsigned int)destpt,(unsigned int)length);
}
/* we must enable the A20 gate during this copy.
* DOSBox-X masks the A20 line and this will only cause corruption otherwise. */
@@ -733,11 +737,13 @@ public:
xms_global_enable = false;
xms_local_enable_count = 0;
xms_debug_log_memmove = false;
xms_memmove_flatrealmode = false;
xms_init_flatrealmode = false;
if (!section->Get_bool("xms")) return;
xms_debug_log_memmove = section->Get_bool("xms log memmove");
xms_memmove_flatrealmode = section->Get_bool("xms memmove causes flat real mode");
xms_init_flatrealmode = section->Get_bool("xms init causes flat real mode");