pcpu.h revision 83366
1/*-
2 * Copyright (c) 1999 Luoqi Chen <luoqi@freebsd.org>
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 *	from: FreeBSD: src/sys/i386/include/globaldata.h,v 1.27 2001/04/27
27 * $FreeBSD: head/sys/sparc64/include/pcpu.h 83366 2001-09-12 08:38:13Z julian $
28 */
29
30#ifndef	_MACHINE_GLOBALDATA_H_
31#define	_MACHINE_GLOBALDATA_H_
32
33#ifdef _KERNEL
34
35#include <sys/queue.h>
36
37#define	ALT_STACK_SIZE	128
38
39/*
40 * This structure maps out the global data that needs to be kept on a
41 * per-cpu basis.  genassym uses this to generate offsets for the assembler
42 * code, which also provides external symbols so that C can get at them as
43 * though they were really globals. This structure is pointed to by
44 * the per-cpu system value.
45 * Inside the kernel, the globally reserved register g7 is used to
46 * point at the globaldata structure.
47 */
48struct globaldata {
49	struct	thread *gd_curthread;		/* current thread */
50	struct	thread *gd_idlethread;		/* idle thread */
51	struct	pcb *gd_curpcb;			/* current pcb */
52	struct	timeval gd_switchtime;
53	int	gd_switchticks;
54	u_int	gd_cpuid;			/* this cpu number */
55	u_int	gd_other_cpus;			/* all other cpus */
56	SLIST_ENTRY(globaldata) gd_allcpu;
57	struct	lock_list_entry *gd_spinlocks;
58#ifdef KTR_PERCPU
59	volatile int	gd_ktr_idx;		/* Index into trace table */
60	char	*gd_ktr_buf;
61	char	gd_ktr_buf_data[0];
62#endif
63	struct	intr_queue *gd_iq;
64	struct	intr_vector *gd_ivt;
65
66	/* Alternate global stack */
67	u_long	gd_alt_stack[ALT_STACK_SIZE];
68
69	/* Watch point support. */
70	u_int	gd_wp_insn;
71	u_long	gd_wp_pstate;
72	u_long	gd_wp_va;
73	int	gd_wp_mask;
74};
75
76#endif	/* _KERNEL */
77
78#endif	/* !_MACHINE_GLOBALDATA_H_ */
79