dosemu2 / fdpp

FreeDOS plus-plus, 64bit DOS
GNU General Public License v3.0
195 stars 17 forks source link

MFT memory report allocations inconsistent #180

Closed andrewbird closed 2 years ago

andrewbird commented 3 years ago

Since the FDPP kernel moved up in memory MFT(QEMM 7.5) has an inconsistent display of allocation. The region at issue is 0070.000 to 0084:0000.

Here it's allocated to DOS

dosoverview

Here it's not displayed but since the free range starts above it I think it's allocated

firstmegprograms

Here it's in the free block

firstmegoverview

stsp commented 3 years ago

I was suggesting to add initial MCB to loadfix. It does have the initial MCB already, but perhaps it also needs a device list to fix mem as well.

stsp commented 2 years ago

I moved the heap to 0x90. Does that fix this problem?

andrewbird commented 2 years ago

I'll recheck in a couple of days when I return home.

andrewbird commented 2 years ago

Here are the current screenshots from MFT (without loadfix) Screenshot_2021-11-15_11-35-05 Screenshot_2021-11-15_11-34-49 Screenshot_2021-11-15_11-34-34

Here's the result from DR-DOS 7.03 mem command (note I'm now using -td to be able to capture the output)

C:\>mem/a

┌─ Address ─┬─ Name ───┬─ Size ───────────┬─ Type ────────────────────────────┐
│    0:0000 │ -------- │  A0000h, 655,360 │ ------------- RAM --------------- │
├───────────┼──────────┼──────────────────┼───────────────────────────────────┤
│    0:0000 │ -------- │    400h,   1,024 │ Interrupt vectors                 │
│   40:0000 │ -------- │    100h,     256 │ ROM BIOS data area                │
│   50:0000 │      DOS │    200h,     512 │ DOS data area                     │
│   70:0000 │     BIOS │  FA460h,1,025,120 │ Device drivers                    │
│   90:0000 │      DOS │     A5h,     165 │  HANDLES=, FCBS=   3 total blocks │
│   9C:0000 │      MEM │    150h,     336 │ Environment                       │
│   B1:0000 │      MEM │  15C20h,  89,120 │ Program                           │
│ 1673:0000 │ -------- │  898C0h, 563,392 │ FREE                              │
│ 9FFF:0000 │      DOS │     10h,      16 │ System                            │
├───────────┼──────────┼──────────────────┼───────────────────────────────────┤
│ A000:0000 │ -------- │     B0h,     176 │ FREE                              │
│ A00B:0000 │  COMMAND │    E70h,   3,696 │ Data                              │
│ A0F2:0000 │  COMMAND │    190h,     400 │ Environment                       │
│ A10B:0000 │ -------- │   EF40h,  61,248 │ FREE                              │
│ AFFF:0000 │      DOS │  11010h,  69,648 │ System                            │
├───────────┼──────────┼──────────────────┼───────────────────────────────────┤
│ C000:0000 │ -------- │    200h,     512 │ ------------- ROM --------------- │
├───────────┼──────────┼──────────────────┼───────────────────────────────────┤
│ C100:0000 │      DOS │   21D0h,   8,656 │ System                            │
│ C102:0000 │ EMMXXXX0 │     90h,     144 │  DEVICE = installed device driver │
│ C10C:0000 │ EMUFS$   │     A0h,     160 │  DEVICE = installed device driver │
│ C117:0000 │ MSCD0001 │    310h,     784 │  DEVICE = installed device driver │
│ C149:0000 │      DOS │    9F6h,   2,550 │  HANDLES=, FCBS=  48 total blocks │
│ C31D:0000 │  COMMAND │   4110h,  16,656 │ Program                           │
│ C72E:0000 │ -------- │  18D10h, 101,648 │ FREE                              │
│ DFFF:0000 │      DOS │  10010h,  65,552 │ System                            │
├───────────┼──────────┼──────────────────┼───────────────────────────────────┤
│ E000:0000 │      EMS │  10000h,  65,536 │ ---------- EMS memory ----------- │
├───────────┼──────────┼──────────────────┼───────────────────────────────────┤
│ F000:0000 │ -------- │   A000h,  40,960 │ FREE                              │
│ FA40:0616 │ CON      │                  │  DEVICE = installed device driver │
│ FA40:0628 │ PRN      │                  │  DEVICE = installed device driver │
│ FA40:063A │ AUX      │                  │  DEVICE = installed device driver │
│ FA40:064C │ LPT1     │                  │  DEVICE = installed device driver │
│ FA40:065E │ LPT2     │                  │  DEVICE = installed device driver │
│ FA40:0670 │ LPT3     │                  │  DEVICE = installed device driver │
│ FA40:0682 │ COM1     │                  │  DEVICE = installed device driver │
│ FA40:0694 │ COM2     │                  │  DEVICE = installed device driver │
│ FA40:06A6 │ COM3     │                  │  DEVICE = installed device driver │
│ FA40:06B8 │ COM4     │                  │  DEVICE = installed device driver │
│ FA40:06CA │ CLOCK$   │                  │  DEVICE = installed device driver │
│ FA40:06DC │    A:-E: │                  │  DEVICE = installed device driver │
│ FAB6:0000 │      DOS │ FFF05E60h,4,293,942,880 │ System                            │
└───────────┴──────────┴──────────────────┴───────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────────────┐
│     │<─────────────────── Conventional memory ─────────────────────>     │
│     0h   10000h  20000h  30000h  40000h  50000h  60000h  70000h          │
│     0K      64K    128K    192K    256K    320K    384K    448K          │
│     ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────     │
│     ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓     │
│     ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓...............................████████▒▒▒▒▒▒▒▒▒     │
│     ┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼──────┤     │
│    512K    576K    640K    704K    768K    832K    896K    960K     1MB  │
│  80000h  90000h  A0000h  B0000h  C0000h  D0000h  E0000h  F0000h 100000h  │
│     >──────────────>│<────────────── Upper memory ────────────────>│     │
└──────────────────────────────────────────────────────────────────────────┘
Key:  ▓=RAM  ▒=ROM  ░=Shadow ROM  █=EMS

