Type Checking

With each descriptor, there is a type field which is used to distinguish between the different descriptor formats. This field also specifies the intended use of a segment. For example, the allowable types for data segments are:

  • Read-Only
  • Read/Write

    and for code segments:

  • Execute-Only
  • Execute/Read.

    The type field, therefore, ensures that segments are only used in ways for which they are intended. For example:

  • The code segment (CS) register may only be loaded with the selector of an executable segment.

  • Selectors of executable segments that are not defined as readable cannot be loaded into a data segment (DS, ES, FS, and GS) registers.

  • No instruction may write into an executable segment.

  • No instruction may write into a data segment unless that segment is defined as Read/Write.

  • No instruction may read an executable segment unless that segment is defined as Execute/Read.

    So far this discussion applies to segment level checking. When paging is enabled, there is also checking done at the page level. Pages may be of two types:

  • Read-only access

  • Read/write access.

    Segment protection is evaluated first, then page protection is checked. It is possible to have a large segment which is both readable and writable and to have pages within it which are only readable. At the page level, the execute-only attribute does not exist.


    [Back: Protection]
    [Next: Limit Checking]