Segments


Segments are individual chunks of continuous address space, generally with separate characteristics (such as belonging to a particular file). Each segment structure ( struct seg ) contains a base address and a size , links to other segments that belong to the same process, and a pointer to a list of functions. This list, defined in the seg_ops structure, contains addresses of functions that perform a certain set of operations specifically for the given type of segment. These operations include things like:

  • Unmapping a portion of a segment

  • Removing an entire segment and any hardware mappings for the pages

  • Handling a page fault that occurs inside this segment

  • Performing a sync

  • Returning a pointer to the vnode that is associated with this segment

Some actual functions for the different segment types are:

  • segvn_unmap() ” Do an unmap operation on a seg_vn type of segment. A seg_vn is one that refers to a file (a vnode). A memory-mapped file would be a seg_vn type.

  • segdev_free() ” Free a segment that referred to a device. A frame buffer would be handled as a seg_dev type of segment.

There are also some generic segment handling functions that deal with the segment structures themselves .

  • seg_alloc() ” Allocate a segment for the specified address range and attach it to the list of segments for a particular address space structure.

  • seg_attach() ” Insert a segment structure into a list of segments. Called by seg_alloc() to actually do the work.

  • seg_unmap() ” Is a front end to the segment-specific unmap operation.

  • seg_free() ” Remove a segment structure from the list and actually free up the structure. This function also calls the segment type-specific free function to take care of releasing any resources used by the segment.

Segments are another "virtual" layer, like vnodes, to allow a range of addresses to refer to many different things (a file, a device like a frame buffer, anonymous memory) but still be handled at a high level in a standardized way.



PANIC. UNIX System Crash Dump Analysis Handbook
PANIC! UNIX System Crash Dump Analysis Handbook (Bk/CD-ROM)
ISBN: 0131493868
EAN: 2147483647
Year: 1994
Pages: 289
Authors: Chris Drake

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net