2 * Copyright (c) Peter Wemm <peter@netplex.com.au>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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
26 * Only machine-dependant code should ever include this file. MI
27 * code and header files do NOT include this file. e.g. sys/globaldata.h
28 * should not include this file.
30 * $FreeBSD: src/sys/i386/include/globaldata.h,v 1.11.2.1 2000/05/16 06:58:10 dillon Exp $
31 * $DragonFly: src/sys/i386/include/Attic/globaldata.h,v 1.14 2003/06/29 03:28:43 dillon Exp $
34 #ifndef _MACHINE_GLOBALDATA_H_
35 #define _MACHINE_GLOBALDATA_H_
37 #ifndef _SYS_GLOBALDATA_H_
38 #include <sys/globaldata.h> /* struct globaldata */
40 #ifndef _SYS_THREAD_H_
41 #include <sys/thread.h> /* struct thread */
43 #ifndef _MACHINE_SEGMENTS_H_
44 #include <machine/segments.h> /* struct segment_descriptor */
46 #ifndef _MACHINE_TSS_H_
47 #include <machine/tss.h> /* struct i386tss */
51 * Note on interrupt control. Pending interrupts not yet dispatched are
52 * marked in gd_fpending or gd_ipending. Once dispatched an interrupt
53 * is marked in irunning and the fpending bit is cleared. For edge triggered
54 * interrupts interrupts may be enabled again at this point and if they
55 * occur before the interrupt service routine is complete the ipending bit
56 * will be set again and cause the interrupt service to loop. The current
57 * thread's cpl is stored in the thread structure.
61 struct thread gd_idlethread;
62 struct segment_descriptor gd_common_tssd;
63 struct segment_descriptor *gd_tss_gdt;
64 struct thread *gd_npxthread;
65 struct i386tss gd_common_tss;
66 int gd_fpending; /* fast interrupt pending */
67 int gd_ipending; /* normal interrupt pending */
68 int gd_irunning; /* normal interrupt in progress */
69 int gd_currentldt; /* USER_LDT */
84 * This is the upper (0xff800000) address space layout that is per-cpu.
85 * It is setup in locore.s and pmap.c for the BSP and in mp_machdep.c for
86 * each AP. genassym helps export this to the assembler code.
89 /* page 0 - data page */
90 struct mdglobaldata mdglobaldata;
91 char __filler0[PAGE_SIZE - sizeof(struct mdglobaldata)];
93 /* page 1..4 - CPAGE1,CPAGE2,CPAGE3,PPAGE1 */
94 char CPAGE1[PAGE_SIZE];
95 char CPAGE2[PAGE_SIZE];
96 char CPAGE3[PAGE_SIZE];
97 char PPAGE1[PAGE_SIZE];
99 /* page 5..4+UPAGES - idle stack (UPAGES pages) */
100 char idlestack[UPAGES * PAGE_SIZE];
103 extern struct privatespace CPU_prvspace[];
105 #define mdcpu ((struct mdglobaldata *)_get_mycpu())
106 #define npxthread mdcpu->gd_npxthread