┌ Memory Type ──────┬── Total Bytes ( Kbytes  ) ─┬─── Available For Programs ─┐
│                   │                            │                            │
│ Conventional      │       655,360 (    640K )  │       652,848 (    638K )  │
│ Upper             │       368,640 (    360K )  │       204,032 (    199K )  │
│ High              │        65,520 (     64K )  │        52,079 (     51K )  │
│ Extended          │             0 (      0K )  │             0 (      0K )  │
│ Extended via XMS  │          --------          │     8,388,608 (  8,192K )  │
│ EMS               │     8,781,824 (  8,576K )  │     8,323,072 (  8,128K )  │
├───────────────────┴────────────────────────────┴────────────────────────────┤
│ Largest executable program:  652,832 ( 638K )                               │
│ Total Free DOS memory:       856,880 ( 837K )                               │
└─────────────────────────────────────────────────────────────────────────────┘

C:\>

And the output from dosdebug's mcbs

dosdebug> mcbs

ADDR(LOW) PARAS  OWNER
009c:0000 0x0014 [FREE]
00b1:0000 0x15c1 [FREE]
1673:0000 0x898b [FREE] (END)

ADDR(UMA) PARAS  OWNER
9fff:0000 ------ [LINK]
a000:0000 0x000a [FREE]
a00b:0000 0x00e6 [COMMAND - Data]
a0f2:0000 0x0018 [COMMAND - Environment]
a10b:0000 0x0ef3 [FREE]
afff:0000 ------ [LINK]
c100:0000 0x021c [DOS]
  => ADDR      PARAS TYPE USAGE
     c101:0000 0x0009 [D] Driver (EMS)
     c10b:0000 0x000a [D] Driver (EMUFS)
     c116:0000 0x0031 [D] Driver (CDROM)
     c148:0000 0x00b2 [F] Files
     c1fb:0000 0x008f [L] CDS Array
     c28b:0000 0x0080 [S] Stacks
     c30c:0000 0x0010 [B] Buffers
c31d:0000 0x0410 [COMMAND]
c72e:0000 0x18d0 [FREE]
dfff:0000 ------ [LINK]
f000:0000 0x09ff [FREE] (END)

I'm a little rusty on interpreting these results as it's been quite a while, but it looks okay to me except for a couple of large sizes in dr-dos 7.03 mem output. I think that's to be expected as dr-dos mem command was never intended to be run on a kernel other than its own.

stsp commented 2 years ago
009c:0000 0x0014 [FREE]
00b1:0000 0x15c1 [FREE]

And if you look into MFT output, it sometimes shows free memory from 9c (correct), and sometimes - from b1 (incorrect). Now why there are 2 UMBs - likely because you dumped them after exiting mft. I suppose mft itself was occupying 9c...b0, and was mistakenly displaying its own mem as busy.

andrewbird commented 2 years ago

There were two distinct runs here, the first using SDL for mft screenshots, the second using -td for mem and dosdebug.

stsp commented 2 years ago

OK, seems like this is a result of comcom32's relocating of its env. Anyway, looks good enough.

andrewbird commented 2 years ago

Cool, good stuff!