Partager via


Kernel-Mode Drivers (Compact 7)

3/12/2014

Windows Embedded Compact 7 runs device drivers in kernel mode, by default. Kernel-mode drivers have direct access to user memory buffers; therefore, kernel-mode drivers incur less overhead than user-mode drivers in moving data to and from the device. User-mode drivers require additional resource overhead for marshaling user data across process boundaries. For more information about data marshaling, see Marshal Data Between Memory Buffers.

Because kernel-mode drivers have direct access to both kernel memory and user memory, a low-quality kernel-mode driver can result in overall system instability. Therefore, kernel-mode drivers must be robust. A kernel-mode driver error can cause a kernel error, which results in system failure. If you are developing a kernel-mode driver, you must check and handle all inputs to driver functions carefully, and you must assume that these inputs come from untrusted sources.

When to Create a Kernel-Mode Driver

The kernel-mode driver model is a good choice for a new device driver implementation if any one of the following is true:

  • Your device driver is a network driver, a file system driver, or it interfaces with the GWES. These subsystems only work with kernel-mode device drivers.
  • Your device driver is a native driver. Only stream drivers can run in user-mode.
  • The efficiency of your device driver is more important than possible system instability due to a driver error.
  • You require access to internal kernel structures or kernel APIs in order to control your device.
  • You require direct, synchronous access to user memory buffers.

For More Information About Kernel-Mode Drivers

To learn more about kernel-mode drivers, see the Windows Embedded Compact 7 topics described in the following table.

Topic Description

Ceddk.dll

Describes functions that are used by drivers for handling bus address translations, allocating and mapping device memory, setting up direct memory access (DMA) buffers, and performing I/O operations.

Kernel Functions

Describes functions for allocating physical memory, mapping between virtual and physical memory addresses, forwarding device I/O controls, interrupt handler registration, and interrupt masking.

See Also

Concepts

Kernel-Mode and User-Mode Drivers