format cleanup for readability. Tab out back-slashes.
[dragonfly.git] / sys / sys / globaldata.h
1 /*-
2  * Copyright (c) Peter Wemm <peter@netplex.com.au> All rights reserved.
3  * Copyright (c) 2003 Matthew Dillon <dillon@backplane.net> 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: src/sys/i386/include/globaldata.h,v 1.11.2.1 2000/05/16 06:58:10 dillon Exp $
27  * $DragonFly: src/sys/sys/globaldata.h,v 1.1 2003/06/28 04:16:05 dillon Exp $
28  */
29
30 #ifndef _SYS_GLOBALDATA_H_
31 #define _SYS_GLOBALDATA_H_
32
33 /*
34  * This structure maps out the global data that needs to be kept on a
35  * per-cpu basis.  genassym uses this to generate offsets for the assembler
36  * code.  The machine-dependant portions of this file can be found in
37  * <machine/globaldata.h>, but only MD code should retrieve it.
38  *
39  * The SMP parts are setup in pmap.c and locore.s for the BSP, and
40  * mp_machdep.c sets up the data for the AP's to "see" when they awake.
41  * The reason for doing it via a struct is so that an array of pointers
42  * to each CPU's data can be set up for things like "check curproc on all
43  * other processors"
44  *
45  * NOTE! this structure needs to remain compatible between module accessors
46  * and the kernel, so we can't throw in lots of #ifdef's.
47  */
48
49 #ifndef _SYS_TIME_H_
50 #include <sys/time.h>   /* struct timeval */
51 #endif
52
53 struct privatespace;
54
55 struct globaldata {
56         struct privatespace *gd_prvspace;       /* self-reference */
57         struct thread   *gd_curthread;
58         struct thread   *gd_idletd;             /* a ilttle messy but it works */
59         int             gd_tdfreecount;         /* new thread cache */
60         int             gd_reqpri;              /* highest pri blocked thread */
61         TAILQ_HEAD(,thread) gd_tdfreeq;         /* new thread cache */
62         TAILQ_HEAD(,thread) gd_tdrunq;          /* runnable threads */
63         u_int           gd_cpuid;
64         struct timeval  gd_stattv;
65         int             gd_inside_intr;
66         int             gd_astpending;          /* sorta MD but easier here */
67         /* extended by <machine/pcpu.h> */
68 };
69
70 #endif