Deleted Added
full compact
pcpu.h (72930) pcpu.h (74912)
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 *
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: head/sys/amd64/include/pcpu.h 72930 2001-02-23 01:25:02Z peter $
26 * $FreeBSD: head/sys/amd64/include/pcpu.h 74912 2001-03-28 09:03:24Z jhb $
27 */
28
29#ifndef _MACHINE_GLOBALDATA_H_
30#define _MACHINE_GLOBALDATA_H_
31
32#include <machine/segments.h>
33#include <machine/tss.h>
34
35/* XXX */
36#ifdef KTR_PERCPU
37#include <sys/ktr.h>
38#endif
39
40/*
41 * This structure maps out the global data that needs to be kept on a
42 * per-cpu basis. genassym uses this to generate offsets for the assembler
43 * code, which also provides external symbols so that C can get at them as
44 * though they were really globals.
45 *
46 * The SMP parts are setup in pmap.c and locore.s for the BSP, and
47 * mp_machdep.c sets up the data for the AP's to "see" when they awake.
48 * The reason for doing it via a struct is so that an array of pointers
49 * to each CPU's data can be set up for things like "check curproc on all
50 * other processors"
51 */
52struct globaldata {
53 struct globaldata *gd_prvspace; /* self-reference */
54 struct proc *gd_curproc;
55 struct proc *gd_npxproc;
56 struct pcb *gd_curpcb;
57 struct proc *gd_idleproc;
58 struct timeval gd_switchtime;
59 struct i386tss gd_common_tss;
60 int gd_switchticks;
61 struct segment_descriptor gd_common_tssd;
62 struct segment_descriptor *gd_tss_gdt;
63 int gd_currentldt;
64 u_int gd_cpuid;
65 u_int gd_other_cpus;
66 SLIST_ENTRY(globaldata) gd_allcpu;
67 int gd_witness_spin_check;
27 */
28
29#ifndef _MACHINE_GLOBALDATA_H_
30#define _MACHINE_GLOBALDATA_H_
31
32#include <machine/segments.h>
33#include <machine/tss.h>
34
35/* XXX */
36#ifdef KTR_PERCPU
37#include <sys/ktr.h>
38#endif
39
40/*
41 * This structure maps out the global data that needs to be kept on a
42 * per-cpu basis. genassym uses this to generate offsets for the assembler
43 * code, which also provides external symbols so that C can get at them as
44 * though they were really globals.
45 *
46 * The SMP parts are setup in pmap.c and locore.s for the BSP, and
47 * mp_machdep.c sets up the data for the AP's to "see" when they awake.
48 * The reason for doing it via a struct is so that an array of pointers
49 * to each CPU's data can be set up for things like "check curproc on all
50 * other processors"
51 */
52struct globaldata {
53 struct globaldata *gd_prvspace; /* self-reference */
54 struct proc *gd_curproc;
55 struct proc *gd_npxproc;
56 struct pcb *gd_curpcb;
57 struct proc *gd_idleproc;
58 struct timeval gd_switchtime;
59 struct i386tss gd_common_tss;
60 int gd_switchticks;
61 struct segment_descriptor gd_common_tssd;
62 struct segment_descriptor *gd_tss_gdt;
63 int gd_currentldt;
64 u_int gd_cpuid;
65 u_int gd_other_cpus;
66 SLIST_ENTRY(globaldata) gd_allcpu;
67 int gd_witness_spin_check;
68 struct lock_list_entry *gd_spinlocks;
68#ifdef KTR_PERCPU
69#ifdef KTR
70 volatile int gd_ktr_idx;
71 char *gd_ktr_buf;
72 char gd_ktr_buf_data[KTR_SIZE];
73#endif
74#endif
75};
76
77SLIST_HEAD(cpuhead, globaldata);
78extern struct cpuhead cpuhead;
79
80#ifdef SMP
81/*
82 * This is the upper (0xff800000) address space layout that is per-cpu.
83 * It is setup in locore.s and pmap.c for the BSP and in mp_machdep.c for
84 * each AP. genassym helps export this to the assembler code.
85 */
86struct privatespace {
87 /* page 0 - data page */
88 struct globaldata globaldata;
89 char __filler0[PAGE_SIZE - sizeof(struct globaldata)];
90
91 /* page 1 - idle stack (UPAGES pages) */
92 char idlestack[UPAGES * PAGE_SIZE];
93 /* page 1+UPAGES... */
94};
95
96extern struct privatespace SMP_prvspace[];
97
98#endif
99
100#endif /* ! _MACHINE_GLOBALDATA_H_ */
69#ifdef KTR_PERCPU
70#ifdef KTR
71 volatile int gd_ktr_idx;
72 char *gd_ktr_buf;
73 char gd_ktr_buf_data[KTR_SIZE];
74#endif
75#endif
76};
77
78SLIST_HEAD(cpuhead, globaldata);
79extern struct cpuhead cpuhead;
80
81#ifdef SMP
82/*
83 * This is the upper (0xff800000) address space layout that is per-cpu.
84 * It is setup in locore.s and pmap.c for the BSP and in mp_machdep.c for
85 * each AP. genassym helps export this to the assembler code.
86 */
87struct privatespace {
88 /* page 0 - data page */
89 struct globaldata globaldata;
90 char __filler0[PAGE_SIZE - sizeof(struct globaldata)];
91
92 /* page 1 - idle stack (UPAGES pages) */
93 char idlestack[UPAGES * PAGE_SIZE];
94 /* page 1+UPAGES... */
95};
96
97extern struct privatespace SMP_prvspace[];
98
99#endif
100
101#endif /* ! _MACHINE_GLOBALDATA_H_ */