Thanks to visit codestin.com
Credit goes to github.com

Skip to content

On lDOS (lMS-DOS) LH leads to "MCB chain corrupt, or MS-DOS incompatible system." #166

@ecm-pushbx

Description

@ecm-pushbx

The message "MCB chain corrupt, or MS-DOS incompatible system." is displayed on attempts to use LH on a recent lDOS kernel.

With this patch it works:

diff --git a/shell/loadhigh.c b/shell/loadhigh.c
index 81340ec..49d4c37 100644
--- a/shell/loadhigh.c
+++ b/shell/loadhigh.c
@@ -422,7 +422,7 @@ static int loadhigh_prepare(void)
 
   /* Set the UMB link and malloc strategy */
   dosSetUMBLinkState(1);
-  dosSetAllocStrategy(0);
+  dosSetAllocStrategy(0x80);
 
   if ((availBlock = malloc(256 * sizeof(*availBlock))) == 0)
     return err_out_of_memory;
@@ -462,8 +462,10 @@ static int loadhigh_prepare(void)
         /* Found a free memory block: allocate it */
         word bl = DosAlloc(mcb->mcb_size);
 
-        if (bl != FP_SEG(mcb) + 1)  /* Did we get the block we wanted? */
+        if (bl != FP_SEG(mcb) + 1)  /* Did we get the block we wanted? */ {
+          printf("bl = %04X, mcb = %04X\n", bl, FP_SEG(mcb));
           return err_mcb_chain;
+        }
 
         if (region->access)		/* /L option allows access to this region */
         {
@@ -540,6 +542,7 @@ static int loadfix_prepare(void)
 
       if (bl != FP_SEG(mcb) + 1)  /* Did we get the block we wanted? */
       	{
+          printf("bl = %04X, mcb = %04X\n", bl, FP_SEG(mcb));
         return err_mcb_chain;
         }
 

Without the line 422 hunk the debug message that I added to loadhigh_prepare (line 462 hunk) is displayed so that seems to be where the error code is generated.

I don't see how with a strategy of 0 ("LMA then UMA, as one area") the allocation should occur in the UMA first as this code expects. I will have to study the FreeDOS kernel to see whether it behaves differently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions