[NTVDM]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Wed, 23 Sep 2015 01:45:18 +0000 (01:45 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Wed, 23 Sep 2015 01:45:18 +0000 (01:45 +0000)
- Do not hardcode the number of XMS memory blocks that can map the HMA. It should be function of the MAX_ADDRESS value of our emulator.
- Require that MAX_ADDRESS should be greater or equal than 1 MB.

svn path=/trunk/; revision=69323

reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/himem.h
reactos/subsystems/mvdm/ntvdm/emulator.h

index eadd7d4..0976ce3 100644 (file)
@@ -13,8 +13,8 @@
 /* DEFINITIONS ****************************************************************/
 
 #define XMS_ADDRESS     0x110000        // Just above HMA
-#define XMS_BLOCKS      0x3BC0          // XMS_ADDRESS + (XMS_BLOCKS * XMS_BLOCK_SIZE) == 16 MB
 #define XMS_BLOCK_SIZE  1024
+#define XMS_BLOCKS      ((MAX_ADDRESS - XMS_ADDRESS) / XMS_BLOCK_SIZE)
 #define XMS_MAX_HANDLES 16              // Specification: min 1, max 128, default 32
 
 #define XMS_STATUS_SUCCESS              0x00
index 56ee697..2b2a56c 100644 (file)
@@ -23,6 +23,7 @@
 #define MAX_SEGMENT 0xFFFF
 #define MAX_OFFSET  0xFFFF
 #define MAX_ADDRESS 0x1000000 // 16 MB of RAM; see also: kernel32/client/vdm.c!BaseGetVdmConfigInfo
+C_ASSERT(0x100000 <= MAX_ADDRESS);  // A minimum of 1 MB is required for PC emulation.
 
 #define SEG_OFF_TO_PTR(seg, off)    \
     (PVOID)((ULONG_PTR)BaseAddress + TO_LINEAR((seg), (off)))