Many drivers share memory with other
components. For example:
·
Adjacent drivers in the same
stack might share memory mapped for their device.
·
A driver might create a worker
thread that uses context information or memory locations that are also accessed
elsewhere in the driver.
·
A driver might need to share a buffer
with a user-mode application.
In addition, any driver routines that are
reentrant or can run concurrently might share memory.
In all such situations, the driver must ensure
the integrity of the data by synchronizing access to the shared locations. The
most appropriate synchronization technique depends on how the memory is used
and which other components use it. For a complete description of the
synchronization techniques for kernel-mode components, see “Locks, Deadlocks,
and Synchronization,” which is listed in the Resources section at the end of
this paper.
In addition, some drivers must share
memory with user-mode components. User-mode components cannot allocate virtual
memory in the system address space. Although it is possible to map system-space
addresses into user space, drivers should avoid doing so for security reasons. Drivers
and user-mode components must use other strategies for sharing memory.
“Managing User-Mode Interactions:
Guidelines for Kernel-Mode Drivers” describes specific techniques for sharing
buffers and section objects with user-mode components. This paper is listed in
the Resources section at the end of this paper.
0 komentar:
Posting Komentar