Initialization and VDM Creation

Initialization of the DOS Emulation component is divided into two stages. The first occurs during OS/2 system initialization. The second stage occurs during creation of each virtual DOS machine.

OS/2 Initialization

DOS Emulation is involved in OS/2 system initialization because it requires access to information contained in CONFIG.SYS. As the OS/2 initialization procedure processes the CONFIG.SYS file, it records parameters relevant to DOS Emulation. These parameters include those specified in the FCBS and RMSIZE statements, and any DEVICE statements which specify DOS device drivers. These parameters become the default DOS settings for all VDMs.

Note: Virtual device drivers are not loaded or initialized at this stage. Initialization of DOS settings occurs prior to loading virtual device drivers, since these default settings may be required by the device drivers during VDM initialization (creation).

VDM Creation Stage

Upon creation of a VDM, the Virtual DOS Machine Manager calls the creation-time initialization routines for virtual device drivers and then passes control to the DOS Emulation kernel. At this point, the V86 memory organization appears as shown in Figure "V86 Memory Map Prior to DOS Emulation Initialization".

During VDM creation, DOS Emulation performs the following steps:

  • Initialize VDM-Related Kernel Structures

    Certain structures in the OS/2 Version 2.0 kernel are initialized in preparation for processing VDM requests. The System File Table (SFT) structures, for example, which are used for FCB I/O, are allocated and initialized.

  • Load DOS Emulation Kernel (DOSKRNL.COM)

    The portion of the DOS Emulation kernel which runs in V86 virtual memory is loaded at the high end of the VDM memory address space.

  • Start Virtual Processor Mode

    The protected mode initialization routine returns control to the Virtual DOS Machine Manager, which then invokes the initialization code within the V86 mode DOS Emulation kernel. This represents the first transition to V86 mode; at this point, memory is organized as in Figure "V86 Memory Map at Initial V86 Mode Entry".

  • Open Standard Devices

    The initial five file handles (stdin, stdout, stderr, stdaux, and stdprn) are opened.

  • Initialize Virtual Device Driver DOS Device Driver "stubs"

    Some virtual device drivers provide a DOS device driver "stub"; these stubs are inserted into the V86 address space prior to initialization of DOS Emulation. As such, this step involves calling the inserted initialization code and linking the devices into the device chain. Unlike real DOS device drivers, however, the return from the initialization does not allow reducing the size of the driver code. See Device Drivers for further information.

  • Initialize DOS Device Drivers

    Each DOS device driver specified in the CONFIG.SYS file is loaded into the VDM and initialized. Any VDM-specific DOS device drivers passed in the DosCreateProcess() function call, or configured via the DOS Settings option DOS Device Drivers, are then loaded and initialized. This is performed one device driver at a time to allow the device drivers to consume only the memory that they require or to de-install themselves entirely. As each device is initialized, it is added to the chain of devices in the VDM.

    During initialization, device drivers may issue a limited set of INT 21h system calls (functions 01h through 0Ch, 25h, 30h, and 35h). This restores functionality that had been removed from previous versions of OS/2.

    Note: The result is undefined when a DOS device driver issues an INT 21h system call other than those mentioned above. This is consistent and compatible with DOS. Issuing an unsupported INT 21h system call will crash the VDM.

    After all device drivers have been initialized, the initialization code is discarded.

  • Load and Execute DOS Shell

    The shell specified in the SHELL command in CONFIG.SYS is loaded, the initialization code in the V86 address space is discarded, and control is passed to the shell program. The SHELL specified in CONFIG.SYS can be overridden in the DosCreateProcess() function call. This is a useful feature if, for example, a software developer wishes to allow different versions of COMMAND.COM, for such reasons as alternative national language support.

    Upon invocation of the shell program, the VDM's memory map is organized as shown in Figure "V86 Memory Map after Initialization".

    Before passing control, the Program Descriptor Block (PDB) of the shell is initialized with the command line parameters as specified in CONFIG.SYS. As an extension to the native DOS environment, an additional string is appended after these parameters, separated from the command line string by a NULL byte. This string specifies the drive and directory of the virtual DOS environment after the shell completes its initialization. This extension provides a default working drive and directory for real mode applications, as is provided for protect mode applications using the Presentation Manager.


    [Back: DOS Emulation Implementation]
    [Next: Requesting System Services]