pub type EvOffsets = _evOffsets;hidsystem only.Expand description
SHARED MEMORY OVERVIEW
PERSPECTIVE The ev driver and PostScript share at least one page of wired memory. This memory contains the low-level event queue which ev deposits events into and PostScript reads events from. Also, this memory contains other important data such as wait cursor state and some general cursor state. This memory is critical for speed. That is, we avoid having to make system calls for common operations.
SHARED MEMORY REGIONS There are currently three “regions” or “zones” delineated within this shared memory. The first zone is the EvOffsets structure. This structure contains two offsets from the beginning of shared memory. The first offset is to the second zone, EvGlobals. The second offset is to the third zone, private shmem for drivers.
INITIALIZATION OF SHARED MEMORY When the WindowServer starts up, it finds all screens that will be active. It then opens the ev driver and calls the EVIOSSCR ioctl repeatedly for each screen in use. This lets the ev driver set up the evScreen array and fill in each element. This ioctl also returns to PostScript a running total shared memory size with which to allocate. PostScript then allocates a region of memory this size and calls evmmap to “map in” this shared region. Evmmap initializes and fills in the EvOffsets and EvGlobals. Next the WindowServer calls each screen in turn to register itself with the ev driver in the same sequence as presented to EVIOSSCR. Each screen driver calls ev_register_screen() which among other things allocates a part of the private shmem (of the third shared memory zone) for the driver.
DEBUGGING NOTES You can easily display and set this shared memory from kgdb, but usually cannot do so from within PostScript. Gdb (or some weird interaction between gdb and the os) chokes on this shmem. So if you read or write this area of memory, copy-on-write will occur and you’ll get a completely new page for PostScript. This will render the shared memory scheme useless and you will have to restart PostScript. It was my understanding that before, we were able to “read” this area from PS, but not write to it (the idea behind copy-on-WRITE). However, this seems to be broken in 2.0. We think this is a kernel bug.
See also Apple’s documentation
Aliased Type§
#[repr(C)]pub struct EvOffsets {
pub evGlobalsOffset: i32,
pub evShmemOffset: i32,
}Fields§
§evGlobalsOffset: i32§evShmemOffset: i32