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/globaldata.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) Peter Wemm <peter@netplex.com.au>
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  *
   26  * $FreeBSD$
   27  */
   28 
   29 /*
   30  * This structure maps out the global data that needs to be kept on a
   31  * per-cpu basis.  genassym uses this to generate offsets for the assembler
   32  * code, which also provides external symbols so that C can get at them as
   33  * though they were really globals.
   34  *
   35  * The SMP parts are setup in pmap.c and locore.s for the BSP, and
   36  * mp_machdep.c sets up the data for the AP's to "see" when they awake.
   37  * The reason for doing it via a struct is so that an array of pointers
   38  * to each CPU's data can be set up for things like "check curproc on all
   39  * other processors"
   40  */
   41 struct globaldata {
   42         struct proc     *curproc;
   43         struct proc     *npxproc;
   44         struct pcb      *curpcb;
   45         struct i386tss  common_tss;
   46         struct timeval  switchtime;
   47         int             switchticks;
   48 #ifdef VM86
   49         struct segment_descriptor common_tssd;
   50         u_int           private_tss;
   51         u_int           my_tr;          
   52 #endif
   53 #ifdef USER_LDT
   54         int             currentldt;
   55 #endif
   56 #ifdef SMP
   57         u_int           cpuid;
   58         u_int           cpu_lockid;
   59         u_int           other_cpus;
   60         pd_entry_t      *my_idlePTD;
   61         u_int           ss_eflags;
   62         pt_entry_t      *prv_CMAP1;
   63         pt_entry_t      *prv_CMAP2;
   64         pt_entry_t      *prv_CMAP3;
   65         pt_entry_t      *prv_PMAP1;
   66         int             inside_intr;
   67 #endif
   68 };
   69 
   70 #ifdef SMP
   71 /*
   72  * This is the upper (0xff800000) address space layout that is per-cpu.
   73  * It is setup in locore.s and pmap.c for the BSP and in mp_machdep.c for
   74  * each AP.  genassym helps export this to the assembler code.
   75  */
   76 struct privatespace {
   77         /* page 0 - data page */
   78         struct globaldata globaldata;
   79         char            __filler0[PAGE_SIZE - sizeof(struct globaldata)];
   80 
   81         /* page 1 - page table page */
   82         pt_entry_t      prvpt[NPTEPG];
   83 
   84         /* page 2 - local apic mapping */
   85         lapic_t         lapic;
   86         char            __filler1[PAGE_SIZE - sizeof(lapic_t)];
   87 
   88         /* page 3..2+UPAGES - idle stack (UPAGES pages) */
   89         char            idlestack[UPAGES * PAGE_SIZE];
   90 
   91         /* page 3+UPAGES..6+UPAGES - CPAGE1,CPAGE2,CPAGE3,PPAGE1 */
   92         char            CPAGE1[PAGE_SIZE];
   93         char            CPAGE2[PAGE_SIZE];
   94         char            CPAGE3[PAGE_SIZE];
   95         char            PPAGE1[PAGE_SIZE];
   96 
   97         /* page 7+UPAGES..15 - spare, unmapped */
   98         char            __filler2[(9-UPAGES) * PAGE_SIZE];
   99 
  100         /* page 16-31 - space for IO apics */
  101         char            ioapics[16 * PAGE_SIZE];
  102 
  103         /* page 32-47 - maybe other cpu's globaldata pages? */
  104 };
  105 #endif

Cache object: 43f0ecad929ebbe73763888a7683ee78


[ 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.