Virtual Device Segments

Virtual devices can have any combination of the following five segments:

Segment

Description

VxD_CODE

Specifies the protected-mode code segment. This required segment contains the device control procedure, callback procedures, services, and API procedures of the virtual device. Use the VxD_CODE_SEG and VxD_CODE_ENDS macros to define the start and end of definitions for this segment. This segment is also named _LTEXT.

VxD_DATA

Specifies the protected-mode data segment. This required segment contains the device descriptor block, service table, and any global data for the virtual device. Use the VxD_DATA_SEG and VxD_DATA_ENDS macros to define the start and end of definitions for this segment. This segment is also named _LDATA.

VxD_ICODE

Specifies the protected-mode initialization code segment. This optional segment usually contains the procedures and services that are used only during initialization of the virtual device. The VMM discards this segment after the Init_Complete message. Use the VxD_ICODE_SEG and VxD_ICODE_ENDS macros to define the start and end of definitions for this segment. This segment is also named _ITEXT.

VxD_IDATA

Specifies the protected-mode initialization data segment. This optional segment usually contains the data used by the initialization procedures and services. The VMM discards this segment after the Init_Complete message. Use the VxD_IDATA_SEG and VxD_IDATA_ENDS macros to define the start and end of definitions for this segment. This segment is also named _IDATA.

VxD_REAL_INIT

Specifies the real-mode initialization segment. This optional segment contains the real-mode initialization procedure and data. The VMM calls this procedure before loading the rest of the virtual device, then discards this segment after the procedure returns. Use the VxD_REAL_INIT_SEG and VxD_REAL_INIT_ENDS macros to define the start and end of definitions for the real-mode initialization segment. This segment is also named _RTEXT.


All code and data segments, except the real-mode initialization segment, are 32-bit, flat model, protected-mode segments. This means procedures and data defined in the protected-mode segments have 32-bit offsets. When the VMM loads the virtual device, it fixes all offsets according to the virtual device's actual position in memory. For this reason, the OFFSET32 macro should be used in the protected-mode segments wherever the OFFSET directive would ordinarily be used. The OFFSET32 macro defines offsets for which the linker produces correct offset-fixup information.

Virtual devices cannot change the CS, DS, ES, or SS segment registers. Virtual devices can use the FS and GS segment registers.