Memory Access

MS-DOS applications are written to use the x86 segmented memory architecture. They use pointers composed of a 16-bit segment or selector and a 16-bit offset into the segment. Windows NT, on the other hand, uses a flat memory model, in which pointers are simply 32-bit linear addresses. Because a VDD can receive a segmented address pointer from an MS-DOS application, Windows NT provides the function GetVDMPointer to translate MS-DOS segment:offset or selector:offset style pointers to 32-bit linear address pointers. The VDD can use the 32-bit pointer to access memory by using Win32 functions, such as VDDAllocMem.

Do not manually convert segmented addresses (by shifting the segment by four and adding the offset). On a non-x86 machine, the VDM might not be based at physical address zero. The GetVDMPointer function converts a segmented address to a 32-bit address in a platform-independent manner.

If the VDD is running on a RISC-based Windows NT machine, the x86 emulator precompiles instructions in memory to increase performance. When a VDD uses a pointer returned by GetVDMPointer to modify memory in a particular range, it is important to tell the emulator that a change has occurred so the emulator can recompile the instructions in that range. Calling FlushVDMPointer or FreeVDMPointer tells the emulator the memory is no longer subject to modification and the instructions in that range can be precompiled again. These functions simply return to the caller on an x86 machine.