4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _COMPAT_OPENSOLARIS_SYS_CPUVAR_H
28 #define _COMPAT_OPENSOLARIS_SYS_CPUVAR_H
30 #include <sys/mutex.h>
33 #define CPU_CACHE_COHERENCE_SIZE 64
36 * The cpu_core structure consists of per-CPU state available in any context.
37 * On some architectures, this may mean that the page(s) containing the
38 * NCPU-sized array of cpu_core structures must be locked in the TLB -- it
39 * is up to the platform to assure that this is performed properly. Note that
40 * the structure is sized to avoid false sharing.
42 #define CPUC_SIZE (sizeof (uint16_t) + sizeof (uintptr_t) + \
44 #define CPUC_PADSIZE CPU_CACHE_COHERENCE_SIZE - CPUC_SIZE
46 typedef struct cpu_core {
47 uint16_t cpuc_dtrace_flags; /* DTrace flags */
48 uint8_t cpuc_pad[CPUC_PADSIZE]; /* padding */
49 uintptr_t cpuc_dtrace_illval; /* DTrace illegal value */
50 kmutex_t cpuc_pid_lock; /* DTrace pid provider lock */
53 extern cpu_core_t cpu_core[];
59 #define CPU_DTRACE_NOFAULT 0x0001 /* Don't fault */
60 #define CPU_DTRACE_DROP 0x0002 /* Drop this ECB */
61 #define CPU_DTRACE_BADADDR 0x0004 /* DTrace fault: bad address */
62 #define CPU_DTRACE_BADALIGN 0x0008 /* DTrace fault: bad alignment */
63 #define CPU_DTRACE_DIVZERO 0x0010 /* DTrace fault: divide by zero */
64 #define CPU_DTRACE_ILLOP 0x0020 /* DTrace fault: illegal operation */
65 #define CPU_DTRACE_NOSCRATCH 0x0040 /* DTrace fault: out of scratch */
66 #define CPU_DTRACE_KPRIV 0x0080 /* DTrace fault: bad kernel access */
67 #define CPU_DTRACE_UPRIV 0x0100 /* DTrace fault: bad user access */
68 #define CPU_DTRACE_TUPOFLOW 0x0200 /* DTrace fault: tuple stack overflow */
70 #define CPU_DTRACE_FAKERESTORE 0x0400 /* pid provider hint to getreg */
72 #define CPU_DTRACE_ENTRY 0x0800 /* pid provider hint to ustack() */
73 #define CPU_DTRACE_BADSTACK 0x1000 /* DTrace fault: bad stack */
75 #define CPU_DTRACE_FAULT (CPU_DTRACE_BADADDR | CPU_DTRACE_BADALIGN | \
76 CPU_DTRACE_DIVZERO | CPU_DTRACE_ILLOP | \
77 CPU_DTRACE_NOSCRATCH | CPU_DTRACE_KPRIV | \
78 CPU_DTRACE_UPRIV | CPU_DTRACE_TUPOFLOW | \
80 #define CPU_DTRACE_ERROR (CPU_DTRACE_FAULT | CPU_DTRACE_DROP)
92 typedef int cpu_setup_func_t(cpu_setup_t, int, void *);
95 #endif /* _COMPAT_OPENSOLARIS_SYS_CPUVAR_H */