Fixing Code and Data Segments

Any code segments or data segments a driver accesses at interrupt-time must be fixed segments. For best overall system performance, you should minimize the amount of code and data in fixed segments. To minimize the amount of fixed code, isolate all interrupt-time code in a few source modules and put this code into a single fixed code segment. Unless your driver has a large amount of data not accessed at interrupt time, use a single fixed data segment.

For example, the Sound Blaster sample driver is a medium-model DLL, using a single data segment and multiple code segments. This example fixes the data segment and the code segments named _TEXT and WEP_TEXT. All other code segments are moveable. The code segment _TEXT is used as a safety measure. The compiler places code for which you do not specify a segment in the _TEXT segment. This way, any code that is missed will be placed into a fixed segment, preventing possible problems at interrupt time. However, you should check your segmentation to ensure that only code that is required to be FIXED goes into the FIXED code segment.