The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/i386/include/segments.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1989, 1990 William F. Jolitz
    3  * Copyright (c) 1990 The Regents of the University of California.
    4  * All rights reserved.
    5  *
    6  * This code is derived from software contributed to Berkeley by
    7  * William Jolitz.
    8  *
    9  * Redistribution and use in source and binary forms, with or without
   10  * modification, are permitted provided that the following conditions
   11  * are met:
   12  * 1. Redistributions of source code must retain the above copyright
   13  *    notice, this list of conditions and the following disclaimer.
   14  * 2. Redistributions in binary form must reproduce the above copyright
   15  *    notice, this list of conditions and the following disclaimer in the
   16  *    documentation and/or other materials provided with the distribution.
   17  * 4. Neither the name of the University nor the names of its contributors
   18  *    may be used to endorse or promote products derived from this software
   19  *    without specific prior written permission.
   20  *
   21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   31  * SUCH DAMAGE.
   32  *
   33  *      from: @(#)segments.h    7.1 (Berkeley) 5/9/91
   34  * $FreeBSD: releng/10.3/sys/i386/include/segments.h 233203 2012-03-19 21:24:50Z tijl $
   35  */
   36 
   37 #ifndef _MACHINE_SEGMENTS_H_
   38 #define _MACHINE_SEGMENTS_H_
   39 
   40 /*
   41  * 386 Segmentation Data Structures and definitions
   42  *      William F. Jolitz (william@ernie.berkeley.edu) 6/20/1989
   43  */
   44 
   45 #include <x86/segments.h>
   46 
   47 /*
   48  * Software definitions are in this convenient format,
   49  * which are translated into inconvenient segment descriptors
   50  * when needed to be used by the 386 hardware
   51  */
   52 
   53 struct  soft_segment_descriptor {
   54         unsigned ssd_base ;             /* segment base address  */
   55         unsigned ssd_limit ;            /* segment extent */
   56         unsigned ssd_type:5 ;           /* segment type */
   57         unsigned ssd_dpl:2 ;            /* segment descriptor priority level */
   58         unsigned ssd_p:1 ;              /* segment descriptor present */
   59         unsigned ssd_xx:4 ;             /* unused */
   60         unsigned ssd_xx1:2 ;            /* unused */
   61         unsigned ssd_def32:1 ;          /* default 32 vs 16 bit size */
   62         unsigned ssd_gran:1 ;           /* limit granularity (byte/page units)*/
   63 };
   64 
   65 /*
   66  * region descriptors, used to load gdt/idt tables before segments yet exist.
   67  */
   68 struct region_descriptor {
   69         unsigned rd_limit:16;           /* segment extent */
   70         unsigned rd_base:32 __packed;   /* base address  */
   71 };
   72 
   73 /*
   74  * Segment Protection Exception code bits
   75  */
   76 
   77 #define SEGEX_EXT       0x01    /* recursive or externally induced */
   78 #define SEGEX_IDT       0x02    /* interrupt descriptor table */
   79 #define SEGEX_TI        0x04    /* local descriptor table */
   80                                 /* other bits are affected descriptor index */
   81 #define SEGEX_IDX(s)    (((s)>>3)&0x1fff)
   82 
   83 #ifdef _KERNEL
   84 extern int      _default_ldt;
   85 #ifdef XEN
   86 extern struct proc_ldt default_proc_ldt;
   87 extern union descriptor *gdt;
   88 extern union descriptor *ldt;
   89 #else
   90 extern union descriptor gdt[];
   91 extern union descriptor ldt[NLDT];
   92 #endif
   93 extern struct soft_segment_descriptor gdt_segs[];
   94 extern struct gate_descriptor *idt;
   95 extern struct region_descriptor r_gdt, r_idt;
   96 
   97 void    lgdt(struct region_descriptor *rdp);
   98 void    sdtossd(struct segment_descriptor *sdp,
   99             struct soft_segment_descriptor *ssdp);
  100 void    ssdtosd(struct soft_segment_descriptor *ssdp,
  101             struct segment_descriptor *sdp);
  102 #endif /* _KERNEL */
  103 
  104 #endif /* !_MACHINE_SEGMENTS_H_ */

Cache object: 885d0debd2a0f5aa8413b5912bda74bd


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.