summaryrefslogtreecommitdiff
path: root/usr/src/uts/sparc/sys
diff options
context:
space:
mode:
authorstevel@tonic-gate <none@none>2005-06-14 00:00:00 -0700
committerstevel@tonic-gate <none@none>2005-06-14 00:00:00 -0700
commit7c478bd95313f5f23a4c958a745db2134aa03244 (patch)
treec871e58545497667cbb4b0a4f2daf204743e1fe7 /usr/src/uts/sparc/sys
downloadillumos-gate-7c478bd95313f5f23a4c958a745db2134aa03244.tar.gz
OpenSolaris Launch
Diffstat (limited to 'usr/src/uts/sparc/sys')
-rw-r--r--usr/src/uts/sparc/sys/Makefile92
-rw-r--r--usr/src/uts/sparc/sys/archsystm.h136
-rw-r--r--usr/src/uts/sparc/sys/asm_linkage.h247
-rw-r--r--usr/src/uts/sparc/sys/cmpregs.h76
-rw-r--r--usr/src/uts/sparc/sys/cpu.h80
-rw-r--r--usr/src/uts/sparc/sys/ddi_isa.h398
-rw-r--r--usr/src/uts/sparc/sys/fasttrap_isa.h94
-rw-r--r--usr/src/uts/sparc/sys/fpu/fpu_simulator.h478
-rw-r--r--usr/src/uts/sparc/sys/fpu/fpusystm.h96
-rw-r--r--usr/src/uts/sparc/sys/fpu/globals.h141
-rw-r--r--usr/src/uts/sparc/sys/fpu/ieee.h124
-rw-r--r--usr/src/uts/sparc/sys/frame.h70
-rw-r--r--usr/src/uts/sparc/sys/fsr.h151
-rw-r--r--usr/src/uts/sparc/sys/inline.h54
-rw-r--r--usr/src/uts/sparc/sys/kdi_machimpl.h104
-rw-r--r--usr/src/uts/sparc/sys/machelf.h183
-rw-r--r--usr/src/uts/sparc/sys/machlock.h128
-rw-r--r--usr/src/uts/sparc/sys/machsig.h128
-rw-r--r--usr/src/uts/sparc/sys/machtypes.h61
-rw-r--r--usr/src/uts/sparc/sys/old_procfs.h612
-rw-r--r--usr/src/uts/sparc/sys/pcb.h80
-rw-r--r--usr/src/uts/sparc/sys/polled_io.h110
-rw-r--r--usr/src/uts/sparc/sys/procfs_isa.h269
-rw-r--r--usr/src/uts/sparc/sys/psw.h65
-rw-r--r--usr/src/uts/sparc/sys/reg.h89
-rw-r--r--usr/src/uts/sparc/sys/regset.h605
-rw-r--r--usr/src/uts/sparc/sys/simulate.h162
-rw-r--r--usr/src/uts/sparc/sys/spl.h58
-rw-r--r--usr/src/uts/sparc/sys/stack.h173
-rw-r--r--usr/src/uts/sparc/sys/stat_impl.h80
-rw-r--r--usr/src/uts/sparc/sys/synch32.h86
-rw-r--r--usr/src/uts/sparc/sys/sysconfig_impl.h45
-rw-r--r--usr/src/uts/sparc/sys/trap.h88
-rw-r--r--usr/src/uts/sparc/sys/ucontext.h160
-rw-r--r--usr/src/uts/sparc/sys/utrap.h116
-rw-r--r--usr/src/uts/sparc/sys/vmparam.h85
36 files changed, 5724 insertions, 0 deletions
diff --git a/usr/src/uts/sparc/sys/Makefile b/usr/src/uts/sparc/sys/Makefile
new file mode 100644
index 0000000000..88221c9101
--- /dev/null
+++ b/usr/src/uts/sparc/sys/Makefile
@@ -0,0 +1,92 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../../../Makefile.master
+
+HDRS= \
+ archsystm.h \
+ asm_linkage.h \
+ cmpregs.h \
+ cpu.h \
+ ddi_isa.h \
+ fasttrap_isa.h \
+ frame.h \
+ fsr.h \
+ inline.h \
+ kdi_machimpl.h \
+ machelf.h \
+ machlock.h \
+ machsig.h \
+ machtypes.h \
+ old_procfs.h \
+ pcb.h \
+ procfs_isa.h \
+ psw.h \
+ reg.h \
+ regset.h \
+ spl.h \
+ stack.h \
+ stat_impl.h \
+ synch32.h \
+ trap.h \
+ ucontext.h \
+ utrap.h \
+ vmparam.h \
+ sysconfig_impl.h
+
+FPUHDRS= fpu_simulator.h fpusystm.h globals.h ieee.h
+
+ROOTDIR= $(ROOT)/usr/include/sys
+ROOTDIRS= $(ROOTDIR) $(ROOTDIR)/fpu
+
+ROOTHDRS= $(HDRS:%=$(ROOTDIR)/%)
+ROOTFPUHDRS= $(FPUHDRS:%=$(ROOTDIR)/fpu/%)
+
+fpu/%.check: fpu/%.h
+ $(DOT_H_CHECK)
+
+CHECKHDRS= $(HDRS:%.h=%.check) \
+ $(FPUHDRS:%.h=fpu/%.check)
+
+# install rules
+$(ROOTDIR)/%: %
+ $(INS.file)
+
+$(ROOTDIR)/fpu/%: fpu/%
+ $(INS.file)
+
+.KEEP_STATE:
+
+.PARALLEL: $(CHECKHDRS) $(ROOTHDRS) $(ROOTFPUHDRS)
+
+install_h: $(ROOTDIRS) .WAIT $(ROOTHDRS) $(ROOTFPUHDRS)
+
+$(ROOTDIRS):
+ $(INS.dir)
+
+check: $(CHECKHDRS)
diff --git a/usr/src/uts/sparc/sys/archsystm.h b/usr/src/uts/sparc/sys/archsystm.h
new file mode 100644
index 0000000000..457a287c43
--- /dev/null
+++ b/usr/src/uts/sparc/sys/archsystm.h
@@ -0,0 +1,136 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_ARCHSYSTM_H
+#define _SYS_ARCHSYSTM_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * A selection of ISA-dependent interfaces
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(_KERNEL) && !defined(_ASM)
+
+#include <sys/types.h>
+#include <sys/regset.h>
+#include <sys/model.h>
+
+extern greg_t getfp(void);
+extern greg_t getpsr(void);
+extern uint_t getpil(void);
+extern void setpil(uint_t);
+extern greg_t gettbr(void);
+extern void realsigprof(int, int);
+
+extern uintptr_t shm_alignment;
+
+struct proc;
+struct _klwp;
+extern void xregrestore(struct _klwp *, int);
+extern int copy_return_window(int);
+
+extern void setgwins(struct _klwp *, gwindows_t *);
+extern void getgwins(struct _klwp *, gwindows_t *);
+extern void setgwins32(struct _klwp *, gwindows32_t *);
+extern void getgwins32(struct _klwp *, gwindows32_t *);
+extern void setasrs(struct _klwp *, asrset_t);
+extern void getasrs(struct _klwp *, asrset_t);
+extern void setfpasrs(struct _klwp *, asrset_t);
+extern void getfpasrs(struct _klwp *, asrset_t);
+
+extern void setgregs(struct _klwp *, gregset_t);
+extern void getgregs(struct _klwp *, gregset_t);
+extern void setfpregs(struct _klwp *, fpregset_t *);
+extern void getfpregs(struct _klwp *, fpregset_t *);
+
+#ifdef _SYSCALL32_IMPL
+extern void getgregs32(struct _klwp *, gregset32_t);
+extern void setfpregs32(struct _klwp *, fpregset32_t *);
+extern void getfpregs32(struct _klwp *, fpregset32_t *);
+#endif
+
+extern void vac_flushall(void);
+
+extern void bind_hwcap(void);
+
+extern u_longlong_t gettick(void);
+extern uint64_t gettick_counter(void);
+extern int xcopyin_little(const void *, void *, size_t);
+extern int xcopyout_little(const void *, void *, size_t);
+extern void xregs_getgfiller(klwp_id_t lwp, caddr_t xrp);
+extern void xregs_setgfiller(klwp_id_t lwp, caddr_t xrp);
+extern void xregs_getfpfiller(klwp_id_t lwp, caddr_t xrp);
+extern void xregs_setfpfiller(klwp_id_t lwp, caddr_t xrp);
+
+struct ucontext;
+extern void xregs_clrptr(struct _klwp *, struct ucontext *);
+extern int xregs_hasptr(struct _klwp *, struct ucontext *);
+extern caddr_t xregs_getptr(struct _klwp *, struct ucontext *);
+extern void xregs_setptr(struct _klwp *, struct ucontext *, caddr_t);
+
+#ifdef _SYSCALL32_IMPL
+struct ucontext32;
+extern void xregs_clrptr32(struct _klwp *, struct ucontext32 *);
+extern int xregs_hasptr32(struct _klwp *, struct ucontext32 *);
+extern caddr32_t xregs_getptr32(struct _klwp *, struct ucontext32 *);
+extern void xregs_setptr32(struct _klwp *, struct ucontext32 *, caddr32_t);
+#endif /* _SYSCALL32_IMPL */
+
+extern void xregs_getgregs(struct _klwp *, caddr_t);
+extern void xregs_getfpregs(struct _klwp *, caddr_t);
+extern void xregs_get(struct _klwp *, caddr_t);
+extern void xregs_setgregs(struct _klwp *, caddr_t);
+extern void xregs_setfpregs(struct _klwp *, caddr_t);
+extern void xregs_set(struct _klwp *, caddr_t);
+extern int xregs_getsize(struct proc *);
+
+extern void doflush(void *);
+
+extern uint_t cpu_hwcap_flags;
+
+#endif /* _KERNEL && !_ASM */
+
+
+#if defined(_KERNEL)
+
+/*
+ * For binary compatability with SPARC/Solaris 1. Needed in the
+ * sparc assembly files.
+ */
+#define OSYS_mmap 71
+
+#endif /* _KERNEL */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_ARCHSYSTM_H */
diff --git a/usr/src/uts/sparc/sys/asm_linkage.h b/usr/src/uts/sparc/sys/asm_linkage.h
new file mode 100644
index 0000000000..ff8f9201b0
--- /dev/null
+++ b/usr/src/uts/sparc/sys/asm_linkage.h
@@ -0,0 +1,247 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_ASM_LINKAGE_H
+#define _SYS_ASM_LINKAGE_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <sys/stack.h>
+#include <sys/trap.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _ASM /* The remainder of this file is only for assembly files */
+
+/*
+ * C pointers are different sizes between V8 and V9.
+ * These constants can be used to compute offsets into pointer arrays.
+ */
+#ifdef __sparcv9
+#define CPTRSHIFT 3
+#define CLONGSHIFT 3
+#else
+#define CPTRSHIFT 2
+#define CLONGSHIFT 2
+#endif
+#define CPTRSIZE (1<<CPTRSHIFT)
+#define CLONGSIZE (1<<CLONGSHIFT)
+#define CPTRMASK (CPTRSIZE - 1)
+#define CLONGMASK (CLONGSIZE - 1)
+
+/*
+ * Symbolic section definitions.
+ */
+#define RODATA ".rodata"
+
+/*
+ * profiling causes defintions of the MCOUNT and RTMCOUNT
+ * particular to the type
+ */
+#ifdef GPROF
+
+#define MCOUNT_SIZE (4*4) /* 4 instructions */
+#define MCOUNT(x) \
+ save %sp, -SA(MINFRAME), %sp; \
+ call _mcount; \
+ nop; \
+ restore;
+
+#endif /* GPROF */
+
+#ifdef PROF
+
+#if defined(__sparcv9)
+
+#define MCOUNT_SIZE (9*4) /* 9 instructions */
+#define MCOUNT(x) \
+ save %sp, -SA(MINFRAME), %sp; \
+/* CSTYLED */ \
+ sethi %hh(.L_/**/x/**/1), %o0; \
+/* CSTYLED */ \
+ sethi %lm(.L_/**/x/**/1), %o1; \
+/* CSTYLED */ \
+ or %o0, %hm(.L_/**/x/**/1), %o0; \
+/* CSTYLED */ \
+ or %o1, %lo(.L_/**/x/**/1), %o1; \
+ sllx %o0, 32, %o0; \
+ call _mcount; \
+ or %o0, %o1, %o0; \
+ restore; \
+/* CSTYLED */ \
+ .common .L_/**/x/**/1, 8, 8
+
+#else /* __sparcv9 */
+
+#define MCOUNT_SIZE (5*4) /* 5 instructions */
+#define MCOUNT(x) \
+ save %sp, -SA(MINFRAME), %sp; \
+/* CSTYLED */ \
+ sethi %hi(.L_/**/x/**/1), %o0; \
+ call _mcount; \
+/* CSTYLED */ \
+ or %o0, %lo(.L_/**/x/**/1), %o0; \
+ restore; \
+/* CSTYLED */ \
+ .common .L_/**/x/**/1, 4, 4
+
+#endif /* __sparcv9 */
+
+#endif /* PROF */
+
+/*
+ * if we are not profiling, MCOUNT should be defined to nothing
+ */
+#if !defined(PROF) && !defined(GPROF)
+#define MCOUNT_SIZE 0 /* no instructions inserted */
+#define MCOUNT(x)
+#endif /* !defined(PROF) && !defined(GPROF) */
+
+#define RTMCOUNT(x) MCOUNT(x)
+
+/*
+ * Macro to define weak symbol aliases. These are similar to the ANSI-C
+ * #pragma weak name = _name
+ * except a compiler can determine type. The assembler must be told. Hence,
+ * the second parameter must be the type of the symbol (i.e.: function,...)
+ */
+#define ANSI_PRAGMA_WEAK(sym, stype) \
+ .weak sym; \
+ .type sym, #stype; \
+/* CSTYLED */ \
+sym = _/**/sym
+
+/*
+ * Like ANSI_PRAGMA_WEAK(), but for unrelated names, as in:
+ * #pragma weak sym1 = sym2
+ */
+#define ANSI_PRAGMA_WEAK2(sym1, sym2, stype) \
+ .weak sym1; \
+ .type sym1, #stype; \
+sym1 = sym2
+
+/*
+ * ENTRY provides the standard procedure entry code and an easy way to
+ * insert the calls to mcount for profiling. ENTRY_NP is identical, but
+ * never calls mcount.
+ */
+#define ENTRY(x) \
+ .section ".text"; \
+ .align 4; \
+ .global x; \
+ .type x, #function; \
+x: MCOUNT(x)
+
+#define ENTRY_SIZE MCOUNT_SIZE
+
+#define ENTRY_NP(x) \
+ .section ".text"; \
+ .align 4; \
+ .global x; \
+ .type x, #function; \
+x:
+
+#define RTENTRY(x) \
+ .section ".text"; \
+ .align 4; \
+ .global x; \
+ .type x, #function; \
+x: RTMCOUNT(x)
+
+/*
+ * ENTRY2 is identical to ENTRY but provides two labels for the entry point.
+ */
+#define ENTRY2(x, y) \
+ .section ".text"; \
+ .align 4; \
+ .global x, y; \
+ .type x, #function; \
+ .type y, #function; \
+/* CSTYLED */ \
+x: ; \
+y: MCOUNT(x)
+
+#define ENTRY_NP2(x, y) \
+ .section ".text"; \
+ .align 4; \
+ .global x, y; \
+ .type x, #function; \
+ .type y, #function; \
+/* CSTYLED */ \
+x: ; \
+y:
+
+
+/*
+ * ALTENTRY provides for additional entry points.
+ */
+#define ALTENTRY(x) \
+ .global x; \
+ .type x, #function; \
+x:
+
+/*
+ * DGDEF and DGDEF2 provide global data declarations.
+ *
+ * DGDEF provides a word aligned word of storage.
+ *
+ * DGDEF2 allocates "sz" bytes of storage with **NO** alignment. This
+ * implies this macro is best used for byte arrays.
+ *
+ * DGDEF3 allocates "sz" bytes of storage with "algn" alignment.
+ */
+#define DGDEF2(name, sz) \
+ .section ".data"; \
+ .global name; \
+ .type name, #object; \
+ .size name, sz; \
+name:
+
+#define DGDEF3(name, sz, algn) \
+ .section ".data"; \
+ .align algn; \
+ .global name; \
+ .type name, #object; \
+ .size name, sz; \
+name:
+
+#define DGDEF(name) DGDEF3(name, 4, 4)
+
+/*
+ * SET_SIZE trails a function and set the size for the ELF symbol table.
+ */
+#define SET_SIZE(x) \
+ .size x, (.-x)
+
+#endif /* _ASM */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_ASM_LINKAGE_H */
diff --git a/usr/src/uts/sparc/sys/cmpregs.h b/usr/src/uts/sparc/sys/cmpregs.h
new file mode 100644
index 0000000000..fafeba5ff8
--- /dev/null
+++ b/usr/src/uts/sparc/sys/cmpregs.h
@@ -0,0 +1,76 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _CMPREGS_H
+#define _CMPREGS_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ASI_CMP_SHARED 0x41 /* shared CMP registers */
+#define ASI_CMP_PER_CORE 0x63 /* core-local CMP registers */
+
+/*
+ * Core ID Register
+ *
+ * |-----------------------|
+ * |MAX_CORE_ID|---|CORE_ID|
+ * |-----------------------|
+ * 21 16 5 0
+ */
+#define ASI_CORE_ID 0x10 /* ASI 0x63, VA 0x10 */
+#define COREID_MASK 0x3f
+
+
+/*
+ * Error Steering Register
+ *
+ * |-------|
+ * |CORE_ID|
+ * |-------|
+ * 5 0
+ */
+#define ASI_CMP_ERROR_STEERING 0x40 /* ASI 0x41, VA 0x40 */
+
+/*
+ * Core Running
+ *
+ * |------------------------------|
+ * | |core running (status) |
+ * |------------------------------|
+ * 1 0
+ */
+#define ASI_CORE_RUNNING_STATUS 0x58 /* ASI 0x41, VA 0x58 */
+#define ASI_CORE_RUNNING_RW 0x50 /* ASI 0x41, VA 0x50 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CMPREGS_H */
diff --git a/usr/src/uts/sparc/sys/cpu.h b/usr/src/uts/sparc/sys/cpu.h
new file mode 100644
index 0000000000..be90896939
--- /dev/null
+++ b/usr/src/uts/sparc/sys/cpu.h
@@ -0,0 +1,80 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_CPU_H
+#define _SYS_CPU_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Include generic bustype cookies.
+ */
+#include <sys/bustypes.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Global kernel variables of interest
+ */
+
+#if defined(_KERNEL) && !defined(_ASM)
+
+extern int dvmasize; /* usable dvma size in pages */
+
+/*
+ * Cache defines
+ *
+ * Each bit represents an attribute of the system's caches that
+ * the OS must handle. For example, VAC caches must have virtual
+ * alias detection, VTAG caches must be flushed on every demap, etc.
+ */
+#define CACHE_NONE 0 /* No caches of any type */
+#define CACHE_VAC 0x01 /* Virtual addressed cache */
+#define CACHE_VTAG 0x02 /* Virtual tagged cache */
+#define CACHE_PAC 0x04 /* Physical addressed cache */
+#define CACHE_PTAG 0x08 /* Physical tagged cache */
+#define CACHE_WRITEBACK 0x10 /* Writeback cache */
+#define CACHE_IOCOHERENT 0x20 /* I/O coherent cache */
+
+extern int cache;
+
+/* set this to zero if no vac */
+extern int vac;
+
+/*
+ * Use to insert cpu-dependent instructions into spin loops
+ */
+#define SMT_PAUSE() /* none */
+
+#endif /* defined(_KERNEL) && !defined(_ASM) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_CPU_H */
diff --git a/usr/src/uts/sparc/sys/ddi_isa.h b/usr/src/uts/sparc/sys/ddi_isa.h
new file mode 100644
index 0000000000..5d3b37dbac
--- /dev/null
+++ b/usr/src/uts/sparc/sys/ddi_isa.h
@@ -0,0 +1,398 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_DDI_ISA_H
+#define _SYS_DDI_ISA_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <sys/isa_defs.h>
+#include <sys/ndifm.h>
+#include <sys/dditypes.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _KERNEL
+
+/*
+ * These are the data access functions which the platform
+ * can choose to define as functions or macro's.
+ */
+
+/*
+ * DDI interfaces defined as macro's
+ */
+
+/*
+ * DDI interfaces defined as functions
+ */
+
+#ifdef __STDC__
+
+uint8_t
+ddi_mem_get8(ddi_acc_handle_t handle, uint8_t *host_addr);
+
+uint16_t
+ddi_mem_get16(ddi_acc_handle_t handle, uint16_t *host_addr);
+
+uint32_t
+ddi_mem_get32(ddi_acc_handle_t handle, uint32_t *host_addr);
+
+uint64_t
+ddi_mem_get64(ddi_acc_handle_t handle, uint64_t *host_addr);
+
+void
+ddi_mem_rep_get8(ddi_acc_handle_t handle, uint8_t *host_addr,
+ uint8_t *dev_addr, size_t repcount, uint_t flags);
+
+void
+ddi_mem_rep_get16(ddi_acc_handle_t handle, uint16_t *host_addr,
+ uint16_t *dev_addr, size_t repcount, uint_t flags);
+
+void
+ddi_mem_rep_get32(ddi_acc_handle_t handle, uint32_t *host_addr,
+ uint32_t *dev_addr, size_t repcount, uint_t flags);
+
+void
+ddi_mem_rep_get64(ddi_acc_handle_t handle, uint64_t *host_addr,
+ uint64_t *dev_addr, size_t repcount, uint_t flags);
+
+void
+ddi_mem_put8(ddi_acc_handle_t handle, uint8_t *dev_addr, uint8_t value);
+
+void
+ddi_mem_put16(ddi_acc_handle_t handle, uint16_t *dev_addr, uint16_t value);
+
+void
+ddi_mem_put32(ddi_acc_handle_t handle, uint32_t *dev_addr, uint32_t value);
+
+void
+ddi_mem_put64(ddi_acc_handle_t handle, uint64_t *dev_addr, uint64_t value);
+
+void
+ddi_mem_rep_put8(ddi_acc_handle_t handle, uint8_t *host_addr,
+ uint8_t *dev_addr, size_t repcount, uint_t flags);
+
+void
+ddi_mem_rep_put16(ddi_acc_handle_t handle, uint16_t *host_addr,
+ uint16_t *dev_addr, size_t repcount, uint_t flags);
+
+void
+ddi_mem_rep_put32(ddi_acc_handle_t handle, uint32_t *host_addr,
+ uint32_t *dev_addr, size_t repcount, uint_t flags);
+
+void
+ddi_mem_rep_put64(ddi_acc_handle_t handle, uint64_t *host_addr,
+ uint64_t *dev_addr, size_t repcount, uint_t flags);
+
+uint8_t
+ddi_io_get8(ddi_acc_handle_t handle, uint8_t *dev_addr);
+
+uint16_t
+ddi_io_get16(ddi_acc_handle_t handle, uint16_t *dev_addr);
+
+uint32_t
+ddi_io_get32(ddi_acc_handle_t handle, uint32_t *dev_addr);
+
+void
+ddi_io_rep_get8(ddi_acc_handle_t handle,
+ uint8_t *host_addr, uint8_t *dev_addr, size_t repcount);
+
+void
+ddi_io_rep_get16(ddi_acc_handle_t handle,
+ uint16_t *host_addr, uint16_t *dev_addr, size_t repcount);
+
+void
+ddi_io_rep_get32(ddi_acc_handle_t handle,
+ uint32_t *host_addr, uint32_t *dev_addr, size_t repcount);
+
+void
+ddi_io_put8(ddi_acc_handle_t handle, uint8_t *dev_addr, uint8_t value);
+
+void
+ddi_io_put16(ddi_acc_handle_t handle, uint16_t *dev_addr, uint16_t value);
+
+void
+ddi_io_put32(ddi_acc_handle_t handle, uint32_t *dev_addr, uint32_t value);
+
+void
+ddi_io_rep_put8(ddi_acc_handle_t handle,
+ uint8_t *host_addr, uint8_t *dev_addr, size_t repcount);
+
+void
+ddi_io_rep_put16(ddi_acc_handle_t handle,
+ uint16_t *host_addr, uint16_t *dev_addr, size_t repcount);
+
+void
+ddi_io_rep_put32(ddi_acc_handle_t handle,
+ uint32_t *host_addr, uint32_t *dev_addr, size_t repcount);
+
+#endif /* __STDC__ */
+
+/*
+ * The implementation specific ddi access handle is the same for
+ * all sparc v7 platforms.
+ */
+
+typedef struct ddi_acc_impl {
+ ddi_acc_hdl_t ahi_common;
+ uint8_t
+ (*ahi_get8)(struct ddi_acc_impl *handle, uint8_t *addr);
+ uint16_t
+ (*ahi_get16)(struct ddi_acc_impl *handle, uint16_t *addr);
+ uint32_t
+ (*ahi_get32)(struct ddi_acc_impl *handle, uint32_t *addr);
+ uint64_t
+ (*ahi_get64)(struct ddi_acc_impl *handle, uint64_t *addr);
+ void (*ahi_put8)(struct ddi_acc_impl *handle, uint8_t *addr,
+ uint8_t value);
+ void (*ahi_put16)(struct ddi_acc_impl *handle, uint16_t *addr,
+ uint16_t value);
+ void (*ahi_put32)(struct ddi_acc_impl *handle, uint32_t *addr,
+ uint32_t value);
+ void (*ahi_put64)(struct ddi_acc_impl *handle, uint64_t *addr,
+ uint64_t value);
+
+ void (*ahi_rep_get8)(struct ddi_acc_impl *handle,
+ uint8_t *host_addr, uint8_t *dev_addr,
+ size_t repcount, uint_t flags);
+ void (*ahi_rep_get16)(struct ddi_acc_impl *handle,
+ uint16_t *host_addr, uint16_t *dev_addr,
+ size_t repcount, uint_t flags);
+ void (*ahi_rep_get32)(struct ddi_acc_impl *handle,
+ uint32_t *host_addr, uint32_t *dev_addr,
+ size_t repcount, uint_t flags);
+ void (*ahi_rep_get64)(struct ddi_acc_impl *handle,
+ uint64_t *host_addr, uint64_t *dev_addr,
+ size_t repcount, uint_t flags);
+
+ void (*ahi_rep_put8)(struct ddi_acc_impl *handle,
+ uint8_t *host_addr, uint8_t *dev_addr,
+ size_t repcount, uint_t flags);
+ void (*ahi_rep_put16)(struct ddi_acc_impl *handle,
+ uint16_t *host_addr, uint16_t *dev_addr,
+ size_t repcount, uint_t flags);
+ void (*ahi_rep_put32)(struct ddi_acc_impl *handle,
+ uint32_t *host_addr, uint32_t *dev_addr,
+ size_t repcount, uint_t flags);
+ void (*ahi_rep_put64)(struct ddi_acc_impl *handle,
+ uint64_t *host_addr, uint64_t *dev_addr,
+ size_t repcount, uint_t flags);
+
+ int (*ahi_fault_check)(struct ddi_acc_impl *handle);
+ void (*ahi_fault_notify)(struct ddi_acc_impl *handle);
+ uint32_t ahi_fault;
+ ndi_err_t *ahi_err; /* Access error data */
+} ddi_acc_impl_t;
+
+/*
+ * Input functions to memory mapped IO
+ */
+uint8_t
+i_ddi_get8(ddi_acc_impl_t *hdlp, uint8_t *addr);
+
+uint16_t
+i_ddi_get16(ddi_acc_impl_t *hdlp, uint16_t *addr);
+
+uint32_t
+i_ddi_get32(ddi_acc_impl_t *hdlp, uint32_t *addr);
+
+uint64_t
+i_ddi_get64(ddi_acc_impl_t *hdlp, uint64_t *addr);
+
+uint16_t
+i_ddi_swap_get16(ddi_acc_impl_t *hdlp, uint16_t *addr);
+
+uint32_t
+i_ddi_swap_get32(ddi_acc_impl_t *hdlp, uint32_t *addr);
+
+uint64_t
+i_ddi_swap_get64(ddi_acc_impl_t *hdlp, uint64_t *addr);
+
+/*
+ * Output functions to memory mapped IO
+ */
+void
+i_ddi_put8(ddi_acc_impl_t *hdlp, uint8_t *addr, uint8_t value);
+
+void
+i_ddi_put16(ddi_acc_impl_t *hdlp, uint16_t *addr, uint16_t value);
+
+void
+i_ddi_put32(ddi_acc_impl_t *hdlp, uint32_t *addr, uint32_t value);
+
+void
+i_ddi_put64(ddi_acc_impl_t *hdlp, uint64_t *addr, uint64_t value);
+
+void
+i_ddi_swap_put16(ddi_acc_impl_t *hdlp, uint16_t *addr, uint16_t value);
+
+void
+i_ddi_swap_put32(ddi_acc_impl_t *hdlp, uint32_t *addr, uint32_t value);
+
+void
+i_ddi_swap_put64(ddi_acc_impl_t *hdlp, uint64_t *addr, uint64_t value);
+
+/*
+ * Repeated input functions for memory mapped IO
+ */
+void
+i_ddi_rep_get8(ddi_acc_impl_t *hdlp, uint8_t *host_addr, uint8_t *dev_addr,
+ size_t repcount, uint_t flags);
+
+void
+i_ddi_rep_get16(ddi_acc_impl_t *hdlp, uint16_t *host_addr, uint16_t *dev_addr,
+ size_t repcount, uint_t flags);
+
+void
+i_ddi_rep_get32(ddi_acc_impl_t *hdlp, uint32_t *host_addr, uint32_t *dev_addr,
+ size_t repcount, uint_t flags);
+
+void
+i_ddi_rep_get64(ddi_acc_impl_t *hdlp, uint64_t *host_addr, uint64_t *dev_addr,
+ size_t repcount, uint_t flags);
+
+void
+i_ddi_swap_rep_get16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
+ uint16_t *dev_addr, size_t repcount, uint_t flags);
+
+void
+i_ddi_swap_rep_get32(ddi_acc_impl_t *hdlp, uint32_t *host_addr,
+ uint32_t *dev_addr, size_t repcount, uint_t flags);
+
+void
+i_ddi_swap_rep_get64(ddi_acc_impl_t *hdlp, uint64_t *host_addr,
+ uint64_t *dev_addr, size_t repcount, uint_t flags);
+
+/*
+ * Repeated output functions for memory mapped IO
+ */
+void
+i_ddi_rep_put8(ddi_acc_impl_t *hdlp, uint8_t *host_addr, uint8_t *dev_addr,
+ size_t repcount, uint_t flags);
+
+void
+i_ddi_rep_put16(ddi_acc_impl_t *hdlp, uint16_t *host_addr, uint16_t *dev_addr,
+ size_t repcount, uint_t flags);
+
+void
+i_ddi_rep_put32(ddi_acc_impl_t *hdl, uint32_t *host_addr, uint32_t *dev_addr,
+ size_t repcount, uint_t flags);
+
+void
+i_ddi_rep_put64(ddi_acc_impl_t *hdl, uint64_t *host_addr, uint64_t *dev_addr,
+ size_t repcount, uint_t flags);
+
+void
+i_ddi_swap_rep_put16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
+ uint16_t *dev_addr, size_t repcount, uint_t flags);
+
+void
+i_ddi_swap_rep_put32(ddi_acc_impl_t *hdl, uint32_t *host_addr,
+ uint32_t *dev_addr, size_t repcount, uint_t flags);
+
+void
+i_ddi_swap_rep_put64(ddi_acc_impl_t *hdl, uint64_t *host_addr,
+ uint64_t *dev_addr, size_t repcount, uint_t flags);
+
+/*
+ * Default fault-checking and notification functions
+ */
+int
+i_ddi_acc_fault_check(ddi_acc_impl_t *hdlp);
+
+void
+i_ddi_acc_fault_notify(ddi_acc_impl_t *hdlp);
+
+/* DDI Fault Services functions */
+
+void i_ddi_caut_get(size_t size, void *addr, void *val);
+
+uint8_t i_ddi_prot_get8(ddi_acc_impl_t *hdlp, uint8_t *addr);
+uint16_t i_ddi_prot_get16(ddi_acc_impl_t *hdlp, uint16_t *addr);
+uint32_t i_ddi_prot_get32(ddi_acc_impl_t *hdlp, uint32_t *addr);
+uint64_t i_ddi_prot_get64(ddi_acc_impl_t *hdlp, uint64_t *addr);
+
+void i_ddi_prot_put8(ddi_acc_impl_t *hdlp, uint8_t *addr, uint8_t value);
+void i_ddi_prot_put16(ddi_acc_impl_t *hdlp, uint16_t *addr, uint16_t value);
+void i_ddi_prot_put32(ddi_acc_impl_t *hdlp, uint32_t *addr, uint32_t value);
+void i_ddi_prot_put64(ddi_acc_impl_t *hdlp, uint64_t *addr, uint64_t value);
+
+void i_ddi_prot_rep_get8(ddi_acc_impl_t *hdlp, uint8_t *host_addr,
+ uint8_t *dev_addr, size_t repcount, uint_t flags);
+void i_ddi_prot_rep_get16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
+ uint16_t *dev_addr, size_t repcount, uint_t flags);
+void i_ddi_prot_rep_get32(ddi_acc_impl_t *hdlp, uint32_t *host_addr,
+ uint32_t *dev_addr, size_t repcount, uint_t flags);
+void i_ddi_prot_rep_get64(ddi_acc_impl_t *hdlp, uint64_t *host_addr,
+ uint64_t *dev_addr, size_t repcount, uint_t flags);
+
+void i_ddi_prot_rep_put8(ddi_acc_impl_t *hdlp, uint8_t *host_addr,
+ uint8_t *dev_addr, size_t repcount, uint_t flags);
+void i_ddi_prot_rep_put16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
+ uint16_t *dev_addr, size_t repcount, uint_t flags);
+void i_ddi_prot_rep_put32(ddi_acc_impl_t *hdl, uint32_t *host_addr,
+ uint32_t *dev_addr, size_t repcount, uint_t flags);
+void i_ddi_prot_rep_put64(ddi_acc_impl_t *hdl, uint64_t *host_addr,
+ uint64_t *dev_addr, size_t repcount, uint_t flags);
+
+uint8_t i_ddi_caut_get8(ddi_acc_impl_t *hdlp, uint8_t *addr);
+uint16_t i_ddi_caut_get16(ddi_acc_impl_t *hdlp, uint16_t *addr);
+uint32_t i_ddi_caut_get32(ddi_acc_impl_t *hdlp, uint32_t *addr);
+uint64_t i_ddi_caut_get64(ddi_acc_impl_t *hdlp, uint64_t *addr);
+
+void i_ddi_caut_put8(ddi_acc_impl_t *hdlp, uint8_t *addr, uint8_t value);
+void i_ddi_caut_put16(ddi_acc_impl_t *hdlp, uint16_t *addr, uint16_t value);
+void i_ddi_caut_put32(ddi_acc_impl_t *hdlp, uint32_t *addr, uint32_t value);
+void i_ddi_caut_put64(ddi_acc_impl_t *hdlp, uint64_t *addr, uint64_t value);
+
+void i_ddi_caut_rep_get8(ddi_acc_impl_t *hdlp, uint8_t *host_addr,
+ uint8_t *dev_addr, size_t repcount, uint_t flags);
+void i_ddi_caut_rep_get16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
+ uint16_t *dev_addr, size_t repcount, uint_t flags);
+void i_ddi_caut_rep_get32(ddi_acc_impl_t *hdlp, uint32_t *host_addr,
+ uint32_t *dev_addr, size_t repcount, uint_t flags);
+void i_ddi_caut_rep_get64(ddi_acc_impl_t *hdlp, uint64_t *host_addr,
+ uint64_t *dev_addr, size_t repcount, uint_t flags);
+
+void i_ddi_caut_rep_put8(ddi_acc_impl_t *hdlp, uint8_t *host_addr,
+ uint8_t *dev_addr, size_t repcount, uint_t flags);
+void i_ddi_caut_rep_put16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
+ uint16_t *dev_addr, size_t repcount, uint_t flags);
+void i_ddi_caut_rep_put32(ddi_acc_impl_t *hdl, uint32_t *host_addr,
+ uint32_t *dev_addr, size_t repcount, uint_t flags);
+void i_ddi_caut_rep_put64(ddi_acc_impl_t *hdl, uint64_t *host_addr,
+ uint64_t *dev_addr, size_t repcount, uint_t flags);
+
+#endif /* _KERNEL */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_DDI_ISA_H */
diff --git a/usr/src/uts/sparc/sys/fasttrap_isa.h b/usr/src/uts/sparc/sys/fasttrap_isa.h
new file mode 100644
index 0000000000..10361cbed8
--- /dev/null
+++ b/usr/src/uts/sparc/sys/fasttrap_isa.h
@@ -0,0 +1,94 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _FASTTRAP_ISA_H
+#define _FASTTRAP_ISA_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This is our reserved trap instruction: ta 0x38
+ */
+#define FASTTRAP_INSTR 0x91d02038
+
+#define FASTTRAP_SUNWDTRACE_SIZE 128
+
+typedef uint32_t fasttrap_instr_t;
+
+typedef struct fasttrap_machtp {
+ fasttrap_instr_t ftmt_instr; /* original instruction */
+ uintptr_t ftmt_dest; /* destination of DCTI */
+ uint8_t ftmt_type; /* emulation type */
+ uint8_t ftmt_flags; /* emulation flags */
+ uint8_t ftmt_cc; /* which cc to look at */
+ uint8_t ftmt_code; /* branch condition */
+} fasttrap_machtp_t;
+
+#define ftt_instr ftt_mtp.ftmt_instr
+#define ftt_dest ftt_mtp.ftmt_dest
+#define ftt_type ftt_mtp.ftmt_type
+#define ftt_flags ftt_mtp.ftmt_flags
+#define ftt_cc ftt_mtp.ftmt_cc
+#define ftt_code ftt_mtp.ftmt_code
+
+#define FASTTRAP_T_COMMON 0x00 /* common case -- no emulation */
+#define FASTTRAP_T_CCR 0x01 /* integer condition code branch */
+#define FASTTRAP_T_FCC 0x02 /* floating-point branch */
+#define FASTTRAP_T_REG 0x03 /* register predicated branch */
+#define FASTTRAP_T_ALWAYS 0x04 /* branch always */
+#define FASTTRAP_T_CALL 0x05 /* call instruction */
+#define FASTTRAP_T_JMPL 0x06 /* jmpl instruction */
+#define FASTTRAP_T_RDPC 0x07 /* rdpc instruction */
+#define FASTTRAP_T_RETURN 0x08 /* return instruction */
+
+/*
+ * For performance rather than correctness.
+ */
+#define FASTTRAP_T_SAVE 0x10 /* save instruction (func entry only) */
+#define FASTTRAP_T_RESTORE 0x11 /* restore instruction */
+#define FASTTRAP_T_OR 0x12 /* mov instruction */
+#define FASTTRAP_T_SETHI 0x13 /* sethi instruction (includes nop) */
+
+#define FASTTRAP_F_ANNUL 0x01 /* branch is annulled */
+#define FASTTRAP_F_RETMAYBE 0x02 /* not definitely a return site */
+
+#define FASTTRAP_AFRAMES 3
+#define FASTTRAP_RETURN_AFRAMES 4
+#define FASTTRAP_ENTRY_AFRAMES 3
+#define FASTTRAP_OFFSET_AFRAMES 3
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FASTTRAP_ISA_H */
diff --git a/usr/src/uts/sparc/sys/fpu/fpu_simulator.h b/usr/src/uts/sparc/sys/fpu/fpu_simulator.h
new file mode 100644
index 0000000000..4242c7e095
--- /dev/null
+++ b/usr/src/uts/sparc/sys/fpu/fpu_simulator.h
@@ -0,0 +1,478 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_FPU_FPU_SIMULATOR_H
+#define _SYS_FPU_FPU_SIMULATOR_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+/* SunOS-4.0 1.10 */
+
+/*
+ * sparc floating-point simulator definitions.
+ */
+
+#ifndef _ASM
+#include <sys/types.h>
+#include <sys/ieeefp.h>
+#include <vm/seg.h>
+#include <sys/kstat.h>
+#endif /* _ASM */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Constants to decode/extract "fitos" instruction fields
+ */
+#define FITOS_INSTR_MASK 0xc1f83fe0
+#define FITOS_INSTR 0x81a01880
+#define FITOS_RS2_SHIFT 0
+#define FITOS_RD_SHIFT 25
+#define FITOS_REG_MASK 0x1f
+
+#ifndef _ASM
+/* PUBLIC TYPES */
+
+enum fcc_type { /* relationships */
+ fcc_equal = 0,
+ fcc_less = 1,
+ fcc_greater = 2,
+ fcc_unordered = 3
+};
+
+enum cc_type { /* icc/fcc number */
+ fcc_0 = 0,
+ fcc_1 = 1,
+ fcc_2 = 2,
+ fcc_3 = 3,
+ icc = 4,
+ xcc = 6
+};
+
+/* FSR types. */
+
+enum ftt_type { /* types of traps */
+ ftt_none = 0,
+ ftt_ieee = 1,
+ ftt_unfinished = 2,
+ ftt_unimplemented = 3,
+ ftt_sequence = 4,
+ ftt_alignment = 5, /* defined by software convention only */
+ ftt_fault = 6, /* defined by software convention only */
+ ftt_7 = 7
+};
+
+typedef struct { /* sparc V9 FSR. */
+ unsigned int : 26;
+ unsigned int fcc3 : 2; /* fp condition code 3 */
+ unsigned int fcc2 : 2; /* fp condition code 2 */
+ unsigned int fcc1 : 2; /* fp condition code 1 */
+ /* enum fp_direction_type */
+ unsigned int rnd : 2; /* rounding direction */
+ unsigned int rnp : 2; /* for v7 compatibility only */
+ unsigned int tem : 5; /* trap enable mask */
+ unsigned int ns : 1; /* non-standard */
+ unsigned int : 5;
+ /* enum ftt_type */
+ unsigned int ftt : 3; /* FPU trap type */
+ unsigned int qne : 1; /* FPQ not empty */
+ unsigned int pr : 1; /* partial result */
+ /* enum fcc_type */
+ unsigned int fcc : 2; /* fp condition code 0 */
+ unsigned int aexc : 5; /* accumulated exceptions */
+ unsigned int cexc : 5; /* current exception */
+} fsr_types;
+
+/*
+ * The C compiler and the C spec do not support bitfields in a long long,
+ * as per fsr_types above, so don't hold your breath waiting for this
+ * workaround cruft to disappear.
+ */
+
+typedef union {
+ fsr_types fsr;
+ uint64_t ll;
+} fsr_type;
+
+#define fcc3 fsr.fcc3
+#define fcc2 fsr.fcc2
+#define fcc1 fsr.fcc1
+#define fcc0 fsr.fcc
+#define rnd fsr.rnd
+#define rnp fsr.rnp
+#define tem fsr.tem
+#define aexc fsr.aexc
+#define cexc fsr.cexc
+
+typedef /* FPU register viewed as single components. */
+ struct {
+ uint32_t sign : 1;
+ uint32_t exponent : 8;
+ uint32_t significand : 23;
+} single_type;
+
+typedef /* FPU register viewed as double components. */
+ struct {
+ uint32_t sign : 1;
+ uint32_t exponent : 11;
+ uint32_t significand : 20;
+} double_type;
+
+typedef /* FPU register viewed as extended components. */
+ struct {
+ uint32_t sign : 1;
+ uint32_t exponent : 15;
+ uint32_t significand : 16;
+} extended_type;
+
+typedef /* FPU register with multiple data views. */
+ union {
+ int32_t int32_reg;
+ int64_t int64_reg;
+ uint32_t uint32_reg;
+ uint64_t uint64_reg;
+ float float_reg;
+ single_type single_reg;
+ double_type double_reg;
+ extended_type extended_reg;
+} freg_type;
+
+enum fp_op_type { /* Type specifiers in FPU instructions. */
+ fp_op_int32 = 0, /* Not in hardware, but convenient to define. */
+ fp_op_single = 1,
+ fp_op_double = 2,
+ fp_op_extended = 3,
+ fp_op_int64 = 4
+};
+
+enum fp_opcode { /* FPU op codes, minus precision and leading 0. */
+ fmovs = 0x0,
+ fnegs = 0x1,
+ fabss = 0x2,
+ fp_op_3 = 3, fp_op_4 = 4, fp_op_5 = 5, fp_op_6 = 6, fp_op_7 = 7,
+ fp_op_8 = 0x8,
+ fp_op_9 = 0x9,
+ fsqrt = 0xa,
+ fp_op_b = 0xb, fp_op_c = 0xc, fp_op_d = 0xd,
+ fp_op_e = 0xe, fp_op_f = 0xf,
+ fadd = 0x10,
+ fsub = 0x11,
+ fmul = 0x12,
+ fdiv = 0x13,
+ fcmp = 0x14,
+ fcmpe = 0x15,
+ fp_op_16 = 0x16, fp_op_17 = 0x17,
+ fp_op_18 = 0x18,
+ fp_op_19 = 0x19,
+ fsmuld = 0x1a,
+ fdmulx = 0x1b,
+ ftoll = 0x20,
+ flltos = 0x21,
+ flltod = 0x22,
+ flltox = 0x23,
+ fp_op_24 = 0x24, fp_op_25 = 0x25, fp_op_26 = 0x26, fp_op_27 = 0x27,
+ fp_op_28 = 0x28, fp_op_29 = 0x29, fp_op_2a = 0x2a, fp_op_2b = 0x2b,
+ fp_op_2c = 0x2c, fp_op_2d = 0x2d, fp_op_2e = 0x2e, fp_op_2f = 0x2f,
+ fp_op_30 = 0x30,
+ fitos = 0x31,
+ fitod = 0x32,
+ fitox = 0x33,
+ ftoi = 0x34,
+ fp_op_35 = 0x35, fp_op_36 = 0x36, fp_op_37 = 0x37,
+ ft_op_38 = 0x38,
+ fp_op_39 = 0x39, fp_op_3a = 0x3a, fp_op_3b = 0x3b,
+ fp_op_3c = 0x3c,
+ fp_op_3d = 0x3d, fp_op_3e = 0x3e, fp_op_3f = 0x3f
+};
+
+typedef /* FPU instruction. */
+ struct {
+ uint32_t hibits : 2; /* Top two bits. */
+ uint32_t rd : 5; /* Destination. */
+ uint32_t op3 : 6; /* Main op code. */
+ uint32_t rs1 : 5; /* First operand. */
+ uint32_t ibit : 1; /* I format bit. */
+ uint32_t /* enum fp_opcode */ opcode : 6; /* Floating-point op code. */
+ uint32_t /* enum fp_op_type */ prec : 2; /* Precision. */
+ uint32_t rs2 : 5; /* Second operand. */
+} fp_inst_type;
+
+typedef /* Integer condition code. */
+ struct {
+ uint32_t : 28; /* the unused part */
+ uint32_t n : 1; /* Negative bit. */
+ uint32_t z : 1; /* Zero bit. */
+ uint32_t v : 1; /* Overflow bit. */
+ uint32_t c : 1; /* Carry bit. */
+} ccr_type;
+
+typedef /* FPU data used by simulator. */
+ struct {
+ uint_t fp_fsrtem;
+ enum fp_direction_type fp_direction;
+ enum fp_precision_type fp_precision;
+ uint_t fp_current_exceptions;
+ kfpu_t *fp_current_pfregs;
+ void (*fp_current_read_freg) ();
+ void (*fp_current_write_freg) ();
+ void (*fp_current_read_dreg) ();
+ void (*fp_current_write_dreg) ();
+ uint64_t (*get_gsr) (kfpu_t *);
+ uint_t (*get_ccr) ();
+ uint_t (*get_pstate) ();
+ void (*set_gsr) (uint64_t, kfpu_t *);
+ void (*set_ccr) (uint_t);
+ int fp_trapcode;
+ char *fp_trapaddr;
+ struct regs *fp_traprp;
+ enum seg_rw fp_traprw;
+} fp_simd_type;
+
+/*
+ * FPU related kstat structures
+ */
+struct fpustat_kstat {
+ struct kstat_named fpu_ieee_traps;
+ struct kstat_named fpu_unfinished_traps;
+ struct kstat_named fpu_unimplemented_traps;
+};
+
+struct fpuinfo_kstat {
+ struct kstat_named fpu_sim_fmovs;
+ struct kstat_named fpu_sim_fmovd;
+ struct kstat_named fpu_sim_fmovq;
+ struct kstat_named fpu_sim_fnegs;
+ struct kstat_named fpu_sim_fnegd;
+ struct kstat_named fpu_sim_fnegq;
+ struct kstat_named fpu_sim_fabss;
+ struct kstat_named fpu_sim_fabsd;
+ struct kstat_named fpu_sim_fabsq;
+ struct kstat_named fpu_sim_fsqrts;
+ struct kstat_named fpu_sim_fsqrtd;
+ struct kstat_named fpu_sim_fsqrtq;
+ struct kstat_named fpu_sim_fadds;
+ struct kstat_named fpu_sim_faddd;
+ struct kstat_named fpu_sim_faddq;
+ struct kstat_named fpu_sim_fsubs;
+ struct kstat_named fpu_sim_fsubd;
+ struct kstat_named fpu_sim_fsubq;
+ struct kstat_named fpu_sim_fmuls;
+ struct kstat_named fpu_sim_fmuld;
+ struct kstat_named fpu_sim_fmulq;
+ struct kstat_named fpu_sim_fdivs;
+ struct kstat_named fpu_sim_fdivd;
+ struct kstat_named fpu_sim_fdivq;
+ struct kstat_named fpu_sim_fcmps;
+ struct kstat_named fpu_sim_fcmpd;
+ struct kstat_named fpu_sim_fcmpq;
+ struct kstat_named fpu_sim_fcmpes;
+ struct kstat_named fpu_sim_fcmped;
+ struct kstat_named fpu_sim_fcmpeq;
+ struct kstat_named fpu_sim_fsmuld;
+ struct kstat_named fpu_sim_fdmulx;
+ struct kstat_named fpu_sim_fstox;
+ struct kstat_named fpu_sim_fdtox;
+ struct kstat_named fpu_sim_fqtox;
+ struct kstat_named fpu_sim_fxtos;
+ struct kstat_named fpu_sim_fxtod;
+ struct kstat_named fpu_sim_fxtoq;
+ struct kstat_named fpu_sim_fitos;
+ struct kstat_named fpu_sim_fitod;
+ struct kstat_named fpu_sim_fitoq;
+ struct kstat_named fpu_sim_fstoi;
+ struct kstat_named fpu_sim_fdtoi;
+ struct kstat_named fpu_sim_fqtoi;
+ struct kstat_named fpu_sim_fmovcc;
+ struct kstat_named fpu_sim_fmovr;
+};
+
+struct visinfo_kstat {
+ struct kstat_named vis_edge8;
+ struct kstat_named vis_edge8n;
+ struct kstat_named vis_edge8l;
+ struct kstat_named vis_edge8ln;
+ struct kstat_named vis_edge16;
+ struct kstat_named vis_edge16n;
+ struct kstat_named vis_edge16l;
+ struct kstat_named vis_edge16ln;
+ struct kstat_named vis_edge32;
+ struct kstat_named vis_edge32n;
+ struct kstat_named vis_edge32l;
+ struct kstat_named vis_edge32ln;
+ struct kstat_named vis_array8;
+ struct kstat_named vis_array16;
+ struct kstat_named vis_array32;
+ struct kstat_named vis_bmask;
+ struct kstat_named vis_fcmple16;
+ struct kstat_named vis_fcmpne16;
+ struct kstat_named vis_fcmpgt16;
+ struct kstat_named vis_fcmpeq16;
+ struct kstat_named vis_fcmple32;
+ struct kstat_named vis_fcmpne32;
+ struct kstat_named vis_fcmpgt32;
+ struct kstat_named vis_fcmpeq32;
+ struct kstat_named vis_fmul8x16;
+ struct kstat_named vis_fmul8x16au;
+ struct kstat_named vis_fmul8x16al;
+ struct kstat_named vis_fmul8sux16;
+ struct kstat_named vis_fmul8ulx16;
+ struct kstat_named vis_fmuld8sux16;
+ struct kstat_named vis_fmuld8ulx16;
+ struct kstat_named vis_fpack16;
+ struct kstat_named vis_fpack32;
+ struct kstat_named vis_fpackfix;
+ struct kstat_named vis_fexpand;
+ struct kstat_named vis_fpmerge;
+ struct kstat_named vis_pdist;
+ struct kstat_named vis_bshuffle;
+};
+
+#define VISINFO_KSTAT(opcode) { \
+ extern void __dtrace_probe___visinfo_##opcode(uint64_t *); \
+ uint64_t *stataddr = &visinfo.opcode.value.ui64; \
+ __dtrace_probe___visinfo_##opcode(stataddr); \
+ atomic_add_64(&visinfo.opcode.value.ui64, 1); \
+}
+
+
+/* PUBLIC FUNCTIONS */
+
+#ifdef __STDC__
+
+/*
+ * fpu_vis_sim simulates FPU VIS Partial load store instructions; reads and
+ * writes FPU data registers directly or works with the PCB image if fpu_exists
+ * is 0.
+ */
+extern enum ftt_type fpu_vis_sim(fp_simd_type *pfpsd, fp_inst_type *pinst,
+ struct regs *pregs, fsr_type *pfsr, uint64_t gsr, uint32_t inst);
+/*
+ * fpu_simulator simulates FPU instructions only; reads and writes FPU data
+ * registers directly.
+ */
+extern enum ftt_type fpu_simulator(fp_simd_type *pfpsd, fp_inst_type *pinst,
+ fsr_type *pfsr, uint64_t gsr, uint32_t inst);
+/*
+ * fp_emulator simulates FPU and CPU-FPU instructions; reads and writes FPU
+ * data registers from image in pfpu.
+ */
+extern enum ftt_type fp_emulator(fp_simd_type *pfpsd, fp_inst_type *pinst,
+ struct regs *rp, void *prw, kfpu_t *pfpu);
+/*
+ * fp_traps handles passing exception conditions to the kernel.
+ * It is called after fp_simulator or fp_emulator fail (return a non-zero ftt).
+ */
+extern void fp_traps(fp_simd_type *pfpsd, enum ftt_type ftt, struct regs *rp);
+
+/*
+ * fp_kstat_update tracks fpu exception conditions.
+ * It is called after a hardware trap returns a non-zero ftt.
+ */
+extern void fp_kstat_update(enum ftt_type ftt);
+
+/*
+ * fp_precise handles floating point unimplemented and unfinished traps,
+ * for sparc V9 hardware. These traps are normally passed along to the
+ * fpu_simulator, to see if it can run the unimplemented instruction or
+ * finish the unfinished instruction. Needless to say, this takes time.
+ */
+extern void fp_precise(struct regs *rp);
+
+/*
+ * fpu_trap handles V9 floating point ieee and other floating point traps.
+ * It is called after fp_simulator or fp_emulator fail (return a non-zero ftt),
+ * and from the _fp_ieee_exception trap handler.
+ */
+extern void fpu_trap(struct regs *rp, caddr_t addr, uint32_t type,
+ uint32_t code);
+
+#else /* ! __STDC__ */
+
+/*
+ * fpu_simulator simulates FPU instructions only; reads and writes FPU data
+ * registers directly.
+ */
+extern enum ftt_type fpu_simulator(
+ fp_simd_type *pfpsd, /* Pointer to FPU simulator data */
+ fp_inst_type *pinst, /* Pointer to FPU instruction to simulate. */
+ fsr_type *pfsr, /* Pointer to image of FSR to read & write. */
+ int instr); /* Instruction to emulate. */
+
+/*
+ * fp_emulator simulates FPU and CPU-FPU instructions; reads and writes FPU
+ * data registers from image in pfpu.
+ */
+extern enum ftt_type fp_emulator(
+ fp_simd_type *pfpsd, /* Pointer to FPU simulator data */
+ fp_inst_type *pinst, /* Pointer to FPU instruction to simulate. */
+ struct regs *pregs, /* Pointer to PCB image of registers. */
+ struct rwindow *pwindow, /* Pointer to locals and ins. */
+ struct fpu *pfpu); /* Pointer to FPU register block. */
+
+/*
+ * fp_traps handles passing exception conditions to the kernel.
+ * It is called after fp_simulator or fp_emulator fail (return a non-zero ftt).
+ */
+extern void fp_traps(
+ fp_simd_type *pfpsd, /* Pointer to FPU simulator data */
+ enum ftt_type ftt, /* Type of trap. */
+ struct regs *rp); /* Pointer to PCB image of registers. */
+
+/*
+ * fp_kstat_update tracks fpu exception conditions.
+ * It is called after a hardware trap returns a non-zero ftt.
+ */
+extern void fp_kstat_update(enum ftt_type ftt); /* Type of trap. */
+
+/*
+ * fp_precise handles floating point unimplemented and unfinished traps,
+ * for sparc V9 hardware. These traps are normally passed along to the
+ * fpu_simulator, to see if it can run the unimplemented instruction or
+ * finish the unfinished instruction. Needless to say, this takes time.
+ */
+extern void fp_precise(
+ struct regs *rp); /* Pointer to PCB image of registers. */
+
+/*
+ * fpu_trap handles V9 floating point ieee and other floating point traps.
+ * It is called after fp_simulator or fp_emulator fail (return a non-zero ftt),
+ * and from the _fp_ieee_exception trap handler.
+ */
+extern void fpu_trap(
+ struct regs *rp, /* Pointer to PCB image of registers. */
+ caddr_t addr, /* Address of trapping instruction. */
+ uint32_t type, /* Type of trapping exception. */
+ uint32_t code); /* Trap code -> si_code. */
+
+#endif /* __STDC__ */
+#endif /* _ASM */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_FPU_FPU_SIMULATOR_H */
diff --git a/usr/src/uts/sparc/sys/fpu/fpusystm.h b/usr/src/uts/sparc/sys/fpu/fpusystm.h
new file mode 100644
index 0000000000..5ca75f278a
--- /dev/null
+++ b/usr/src/uts/sparc/sys/fpu/fpusystm.h
@@ -0,0 +1,96 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_FPU_FPUSYSTM_H
+#define _SYS_FPU_FPUSYSTM_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ISA-dependent FPU interfaces
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _KERNEL
+
+struct fpu;
+struct regs;
+
+#if !defined(DEBUG) && !defined(NEED_FPU_EXISTS)
+#define fpu_exists 1
+#else
+extern int fpu_exists;
+#endif
+
+extern int fpu_version;
+extern int fpdispr;
+
+extern void fpu_probe(void);
+extern void fp_disable(void);
+extern void fp_disabled(struct regs *);
+extern void fp_clearregs(kfpu_t *);
+extern void fp_enable(void);
+extern void fp_fksave(kfpu_t *);
+extern void fp_runq(struct regs *);
+extern void fp_load(kfpu_t *);
+extern void fp_save(kfpu_t *);
+extern void fp_restore(kfpu_t *);
+extern void run_fpq(klwp_t *, fpregset_t *);
+extern void syncfpu(void);
+extern void _fp_read_pfsr(uint64_t *fsr);
+extern void _fp_write_pfsr(uint64_t *);
+extern void _fp_read_pfreg(uint32_t *, uint_t);
+extern void _fp_write_pfreg(uint32_t *, uint_t);
+extern void fp_free(kfpu_t *, int);
+extern void fp_fork(klwp_t *, klwp_t *);
+extern void fp_v8_load(kfpu_t *);
+extern void fp_v8p_load(kfpu_t *);
+extern void fp_v8_fksave(kfpu_t *);
+extern void fp_v8p_fksave(kfpu_t *);
+extern uint32_t _fp_read_fprs(void);
+extern void _fp_write_fprs(uint32_t);
+extern void save_gsr(kfpu_t *);
+extern void restore_gsr(kfpu_t *);
+extern uint64_t get_gsr(kfpu_t *);
+extern void set_gsr(uint64_t, kfpu_t *);
+extern uint64_t get_phys_gsr(kfpu_t *);
+extern void set_phys_gsr(uint64_t, kfpu_t *);
+extern uint_t get_pstate();
+extern uint_t get_ccr();
+extern void set_ccr(uint_t);
+extern void _fp_read_pdreg(uint64_t *, uint_t);
+extern void _fp_write_pdreg(uint64_t *, uint_t);
+
+#endif /* _KERNEL */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_FPU_FPUSYSTM_H */
diff --git a/usr/src/uts/sparc/sys/fpu/globals.h b/usr/src/uts/sparc/sys/fpu/globals.h
new file mode 100644
index 0000000000..e1f292c6a1
--- /dev/null
+++ b/usr/src/uts/sparc/sys/fpu/globals.h
@@ -0,0 +1,141 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_FPU_GLOBALS_H
+#define _SYS_FPU_GLOBALS_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Sparc floating-point simulator PRIVATE include file.
+ */
+
+#include <sys/types.h>
+#include <vm/seg.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* PRIVATE CONSTANTS */
+
+#define INTEGER_BIAS 31
+#define LONGLONG_BIAS 63
+#define SINGLE_BIAS 127
+#define DOUBLE_BIAS 1023
+#define EXTENDED_BIAS 16383
+
+/* PRIVATE TYPES */
+
+#define DOUBLE_E(n) (n & 0xfffe) /* More significant word of double. */
+#define DOUBLE_F(n) (1+DOUBLE_E(n)) /* Less significant word of double. */
+#define EXTENDED_E(n) (n & 0xfffc) /* Sign/exponent/significand of extended. */
+#define EXTENDED_F(n) (1+EXTENDED_E(n)) /* 2nd word of extended significand. */
+#define EXTENDED_G(n) (2+EXTENDED_E(n)) /* 3rd word of extended significand. */
+#define EXTENDED_H(n) (3+EXTENDED_E(n)) /* 4th word of extended significand. */
+#define DOUBLE(n) ((n & 0xfffe) >> 1) /* Shift n to access double regs. */
+#define QUAD_E(n) ((n & 0xfffc) >> 1) /* More significant half of quad. */
+#define QUAD_F(n) (1+QUAD_E(n)) /* Less significant half of quad. */
+
+
+#if defined(_KERNEL)
+
+typedef struct {
+ int sign;
+ enum fp_class_type fpclass;
+ int exponent; /* Unbiased exponent */
+ uint_t significand[4]; /* Four significand word . */
+ int rounded; /* rounded bit */
+ int sticky; /* stick bit */
+} unpacked;
+
+
+/*
+ * PRIVATE FUNCTIONS
+ * pfreg routines use "physical" FPU registers, in fpusystm.h.
+ * vfreg routines use "virtual" FPU registers at *_fp_current_pfregs.
+ */
+
+extern void _fp_read_vfreg(FPU_REGS_TYPE *, uint_t, fp_simd_type *);
+extern void _fp_write_vfreg(FPU_REGS_TYPE *, uint_t, fp_simd_type *);
+extern void _fp_read_vdreg(FPU_DREGS_TYPE *, uint_t, fp_simd_type *);
+extern void _fp_write_vdreg(FPU_DREGS_TYPE *, uint_t, fp_simd_type *);
+
+extern enum ftt_type _fp_iu_simulator(fp_simd_type *, fp_inst_type,
+ struct regs *, void *, kfpu_t *);
+
+extern void _fp_unpack(fp_simd_type *, unpacked *, uint_t, enum fp_op_type);
+extern void _fp_pack(fp_simd_type *, unpacked *, uint_t, enum fp_op_type);
+extern void _fp_unpack_word(fp_simd_type *, uint32_t *, uint_t);
+extern void _fp_pack_word(fp_simd_type *, uint32_t *, uint_t);
+extern void _fp_unpack_extword(fp_simd_type *, uint64_t *, uint_t);
+extern void _fp_pack_extword(fp_simd_type *, uint64_t *, uint_t);
+extern enum ftt_type fmovcc(fp_simd_type *, fp_inst_type, fsr_type *);
+extern enum ftt_type fmovr(fp_simd_type *, fp_inst_type);
+extern enum ftt_type movcc(fp_simd_type *, fp_inst_type, struct regs *,
+ void *, kfpu_t *);
+extern enum ftt_type fldst(fp_simd_type *, fp_inst_type, struct regs *,
+ void *);
+extern void fpu_normalize(unpacked *);
+extern void fpu_rightshift(unpacked *, int);
+extern void fpu_set_exception(fp_simd_type *, enum fp_exception_type);
+extern void fpu_error_nan(fp_simd_type *, unpacked *);
+extern void unpacksingle(fp_simd_type *, unpacked *, single_type);
+extern void unpackdouble(fp_simd_type *, unpacked *, double_type, uint_t);
+extern uint_t fpu_add3wc(uint_t *, uint_t, uint_t, uint_t);
+extern uint_t fpu_sub3wc(uint_t *, uint_t, uint_t, uint_t);
+extern uint_t fpu_neg2wc(uint_t *, uint_t, uint_t);
+extern int fpu_cmpli(uint_t *, uint_t *, int);
+
+/* extern void _fp_product(uint_t, uint_t, uint_t *); */
+
+extern enum fcc_type _fp_compare(fp_simd_type *, unpacked *, unpacked *, int);
+
+extern void _fp_add(fp_simd_type *, unpacked *, unpacked *, unpacked *);
+extern void _fp_sub(fp_simd_type *, unpacked *, unpacked *, unpacked *);
+extern void _fp_mul(fp_simd_type *, unpacked *, unpacked *, unpacked *);
+extern void _fp_div(fp_simd_type *, unpacked *, unpacked *, unpacked *);
+extern void _fp_sqrt(fp_simd_type *, unpacked *, unpacked *);
+
+extern enum ftt_type _fp_write_word(uint32_t *, uint32_t, fp_simd_type *);
+extern enum ftt_type _fp_read_word(const uint32_t *, uint32_t *,
+ fp_simd_type *);
+extern enum ftt_type _fp_read_inst(const uint32_t *, uint32_t *,
+ fp_simd_type *);
+extern enum ftt_type _fp_write_extword(uint64_t *, uint64_t, fp_simd_type *);
+extern enum ftt_type _fp_read_extword(const uint64_t *, uint64_t *,
+ fp_simd_type *);
+extern enum ftt_type read_iureg(fp_simd_type *, uint_t, struct regs *,
+ void *, uint64_t *);
+extern enum ftt_type write_iureg(fp_simd_type *, uint_t, struct regs *,
+ void *, uint64_t *);
+#endif /* _KERNEL */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_FPU_GLOBALS_H */
diff --git a/usr/src/uts/sparc/sys/fpu/ieee.h b/usr/src/uts/sparc/sys/fpu/ieee.h
new file mode 100644
index 0000000000..b741911324
--- /dev/null
+++ b/usr/src/uts/sparc/sys/fpu/ieee.h
@@ -0,0 +1,124 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 1987 by Sun Microsystems, Inc.
+ * All rights reserved.
+ */
+
+#ifndef _SYS_FPU_IEEE_H
+#define _SYS_FPU_IEEE_H
+
+#pragma ident "%Z%%M% %I% %E% SMI" /* SunOS-4.0 1.4 */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Sparc IEEE floating-point support PUBLIC include file.
+ */
+
+/* PUBLIC TYPES */
+
+/*
+ * IEEE Arithmetic types... numbered to correspond to fsr fields.
+ */
+
+/*
+ * rounding direction
+ */
+enum fp_rounding_direction {
+ fp_rd_nearest = 0,
+ fp_rd_zero = 1,
+ fp_rd_plus = 2,
+ fp_rd_minus = 3
+};
+
+/*
+ * extended rounding precision
+ */
+enum fp_rounding_precision {
+ fp_rp_extended = 0,
+ fp_rp_single = 1,
+ fp_rp_double = 2,
+ fp_rp_3 = 3
+};
+
+/*
+ * exceptions according to cexc bit number
+ */
+enum fp_exception_type {
+ fp_inexact = 0,
+ fp_divide = 1,
+ fp_underflow = 2,
+ fp_overflow = 3,
+ fp_invalid = 4
+};
+
+/*
+ * floating-point classes according to fclass
+ */
+enum fp_class_type {
+ fp_zero = 0,
+ fp_normal = 1, /* Includes subnormal. */
+ fp_infinity = 2,
+ fp_nan = 3, /* Includes quiet and signaling NaN. */
+};
+
+
+/* PUBLIC GLOBAL VARIABLES */
+
+unsigned fp_accrued_exceptions; /* Sticky accumulated exceptions. */
+
+
+/* PUBLIC FUNCTIONS */
+
+#ifdef __STDC__
+
+extern enum
+fp_rounding_direction swap_rounding_direction(enum fp_rounding_direction);
+
+/* Change rounding mode; return previous. */
+
+extern int swap_accrued_exceptions(int);
+
+/* Change accrued exceptions; return previous. */
+
+#else /* __STDC__ */
+
+extern enum fp_rounding_direction swap_rounding_direction(/* rd */);
+/* extern enum fp_rounding_direction rd; */
+
+/* Change rounding mode; return previous. */
+
+extern int swap_accrued_exceptions(/* x */);
+/* int x; */
+
+/* Change accrued exceptions; return previous. */
+
+#endif /* ! __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_FPU_IEEE_H */
diff --git a/usr/src/uts/sparc/sys/frame.h b/usr/src/uts/sparc/sys/frame.h
new file mode 100644
index 0000000000..cbb95b875b
--- /dev/null
+++ b/usr/src/uts/sparc/sys/frame.h
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 1987-1997,2002-2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_FRAME_H
+#define _SYS_FRAME_H
+
+#pragma ident "%Z%%M% %I% %E% SMI" /* sys4-3.2L 1.1 */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Definition of the sparc stack frame (when it is pushed on the stack).
+ */
+struct frame {
+ long fr_local[8]; /* saved locals */
+ long fr_arg[6]; /* saved arguments [0 - 5] */
+ struct frame *fr_savfp; /* saved frame pointer */
+ long fr_savpc; /* saved program counter */
+#if !defined(__sparcv9)
+ char *fr_stret; /* struct return addr */
+#endif /* __sparcv9 */
+ long fr_argd[6]; /* arg dump area */
+ long fr_argx[1]; /* array of args past the sixth */
+};
+
+#ifdef _SYSCALL32
+/*
+ * Kernels view of a 32-bit stack frame
+ */
+struct frame32 {
+ int fr_local[8]; /* saved locals */
+ int fr_arg[6]; /* saved arguments [0 - 5] */
+ caddr32_t fr_savfp; /* saved frame pointer */
+ int fr_savpc; /* saved program counter */
+ caddr32_t fr_stret; /* struct return addr */
+ int fr_argd[6]; /* arg dump area */
+ int fr_argx[1]; /* array of args past the sixth */
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_FRAME_H */
diff --git a/usr/src/uts/sparc/sys/fsr.h b/usr/src/uts/sparc/sys/fsr.h
new file mode 100644
index 0000000000..a5ff873062
--- /dev/null
+++ b/usr/src/uts/sparc/sys/fsr.h
@@ -0,0 +1,151 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 1986 by Sun Microsystems, Inc.
+ */
+
+#ifndef _SYS_FSR_H
+#define _SYS_FSR_H
+
+#pragma ident "%Z%%M% %I% %E% SMI" /* from SunOS psl.h 1.2 */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Floating Point State Register (FSR)
+ *
+ * Notes:
+ * On v9 cpus, the fsr is 64b.
+ * On v7 and v8 cpus, it is 32b.
+ *
+ * FCC1 thru FCC3 are v9 only.
+ * RP is v7 only (v8 dropped extended precision).
+ * PR was dropped before v7.
+ *
+ * |------------------------------------------------------------------------|
+ * | --- | FCC3 | FCC2 | FCC1 |
+ * |---------------------------------------------------|------|------|------|
+ * 63 38 37 36 35 34 33 32
+ *
+ * |------------------------------------------------------------------------|
+ * | RD | RP | TEM | NS | --- | VER | FTT | QNE | PR | FCC0 | AEXC | CEXC |
+ * |-----|-----|-----|----|-----|-----|-----|-----|----|------|------|------|
+ * 31 30 29 28 27 23 22 21 20 19 17 16 14 13 12 11 10 9 5 4 0
+ */
+#define FSR_CEXC 0x0000001f /* Current Exception */
+#define FSR_AEXC 0x000003e0 /* ieee accrued exceptions */
+#define FSR_FCC 0x00000c00 /* Floating-point Condition Codes */
+#define FSR_PR 0x00001000 /* Partial Remainder */
+#define FSR_QNE 0x00002000 /* Queue not empty */
+#define FSR_FTT 0x0001c000 /* Floating-point Trap Type */
+#define FSR_VER 0x000e0000 /* fpu version */
+#define FSR_TEM 0x0f800000 /* ieee Trap Enable Mask */
+#define FSR_RP 0x30000000 /* Rounding Precision */
+#define FSR_RD 0xc0000000 /* Rounding Direction */
+#define FSR_VER_SHIFT 17 /* version shift */
+#define FSR_FCC1 0x00000003 /* fp condition codes set #1 */
+#define FSR_FCC2 0x0000000C /* fp condition codes set #2 */
+#define FSR_FCC3 0x00000030 /* fp condition codes set #3 */
+
+/*
+ * Definition of CEXC (Current EXCeption) bit field of fsr
+ */
+#define FSR_CEXC_NX 0x00000001 /* inexact */
+#define FSR_CEXC_DZ 0x00000002 /* divide-by-zero */
+#define FSR_CEXC_UF 0x00000004 /* underflow */
+#define FSR_CEXC_OF 0x00000008 /* overflow */
+#define FSR_CEXC_NV 0x00000010 /* invalid */
+
+/*
+ * Definition of AEXC (Accrued EXCeption) bit field of fsr
+ */
+#define FSR_AEXC_NX (0x1 << 5) /* inexact */
+#define FSR_AEXC_DZ (0x2 << 5) /* divide-by-zero */
+#define FSR_AEXC_UF (0x4 << 5) /* underflow */
+#define FSR_AEXC_OF (0x8 << 5) /* overflow */
+#define FSR_AEXC_NV (0x10 << 5) /* invalid */
+
+/*
+ * Definition of FTT (Floating-point Trap Type) field within the FSR
+ */
+#define FTT_NONE 0 /* no exceptions */
+#define FTT_IEEE 1 /* IEEE exception */
+#define FTT_UNFIN 2 /* unfinished fpop */
+#define FTT_UNIMP 3 /* unimplemented fpop */
+#define FTT_SEQ 4 /* sequence error */
+#define FTT_ALIGN 5 /* alignment, by software convention */
+#define FTT_DFAULT 6 /* data fault, by software convention */
+#define FSR_FTT_SHIFT 14 /* shift needed to justify ftt field */
+#define FSR_FTT_IEEE (FTT_IEEE << FSR_FTT_SHIFT)
+#define FSR_FTT_UNFIN (FTT_UNFIN << FSR_FTT_SHIFT)
+#define FSR_FTT_UNIMP (FTT_UNIMP << FSR_FTT_SHIFT)
+#define FSR_FTT_SEQ (FTT_SEQ << FSR_FTT_SHIFT)
+#define FSR_FTT_ALIGN (FTT_ALIGN << FSR_FTT_SHIFT)
+#define FSR_FTT_DFAULT (FTT_DFAULT << FSR_FTT_SHIFT)
+
+/*
+ * Definition of TEM (Trap Enable Mask) bit field of fsr
+ */
+#define FSR_TEM_NX (0x1 << 23) /* inexact */
+#define FSR_TEM_DZ (0x2 << 23) /* divide-by-zero */
+#define FSR_TEM_UF (0x4 << 23) /* underflow */
+#define FSR_TEM_OF (0x8 << 23) /* overflow */
+#define FSR_TEM_NV (0x10 << 23) /* invalid */
+
+/*
+ * Definition of RP (Rounding Precision) field of fsr
+ */
+#define RP_DBLEXT 0 /* double-extended */
+#define RP_SINGLE 1 /* single */
+#define RP_DOUBLE 2 /* double */
+#define RP_RESERVED 3 /* unused and reserved */
+
+/*
+ * Definition of RD (Rounding Direction) field of fsr
+ */
+#define RD_NEAR 0 /* nearest or even if tie */
+#define RD_ZER0 1 /* to zero */
+#define RD_POSINF 2 /* positive infinity */
+#define RD_NEGINF 3 /* negative infinity */
+
+
+/*
+ * Floating Point Registers State (FPRS)
+ * (For V9 only)
+ *
+ * |---------------|
+ * | FEF | DU | DL |
+ * |-----|----|----|
+ * 2 1 0
+ */
+#define FPRS_DL 0x1 /* dirty lower */
+#define FPRS_DU 0x2 /* dirty upper */
+#define FPRS_FEF 0x4 /* enable fp */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_FSR_H */
diff --git a/usr/src/uts/sparc/sys/inline.h b/usr/src/uts/sparc/sys/inline.h
new file mode 100644
index 0000000000..c8d78e6202
--- /dev/null
+++ b/usr/src/uts/sparc/sys/inline.h
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/* Copyright (c) 1988 AT&T */
+/* All Rights Reserved */
+
+
+/*
+ * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_INLINE_H
+#define _SYS_INLINE_H
+
+#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4 11.9 */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(CXREF) && !defined(__lint)
+
+/* asm inline replacement templates go here */
+
+#else
+
+/* extern function declarations go here */
+
+#endif /* !defined(CXREF) && !defined(__lint) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_INLINE_H */
diff --git a/usr/src/uts/sparc/sys/kdi_machimpl.h b/usr/src/uts/sparc/sys/kdi_machimpl.h
new file mode 100644
index 0000000000..a9c973ba7f
--- /dev/null
+++ b/usr/src/uts/sparc/sys/kdi_machimpl.h
@@ -0,0 +1,104 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_KDI_MACHIMPL_H
+#define _SYS_KDI_MACHIMPL_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <sys/modctl.h>
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Return codes from the kdi_xc_one op */
+#define KDI_XC_RES_ERR -1
+#define KDI_XC_RES_OK 0
+#define KDI_XC_RES_BUSY 1
+#define KDI_XC_RES_NACK 2
+
+struct regs;
+
+typedef struct kdi_mach {
+ /*
+ * Iterates through the CPUs in the ready set, invoking the
+ * caller-provided callback with the CPU ID of each one.
+ */
+ int (*mkdi_cpu_ready_iter)(int (*)(int, void *), void *);
+
+ /*
+ * Send a two-argument cross-call to a specific CPU.
+ */
+ int (*mkdi_xc_one)(int, void (*)(uintptr_t, uintptr_t),
+ uintptr_t, uintptr_t);
+
+ /*
+ * Used by the state-saving code, at TL=1, to determine the current
+ * CPU's ID. This routine may only use registers %g1 and %g2, and
+ * must return the result in %g1. %g7 will contain the return address.
+ */
+ void (*mkdi_cpu_index)(void);
+
+ /*
+ * Used by the trap handlers to retrieve TTEs for virtual addresses.
+ * This routine may use %g1-g6, and must return the result in %g1. %g7
+ * will contain the return address.
+ */
+ void (*mkdi_trap_vatotte)(void);
+
+ void (*mkdi_tickwait)(clock_t);
+ int (*mkdi_get_stick)(uint64_t *);
+
+ void (*mkdi_kernpanic)(struct regs *, uint_t);
+
+ void (*mkdi_cpu_init)(int, int, int, int);
+} kdi_mach_t;
+
+#define mkdi_cpu_ready_iter kdi_mach.mkdi_cpu_ready_iter
+#define mkdi_xc_one kdi_mach.mkdi_xc_one
+#define mkdi_cpu_index kdi_mach.mkdi_cpu_index
+#define mkdi_trap_vatotte kdi_mach.mkdi_trap_vatotte
+#define mkdi_tickwait kdi_mach.mkdi_tickwait
+#define mkdi_get_stick kdi_mach.mkdi_get_stick
+#define mkdi_kernpanic kdi_mach.mkdi_kernpanic
+#define mkdi_cpu_init kdi_mach.mkdi_cpu_init
+
+extern void kdi_cpu_index(void);
+extern void kdi_trap_vatotte(void);
+
+extern int kdi_watchdog_disable(void);
+extern void kdi_watchdog_restore(void);
+
+extern void kdi_tlb_page_lock(caddr_t, int);
+extern void kdi_tlb_page_unlock(caddr_t, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_KDI_MACHIMPL_H */
diff --git a/usr/src/uts/sparc/sys/machelf.h b/usr/src/uts/sparc/sys/machelf.h
new file mode 100644
index 0000000000..a31427c862
--- /dev/null
+++ b/usr/src/uts/sparc/sys/machelf.h
@@ -0,0 +1,183 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_MACHELF_H
+#define _SYS_MACHELF_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <sys/elf_SPARC.h>
+#ifndef _ASM
+#include <sys/elf.h>
+#include <sys/link.h> /* for Elf*_Dyn */
+#endif /* _ASM */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Make machine class dependent data types transparent to the common code
+ */
+#if defined(_ELF64) && !defined(_ELF32_COMPAT)
+
+#ifndef _ASM
+typedef Elf64_Xword Xword;
+typedef Elf64_Lword Lword;
+typedef Elf64_Sxword Sxword;
+typedef Elf64_Word Word;
+typedef Elf64_Sword Sword;
+typedef Elf64_Half Half;
+typedef Elf64_Addr Addr;
+typedef Elf64_Off Off;
+typedef unsigned char Byte;
+#endif /* _ASM */
+
+#if defined(_KERNEL)
+#define ELF_R_TYPE ELF64_R_TYPE
+#define ELF_R_SYM ELF64_R_SYM
+#define ELF_R_TYPE_DATA ELF64_R_TYPE_DATA
+#define ELF_R_INFO ELF64_R_INFO
+#define ELF_ST_BIND ELF64_ST_BIND
+#define ELF_ST_TYPE ELF64_ST_TYPE
+#define ELF_M_SYM ELF64_M_SYM
+#define ELF_M_SIZE ELF64_M_SIZE
+#endif
+
+#ifndef _ASM
+typedef Elf64_Ehdr Ehdr;
+typedef Elf64_Shdr Shdr;
+typedef Elf64_Sym Sym;
+typedef Elf64_Syminfo Syminfo;
+typedef Elf64_Rela Rela;
+typedef Elf64_Rel Rel;
+typedef Elf64_Nhdr Nhdr;
+typedef Elf64_Phdr Phdr;
+typedef Elf64_Dyn Dyn;
+typedef Elf64_Boot Boot;
+typedef Elf64_Verdef Verdef;
+typedef Elf64_Verdaux Verdaux;
+typedef Elf64_Verneed Verneed;
+typedef Elf64_Vernaux Vernaux;
+typedef Elf64_Versym Versym;
+typedef Elf64_Move Move;
+typedef Elf64_Cap Cap;
+#endif /* _ASM */
+
+#else /* _ILP32 */
+
+#ifndef _ASM
+typedef Elf32_Word Xword; /* Xword/Sxword are 32-bits in Elf32 */
+typedef Elf32_Lword Lword;
+typedef Elf32_Sword Sxword;
+typedef Elf32_Word Word;
+typedef Elf32_Sword Sword;
+typedef Elf32_Half Half;
+typedef Elf32_Addr Addr;
+typedef Elf32_Off Off;
+typedef unsigned char Byte;
+#endif /* _ASM */
+
+#if defined(_KERNEL)
+#define ELF_R_TYPE ELF32_R_TYPE
+#define ELF_R_SYM ELF32_R_SYM
+#define ELF_R_INFO ELF32_R_INFO
+#define ELF_R_TYPE_DATA(x) (0)
+#define ELF_ST_BIND ELF32_ST_BIND
+#define ELF_ST_TYPE ELF32_ST_TYPE
+#define ELF_M_SYM ELF32_M_SYM
+#define ELF_M_SIZE ELF32_M_SIZE
+#endif
+
+#ifndef _ASM
+typedef Elf32_Ehdr Ehdr;
+typedef Elf32_Shdr Shdr;
+typedef Elf32_Sym Sym;
+typedef Elf32_Syminfo Syminfo;
+typedef Elf32_Rela Rela;
+typedef Elf32_Rel Rel;
+typedef Elf32_Nhdr Nhdr;
+typedef Elf32_Phdr Phdr;
+typedef Elf32_Dyn Dyn;
+typedef Elf32_Boot Boot;
+typedef Elf32_Verdef Verdef;
+typedef Elf32_Verdaux Verdaux;
+typedef Elf32_Verneed Verneed;
+typedef Elf32_Vernaux Vernaux;
+typedef Elf32_Versym Versym;
+typedef Elf32_Move Move;
+typedef Elf32_Cap Cap;
+#endif /* _ASM */
+
+#endif /* _ILP32 */
+
+
+
+/*
+ * Elf `printf' type-cast macros. These force arguements to
+ * be a fixed size so that Elf32 and Elf64 can share common
+ * format strings.
+ */
+#ifndef __lint
+#define EC_ADDR(a) ((Elf64_Addr)(uintptr_t)(a)) /* "ull" */
+#define EC_OFF(a) ((Elf64_Off)(a)) /* "ll" */
+#define EC_HALF(a) ((Elf64_Half)(a)) /* "d" */
+#define EC_WORD(a) ((Elf64_Word)(a)) /* "u" */
+#define EC_SWORD(a) ((Elf64_Sword)(a)) /* "d" */
+#define EC_XWORD(a) ((Elf64_Xword)(a)) /* "ull" */
+#define EC_SXWORD(a) ((Elf64_Sxword)(a)) /* "ll" */
+#define EC_LWORD(a) ((Elf64_Lword)(a)) /* "ull" */
+#else
+#define EC_ADDR(a) ((unsigned long long)(a))
+#define EC_OFF(a) ((unsigned long long)(a))
+#define EC_HALF(a) ((Elf64_Half)(a))
+#define EC_WORD(a) ((Elf64_Word)(a))
+#define EC_SWORD(a) ((Elf64_Sword)(a))
+#define EC_XWORD(a) ((unsigned long long)(a))
+#define EC_SXWORD(a) ((long long)(a))
+#define EC_LWORD(a) ((unsigned long long)(a))
+#endif
+
+
+#ifndef _ASM
+/*
+ * Structure used to build the reloc_table[]
+ */
+typedef struct {
+ Xword re_mask; /* mask to apply to reloc */
+ Word re_flags; /* relocation attributes */
+ unsigned char re_fsize; /* field size (in # bytes) */
+ unsigned char re_bshift; /* # of bits to shift */
+ unsigned char re_sigbits; /* # of significant bits */
+} Rel_entry;
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_MACHELF_H */
diff --git a/usr/src/uts/sparc/sys/machlock.h b/usr/src/uts/sparc/sys/machlock.h
new file mode 100644
index 0000000000..4a2cec8b54
--- /dev/null
+++ b/usr/src/uts/sparc/sys/machlock.h
@@ -0,0 +1,128 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 1990-2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_MACHLOCK_H
+#define _SYS_MACHLOCK_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _ASM
+
+#include <sys/types.h>
+
+#ifdef _KERNEL
+
+extern void lock_set(lock_t *lp);
+extern int lock_try(lock_t *lp);
+extern int lock_spin_try(lock_t *lp);
+extern int ulock_try(lock_t *lp);
+extern void ulock_clear(lock_t *lp);
+extern void lock_clear(lock_t *lp);
+extern void lock_set_spl(lock_t *lp, int new_pil, ushort_t *old_pil);
+extern void lock_clear_splx(lock_t *lp, int s);
+
+#endif /* _KERNEL */
+
+#define LOCK_HELD_VALUE 0xff
+#define LOCK_INIT_CLEAR(lp) (*(lp) = 0)
+#define LOCK_INIT_HELD(lp) (*(lp) = LOCK_HELD_VALUE)
+#define LOCK_HELD(lp) (*(volatile lock_t *)(lp) != 0)
+
+typedef lock_t disp_lock_t; /* dispatcher lock type */
+
+/*
+ * SPIN_LOCK() macro indicates whether lock is implemented as a spin lock or
+ * an adaptive mutex, depending on what interrupt levels use it.
+ */
+#define SPIN_LOCK(pl) ((pl) > ipltospl(LOCK_LEVEL))
+
+/*
+ * Macro to control loops which spin on a lock and then check state
+ * periodically. Its passed an integer, and returns a boolean value
+ * that if true indicates its a good time to get the scheduler lock and
+ * check the state of the current owner of the lock.
+ */
+#define LOCK_SAMPLE_INTERVAL(i) (((i) & 0xff) == 0)
+
+/*
+ * Extern for CLOCK_LOCK.
+ */
+extern int hres_lock;
+
+#endif /* _ASM */
+
+/*
+ * The definitions of the symbolic interrupt levels:
+ *
+ * CLOCK_LEVEL => The level at which one must be to block the clock.
+ *
+ * LOCK_LEVEL => The highest level at which one may block (and thus the
+ * highest level at which one may acquire adaptive locks)
+ * Also the highest level at which one may be preempted.
+ *
+ * DISP_LEVEL => The level at which one must be to perform dispatcher
+ * operations.
+ *
+ * The constraints on the platform:
+ *
+ * - CLOCK_LEVEL must be less than or equal to LOCK_LEVEL
+ * - LOCK_LEVEL must be less than DISP_LEVEL
+ * - DISP_LEVEL should be as close to LOCK_LEVEL as possible
+ *
+ * Note that LOCK_LEVEL and CLOCK_LEVEL have historically always been equal;
+ * changing this relationship is probably possible but not advised.
+ *
+ */
+#define CLOCK_LEVEL 10
+#define LOCK_LEVEL 10
+#define DISP_LEVEL (LOCK_LEVEL + 1)
+
+#define HIGH_LEVELS (PIL_MAX - LOCK_LEVEL)
+
+#define PIL_MAX 15
+
+/*
+ * The mutex and semaphore code depends on being able to represent a lock
+ * plus owner in a single 32-bit word. Thus the owner must contain at most
+ * 24 significant bits. At present only threads, mutexes and semaphores
+ * must be aware of this vile constraint. Different ISAs may handle this
+ * differently depending on their capabilities (e.g. compare-and-swap)
+ * and limitations (e.g. constraints on alignment and/or KERNELBASE).
+ */
+#define PTR24_LSB 5 /* lower bits all zero */
+#define PTR24_MSB (PTR24_LSB + 24) /* upper bits all one */
+#define PTR24_ALIGN 32 /* minimum alignment (1 << lsb) */
+#define PTR24_BASE 0xe0000000 /* minimum ptr value (-1 >> (32-msb)) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_MACHLOCK_H */
diff --git a/usr/src/uts/sparc/sys/machsig.h b/usr/src/uts/sparc/sys/machsig.h
new file mode 100644
index 0000000000..e4bbaab342
--- /dev/null
+++ b/usr/src/uts/sparc/sys/machsig.h
@@ -0,0 +1,128 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/* Copyright (c) 1988 AT&T */
+/* All Rights Reserved */
+
+
+/*
+ * Copyright (c) 1998-1999 by Sun Microsystems, Inc.
+ * All rights reserved.
+ */
+
+#ifndef _SYS_MACHSIG_H
+#define _SYS_MACHSIG_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <sys/feature_tests.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * SPARC Version
+ */
+
+/*
+ * machsig.h is the machine dependent portion of siginfo.h (and is
+ * included by siginfo.h). A version of machsig.h should exist for
+ * each architecture. The codes for SIGILL, SIGFPE, SIGSEGV and SIGBUS
+ * are in this file. The codes for SIGTRAP, SIGCLD(SIGCHLD), and
+ * SIGPOLL are architecture independent and may be found in siginfo.h.
+ */
+
+#if !defined(_POSIX_C_SOURCE) || defined(_XPG4_2) || defined(__EXTENSIONS__)
+
+/*
+ * SIGILL signal codes
+ */
+
+#define ILL_ILLOPC 1 /* illegal opcode */
+#define ILL_ILLOPN 2 /* illegal operand */
+#define ILL_ILLADR 3 /* illegal addressing mode */
+#define ILL_ILLTRP 4 /* illegal trap */
+#define ILL_PRVOPC 5 /* privileged opcode */
+#define ILL_PRVREG 6 /* privileged register */
+#define ILL_COPROC 7 /* co-processor */
+#define ILL_BADSTK 8 /* bad stack */
+
+#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
+#define NSIGILL 8
+#endif
+
+/*
+ * SIGEMT signal codes
+ */
+
+#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
+#define EMT_TAGOVF 1 /* tag overflow */
+#define EMT_CPCOVF 2 /* CPU performance counter overflow */
+#define NSIGEMT 2
+#endif
+
+/*
+ * SIGFPE signal codes
+ */
+
+#define FPE_INTDIV 1 /* integer divide by zero */
+#define FPE_INTOVF 2 /* integer overflow */
+#define FPE_FLTDIV 3 /* floating point divide by zero */
+#define FPE_FLTOVF 4 /* floating point overflow */
+#define FPE_FLTUND 5 /* floating point underflow */
+#define FPE_FLTRES 6 /* floating point inexact result */
+#define FPE_FLTINV 7 /* invalid floating point operation */
+#define FPE_FLTSUB 8 /* subscript out of range */
+#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
+#define NSIGFPE 8
+#endif
+
+/*
+ * SIGSEGV signal codes
+ */
+
+#define SEGV_MAPERR 1 /* address not mapped to object */
+#define SEGV_ACCERR 2 /* invalid permissions */
+#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
+#define NSIGSEGV 2
+#endif
+
+/*
+ * SIGBUS signal codes
+ */
+
+#define BUS_ADRALN 1 /* invalid address alignment */
+#define BUS_ADRERR 2 /* non-existent physical address */
+#ifndef BUS_OBJERR /* also defined in ucbinclude/sys/signal.h */
+#define BUS_OBJERR 3 /* object specific hardware error */
+#endif
+#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
+#define NSIGBUS 3
+#endif
+
+#endif /* _POSIX_C_SOURCE || defined(_XPG4_2) || defined(__EXTENSIONS__) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_MACHSIG_H */
diff --git a/usr/src/uts/sparc/sys/machtypes.h b/usr/src/uts/sparc/sys/machtypes.h
new file mode 100644
index 0000000000..574a533831
--- /dev/null
+++ b/usr/src/uts/sparc/sys/machtypes.h
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 1998-1999 by Sun Microsystems, Inc.
+ * All rights reserved.
+ */
+
+/* Copyright (c) 1988 AT&T */
+/* All Rights Reserved */
+
+
+#ifndef _SYS_MACHTYPES_H
+#define _SYS_MACHTYPES_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <sys/feature_tests.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Machine dependent types:
+ *
+ * SPARC Version
+ */
+
+#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
+ defined(__EXTENSIONS__)
+
+typedef struct _label_t { long val[2]; } label_t;
+
+#endif /* !defined(_POSIX_C_SOURCE)... */
+
+typedef unsigned char lock_t; /* lock work for busy wait */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_MACHTYPES_H */
diff --git a/usr/src/uts/sparc/sys/old_procfs.h b/usr/src/uts/sparc/sys/old_procfs.h
new file mode 100644
index 0000000000..7bb34e9393
--- /dev/null
+++ b/usr/src/uts/sparc/sys/old_procfs.h
@@ -0,0 +1,612 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 1992-2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
+/* All Rights Reserved */
+
+
+#ifndef _SYS_OLD_PROCFS_H
+#define _SYS_OLD_PROCFS_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * This file contains the definitions for the old ioctl()-based
+ * version of the process file system. It is obsolete but will
+ * continue to be supported in SunOS until the next major release.
+ * Note that <sys/procfs.h> and <sys/old_procfs.h> contain conflicting
+ * definitions and cannot be included together in the same source file.
+ */
+
+#include <sys/types.h>
+#include <sys/time_impl.h>
+#include <sys/signal.h>
+#include <sys/siginfo.h>
+#include <sys/fault.h>
+#include <sys/syscall.h>
+#include <sys/procfs_isa.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(_LP64) && _FILE_OFFSET_BITS == 64
+#error "Cannot use procfs in the large file compilation environment"
+#endif
+
+#if _STRUCTURED_PROC == 0
+
+/*
+ * ioctl codes and system call interfaces for /proc.
+ */
+
+#define PIOC ('q'<<8)
+#define PIOCSTATUS (PIOC|1) /* get process status */
+#define PIOCSTOP (PIOC|2) /* post STOP request and... */
+#define PIOCWSTOP (PIOC|3) /* wait for process to STOP */
+#define PIOCRUN (PIOC|4) /* make process runnable */
+#define PIOCGTRACE (PIOC|5) /* get traced signal set */
+#define PIOCSTRACE (PIOC|6) /* set traced signal set */
+#define PIOCSSIG (PIOC|7) /* set current signal */
+#define PIOCKILL (PIOC|8) /* send signal */
+#define PIOCUNKILL (PIOC|9) /* delete a signal */
+#define PIOCGHOLD (PIOC|10) /* get held signal set */
+#define PIOCSHOLD (PIOC|11) /* set held signal set */
+#define PIOCMAXSIG (PIOC|12) /* get max signal number */
+#define PIOCACTION (PIOC|13) /* get signal action structs */
+#define PIOCGFAULT (PIOC|14) /* get traced fault set */
+#define PIOCSFAULT (PIOC|15) /* set traced fault set */
+#define PIOCCFAULT (PIOC|16) /* clear current fault */
+#define PIOCGENTRY (PIOC|17) /* get syscall entry set */
+#define PIOCSENTRY (PIOC|18) /* set syscall entry set */
+#define PIOCGEXIT (PIOC|19) /* get syscall exit set */
+#define PIOCSEXIT (PIOC|20) /* set syscall exit set */
+
+/*
+ * These four are obsolete (replaced by PIOCSET/PIOCRESET).
+ */
+#define PIOCSFORK (PIOC|21) /* set inherit-on-fork flag */
+#define PIOCRFORK (PIOC|22) /* reset inherit-on-fork flag */
+#define PIOCSRLC (PIOC|23) /* set run-on-last-close flag */
+#define PIOCRRLC (PIOC|24) /* reset run-on-last-close flag */
+
+#define PIOCGREG (PIOC|25) /* get general registers */
+#define PIOCSREG (PIOC|26) /* set general registers */
+#define PIOCGFPREG (PIOC|27) /* get floating-point registers */
+#define PIOCSFPREG (PIOC|28) /* set floating-point registers */
+#define PIOCNICE (PIOC|29) /* set nice priority */
+#define PIOCPSINFO (PIOC|30) /* get ps(1) information */
+#define PIOCNMAP (PIOC|31) /* get number of memory mappings */
+#define PIOCMAP (PIOC|32) /* get memory map information */
+#define PIOCOPENM (PIOC|33) /* open mapped object for reading */
+#define PIOCCRED (PIOC|34) /* get process credentials */
+#define PIOCGROUPS (PIOC|35) /* get supplementary groups */
+#define PIOCGETPR (PIOC|36) /* read struct proc */
+#define PIOCGETU (PIOC|37) /* read user area */
+
+/*
+ * These are new with SunOS5.0.
+ */
+#define PIOCSET (PIOC|38) /* set process flags */
+#define PIOCRESET (PIOC|39) /* reset process flags */
+#define PIOCUSAGE (PIOC|43) /* get resource usage */
+#define PIOCOPENPD (PIOC|44) /* get page data file descriptor */
+
+/*
+ * Lightweight process interfaces.
+ */
+#define PIOCLWPIDS (PIOC|45) /* get lwp identifiers */
+#define PIOCOPENLWP (PIOC|46) /* get lwp file descriptor */
+#define PIOCLSTATUS (PIOC|47) /* get status of all lwps */
+#define PIOCLUSAGE (PIOC|48) /* get resource usage of all lwps */
+
+/*
+ * SVR4 run-time loader interfaces.
+ */
+#define PIOCNAUXV (PIOC|49) /* get number of aux vector entries */
+#define PIOCAUXV (PIOC|50) /* get aux vector (see sys/auxv.h) */
+
+/*
+ * extra register state interfaces
+ */
+#define PIOCGXREGSIZE (PIOC|51) /* get extra register state size */
+#define PIOCGXREG (PIOC|52) /* get extra register state */
+#define PIOCSXREG (PIOC|53) /* set extra register state */
+
+/*
+ * SPARC-specific interfaces.
+ */
+#define PIOCGWIN (PIOC|101) /* get gwindows_t (see sys/reg.h) */
+
+/* Process/lwp status structure */
+
+#define PRCLSZ 8 /* maximum size of scheduling class name */
+#define PRSYSARGS 8 /* maximum number of syscall arguments */
+
+#endif /* _STRUCTURED_PROC == 0 */
+
+typedef struct prstatus {
+ int pr_flags; /* Flags (see below) */
+ short pr_why; /* Reason for process stop (if stopped) */
+ short pr_what; /* More detailed reason */
+ siginfo_t pr_info; /* Info associated with signal or fault */
+ short pr_cursig; /* Current signal */
+ ushort_t pr_nlwp; /* Number of lwps in the process */
+ sigset_t pr_sigpend; /* Set of signals pending to the process */
+ sigset_t pr_sighold; /* Set of signals held (blocked) by the lwp */
+ struct sigaltstack pr_altstack; /* Alternate signal stack info */
+ struct sigaction pr_action; /* Signal action for current signal */
+ pid_t pr_pid; /* Process id */
+ pid_t pr_ppid; /* Parent process id */
+ pid_t pr_pgrp; /* Process group id */
+ pid_t pr_sid; /* Session id */
+ timestruc_t pr_utime; /* Process user cpu time */
+ timestruc_t pr_stime; /* Process system cpu time */
+ timestruc_t pr_cutime; /* Sum of children's user times */
+ timestruc_t pr_cstime; /* Sum of children's system times */
+ char pr_clname[PRCLSZ]; /* Scheduling class name */
+ short pr_syscall; /* System call number (if in syscall) */
+ short pr_nsysarg; /* Number of arguments to this syscall */
+ long pr_sysarg[PRSYSARGS]; /* Arguments to this syscall */
+ id_t pr_who; /* Specific lwp identifier */
+ sigset_t pr_lwppend; /* Set of signals pending to the lwp */
+ struct ucontext *pr_oldcontext; /* Address of previous ucontext */
+ caddr_t pr_brkbase; /* Address of the process heap */
+ size_t pr_brksize; /* Size of the process heap, in bytes */
+ caddr_t pr_stkbase; /* Address of the process stack */
+ size_t pr_stksize; /* Size of the process stack, in bytes */
+ short pr_processor; /* processor which last ran this LWP */
+ short pr_bind; /* processor LWP bound to or PBIND_NONE */
+ long pr_instr; /* Current instruction */
+ prgregset_t pr_reg; /* General registers */
+} prstatus_t;
+
+#if _STRUCTURED_PROC == 0
+
+/* pr_flags */
+
+#define PR_STOPPED 0x0001 /* lwp is stopped */
+#define PR_ISTOP 0x0002 /* lwp is stopped on an event of interest */
+#define PR_DSTOP 0x0004 /* lwp has a stop directive in effect */
+#define PR_ASLEEP 0x0008 /* lwp is sleeping in a system call */
+#define PR_FORK 0x0010 /* inherit-on-fork is in effect */
+#define PR_RLC 0x0020 /* run-on-last-close is in effect */
+#define PR_PTRACE 0x0040 /* obsolete, never set in SunOS5.0 */
+#define PR_PCINVAL 0x0080 /* contents of pr_instr undefined */
+#define PR_ISSYS 0x0100 /* system process */
+#define PR_STEP 0x0200 /* lwp has a single-step directive in effect */
+#define PR_KLC 0x0400 /* kill-on-last-close is in effect */
+#define PR_ASYNC 0x0800 /* asynchronous-stop is in effect */
+#define PR_PCOMPAT 0x1000 /* ptrace-compatibility mode is in effect */
+#define PR_MSACCT 0x2000 /* micro-state usage accounting is in effect */
+#define PR_BPTADJ 0x4000 /* breakpoint trap pc adjustment is in effect */
+#define PR_ASLWP 0x8000 /* obsolete flag; never set */
+
+/* Reasons for stopping */
+
+#define PR_REQUESTED 1
+#define PR_SIGNALLED 2
+#define PR_SYSENTRY 3
+#define PR_SYSEXIT 4
+#define PR_JOBCONTROL 5
+#define PR_FAULTED 6
+#define PR_SUSPENDED 7
+#define PR_CHECKPOINT 8
+
+/* Information for the ps(1) command */
+
+#define PRFNSZ 16 /* max size of execed filename */
+#define PRARGSZ 80 /* Number of chars of arguments */
+
+#endif /* _STRUCTURED_PROC == 0 */
+
+typedef struct prpsinfo {
+ char pr_state; /* numeric process state (see pr_sname) */
+ char pr_sname; /* printable character representing pr_state */
+ char pr_zomb; /* !=0: process terminated but not waited for */
+ char pr_nice; /* nice for cpu usage */
+ uint_t pr_flag; /* process flags */
+ uid_t pr_uid; /* real user id */
+ gid_t pr_gid; /* real group id */
+ pid_t pr_pid; /* unique process id */
+ pid_t pr_ppid; /* process id of parent */
+ pid_t pr_pgrp; /* pid of process group leader */
+ pid_t pr_sid; /* session id */
+ caddr_t pr_addr; /* physical address of process */
+ size_t pr_size; /* size of process image in pages */
+ size_t pr_rssize; /* resident set size in pages */
+ caddr_t pr_wchan; /* wait addr for sleeping process */
+ timestruc_t pr_start; /* process start time, sec+nsec since epoch */
+ timestruc_t pr_time; /* usr+sys cpu time for this process */
+ int pr_pri; /* priority, high value is high priority */
+ char pr_oldpri; /* pre-SVR4, low value is high priority */
+ char pr_cpu; /* pre-SVR4, cpu usage for scheduling */
+ o_dev_t pr_ottydev; /* short tty device number */
+ dev_t pr_lttydev; /* controlling tty device (PRNODEV if none) */
+ char pr_clname[PRCLSZ]; /* scheduling class name */
+ char pr_fname[PRFNSZ]; /* last component of execed pathname */
+ char pr_psargs[PRARGSZ]; /* initial characters of arg list */
+ short pr_syscall; /* system call number (if in syscall) */
+ short pr_fill;
+ timestruc_t pr_ctime; /* usr+sys cpu time for reaped children */
+ size_t pr_bysize; /* size of process image in bytes */
+ size_t pr_byrssize; /* resident set size in bytes */
+ int pr_argc; /* initial argument count */
+ char **pr_argv; /* initial argument vector */
+ char **pr_envp; /* initial environment vector */
+ int pr_wstat; /* if zombie, the wait() status */
+ /* The following percent numbers are 16-bit binary */
+ /* fractions [0 .. 1] with the binary point to the */
+ /* right of the high-order bit (one == 0x8000) */
+ ushort_t pr_pctcpu; /* % of recent cpu time, one or all lwps */
+ ushort_t pr_pctmem; /* % of of system memory used by the process */
+ uid_t pr_euid; /* effective user id */
+ gid_t pr_egid; /* effective group id */
+ id_t pr_aslwpid; /* historical; now always zero */
+ char pr_dmodel; /* data model of the process */
+ char pr_pad[3];
+ int pr_filler[6]; /* for future expansion */
+} prpsinfo_t;
+
+#if _STRUCTURED_PROC == 0
+
+#if !defined(_STYPES)
+#define pr_ttydev pr_lttydev
+#else
+#define pr_ttydev pr_ottydev
+#endif
+
+#define PRNODEV (dev_t)(-1l) /* non-existent device */
+
+/*
+ * See <sys/procfs_isa.h> for possible values of pr_dmodel.
+ */
+
+/* Optional actions to take when process continues */
+
+typedef struct prrun {
+ int pr_flags; /* Flags */
+ sigset_t pr_trace; /* Set of signals to be traced */
+ sigset_t pr_sighold; /* Set of signals to be held */
+ fltset_t pr_fault; /* Set of faults to be traced */
+ caddr_t pr_vaddr; /* Virtual address at which to resume */
+ int pr_filler[8]; /* Filler area for future expansion */
+} prrun_t;
+
+#define PRCSIG 0x001 /* Clear current signal */
+#define PRCFAULT 0x002 /* Clear current fault */
+#define PRSTRACE 0x004 /* Use traced-signal set in pr_trace */
+#define PRSHOLD 0x008 /* Use held-signal set in pr_sighold */
+#define PRSFAULT 0x010 /* Use traced-fault set in pr_fault */
+#define PRSVADDR 0x020 /* Resume at virtual address in pr_vaddr */
+#define PRSTEP 0x040 /* Direct the lwp to single-step */
+#define PRSABORT 0x080 /* Abort syscall */
+#define PRSTOP 0x100 /* Set directed stop request */
+
+/* Memory-management interface */
+
+typedef struct prmap {
+ caddr_t pr_vaddr; /* Virtual address */
+ size_t pr_size; /* Size of mapping in bytes */
+ off_t pr_off; /* Offset into mapped object, if any */
+ uint_t pr_mflags; /* Protection and attribute flags */
+ uint_t pr_pagesize; /* pagesize (bytes) for this mapping */
+ long pr_filler[3]; /* Filler for future expansion */
+} prmap_t;
+
+/* Protection and attribute flags */
+
+#define MA_READ 0x04 /* Readable by the traced process */
+#define MA_WRITE 0x02 /* Writable by the traced process */
+#define MA_EXEC 0x01 /* Executable by the traced process */
+#define MA_SHARED 0x08 /* Changes are shared by mapped object */
+/*
+ * These are obsolete and unreliable.
+ * They are included here only for historical compatibility.
+ */
+#define MA_BREAK 0x10 /* Grown by brk(2) */
+#define MA_STACK 0x20 /* Grown automatically on stack faults */
+
+/* Process credentials */
+
+typedef struct prcred {
+ uid_t pr_euid; /* Effective user id */
+ uid_t pr_ruid; /* Real user id */
+ uid_t pr_suid; /* Saved user id (from exec) */
+ gid_t pr_egid; /* Effective group id */
+ gid_t pr_rgid; /* Real group id */
+ gid_t pr_sgid; /* Saved group id (from exec) */
+ uint_t pr_ngroups; /* Number of supplementary groups */
+} prcred_t;
+
+/* Resource usage */
+
+typedef struct prusage {
+ id_t pr_lwpid; /* lwp id. 0: process or defunct */
+ int pr_count; /* number of contributing lwps */
+ timestruc_t pr_tstamp; /* current time stamp */
+ timestruc_t pr_create; /* process/lwp creation time stamp */
+ timestruc_t pr_term; /* process/lwp termination time stamp */
+ timestruc_t pr_rtime; /* total lwp real (elapsed) time */
+ timestruc_t pr_utime; /* user level CPU time */
+ timestruc_t pr_stime; /* system call CPU time */
+ timestruc_t pr_ttime; /* other system trap CPU time */
+ timestruc_t pr_tftime; /* text page fault sleep time */
+ timestruc_t pr_dftime; /* data page fault sleep time */
+ timestruc_t pr_kftime; /* kernel page fault sleep time */
+ timestruc_t pr_ltime; /* user lock wait sleep time */
+ timestruc_t pr_slptime; /* all other sleep time */
+ timestruc_t pr_wtime; /* wait-cpu (latency) time */
+ timestruc_t pr_stoptime; /* stopped time */
+ timestruc_t filltime[6]; /* filler for future expansion */
+ ulong_t pr_minf; /* minor page faults */
+ ulong_t pr_majf; /* major page faults */
+ ulong_t pr_nswap; /* swaps */
+ ulong_t pr_inblk; /* input blocks */
+ ulong_t pr_oublk; /* output blocks */
+ ulong_t pr_msnd; /* messages sent */
+ ulong_t pr_mrcv; /* messages received */
+ ulong_t pr_sigs; /* signals received */
+ ulong_t pr_vctx; /* voluntary context switches */
+ ulong_t pr_ictx; /* involuntary context switches */
+ ulong_t pr_sysc; /* system calls */
+ ulong_t pr_ioch; /* chars read and written */
+ ulong_t filler[10]; /* filler for future expansion */
+} prusage_t;
+
+/* Page data */
+
+/* page data file header */
+typedef struct prpageheader {
+ timestruc_t pr_tstamp; /* real time stamp */
+ ulong_t pr_nmap; /* number of address space mappings */
+ ulong_t pr_npage; /* total number of pages */
+} prpageheader_t;
+
+/* page data mapping header */
+typedef struct prasmap {
+ caddr_t pr_vaddr; /* virtual address */
+ size_t pr_npage; /* number of pages in mapping */
+ off_t pr_off; /* offset into mapped object, if any */
+ uint_t pr_mflags; /* protection and attribute flags */
+ uint_t pr_pagesize; /* pagesize (bytes) for this mapping */
+ long pr_filler[3]; /* filler for future expansion */
+} prasmap_t;
+
+/*
+ * npage bytes (rounded up to a sizeof (long)-byte boundary) follow
+ * each mapping header, containing zero or more of these flags.
+ */
+#define PG_REFERENCED 0x02 /* page referenced since last read */
+#define PG_MODIFIED 0x01 /* page modified since last read */
+#define PG_HWMAPPED 0x04 /* page is present and mapped */
+
+/*
+ * Macros for manipulating sets of flags.
+ * sp must be a pointer to one of sigset_t, fltset_t, or sysset_t.
+ * flag must be a member of the enumeration corresponding to *sp.
+ */
+
+/* turn on all flags in set */
+#define prfillset(sp) \
+ { register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
+ while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0xFFFFFFFF; }
+
+/* turn off all flags in set */
+#define premptyset(sp) \
+ { register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
+ while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0; }
+
+/* turn on specified flag in set */
+#define praddset(sp, flag) \
+ ((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \
+ (((uint32_t *)(sp))[((flag)-1)/32] |= (1UL<<(((flag)-1)%32))) : 0))
+
+/* turn off specified flag in set */
+#define prdelset(sp, flag) \
+ ((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \
+ (((uint32_t *)(sp))[((flag)-1)/32] &= ~(1UL<<(((flag)-1)%32))) : 0))
+
+/* query: != 0 iff flag is turned on in set */
+#define prismember(sp, flag) \
+ (((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) && \
+ (((uint32_t *)(sp))[((flag)-1)/32] & (1UL<<(((flag)-1)%32))))
+
+#endif /* _STRUCTURED_PROC == 0 */
+
+#ifdef _SYSCALL32
+
+#if _STRUCTURED_PROC == 0
+
+/*
+ * dev32_t version of PRNODEV
+ */
+#define PRNODEV32 (dev32_t)(-1)
+
+/*
+ * Kernel view of structures used by _ILP32 programs.
+ */
+
+#endif /* _STRUCTURED_PROC == 0 */
+
+typedef struct prstatus32 {
+ int32_t pr_flags; /* Flags */
+ short pr_why; /* Reason for process stop (if stopped) */
+ short pr_what; /* More detailed reason */
+ siginfo32_t pr_info; /* Info associated with signal or fault */
+ short pr_cursig; /* Current signal */
+ ushort_t pr_nlwp; /* Number of lwps in the process */
+ sigset_t pr_sigpend; /* Set of signals pending to the process */
+ sigset_t pr_sighold; /* Set of signals held (blocked) by the lwp */
+ struct sigaltstack32 pr_altstack; /* Alternate signal stack info */
+ struct sigaction32 pr_action; /* Signal action for current signal */
+ pid32_t pr_pid; /* Process id */
+ pid32_t pr_ppid; /* Parent process id */
+ pid32_t pr_pgrp; /* Process group id */
+ pid32_t pr_sid; /* Session id */
+ timestruc32_t pr_utime; /* Process user cpu time */
+ timestruc32_t pr_stime; /* Process system cpu time */
+ timestruc32_t pr_cutime; /* Sum of children's user times */
+ timestruc32_t pr_cstime; /* Sum of children's system times */
+ char pr_clname[PRCLSZ]; /* Scheduling class name */
+ short pr_syscall; /* System call number (if in syscall) */
+ short pr_nsysarg; /* Number of arguments to this syscall */
+ int32_t pr_sysarg[PRSYSARGS]; /* Arguments to this syscall */
+ id32_t pr_who; /* Specific lwp identifier */
+ sigset_t pr_lwppend; /* Set of signals pending to the lwp */
+ caddr32_t pr_oldcontext; /* Address of previous ucontext */
+ caddr32_t pr_brkbase; /* Address of the process heap */
+ size32_t pr_brksize; /* Size of the process heap, in bytes */
+ caddr32_t pr_stkbase; /* Address of the process stack */
+ size32_t pr_stksize; /* Size of the process stack, in bytes */
+ short pr_processor; /* processor which last ran this LWP */
+ short pr_bind; /* processor LWP bound to or PBIND_NONE */
+ int32_t pr_instr; /* Current instruction */
+ prgregset32_t pr_reg; /* General registers */
+} prstatus32_t;
+
+typedef struct prpsinfo32 {
+ char pr_state; /* numeric process state (see pr_sname) */
+ char pr_sname; /* printable character representing pr_state */
+ char pr_zomb; /* !=0: process terminated but not waited for */
+ char pr_nice; /* nice for cpu usage */
+ uint32_t pr_flag; /* process flags */
+ uid32_t pr_uid; /* real user id */
+ gid32_t pr_gid; /* real group id */
+ pid32_t pr_pid; /* unique process id */
+ pid32_t pr_ppid; /* process id of parent */
+ pid32_t pr_pgrp; /* pid of process group leader */
+ pid32_t pr_sid; /* session id */
+ caddr32_t pr_addr; /* physical address of process */
+ size32_t pr_size; /* size of process image in pages */
+ size32_t pr_rssize; /* resident set size in pages */
+ caddr32_t pr_wchan; /* wait addr for sleeping process */
+ timestruc32_t pr_start; /* process start time, sec+nsec since epoch */
+ timestruc32_t pr_time; /* usr+sys cpu time for this process */
+ int32_t pr_pri; /* priority, high value is high priority */
+ char pr_oldpri; /* pre-SVR4, low value is high priority */
+ char pr_cpu; /* pre-SVR4, cpu usage for scheduling */
+ o_dev_t pr_ottydev; /* short tty device number */
+ dev32_t pr_lttydev; /* controlling tty device (PRNODEV if none) */
+ char pr_clname[PRCLSZ]; /* scheduling class name */
+ char pr_fname[PRFNSZ]; /* last component of execed pathname */
+ char pr_psargs[PRARGSZ]; /* initial characters of arg list */
+ short pr_syscall; /* system call number (if in syscall) */
+ short pr_fill;
+ timestruc32_t pr_ctime; /* usr+sys cpu time for reaped children */
+ size32_t pr_bysize; /* size of process image in bytes */
+ size32_t pr_byrssize; /* resident set size in bytes */
+ int pr_argc; /* initial argument count */
+ caddr32_t pr_argv; /* initial argument vector */
+ caddr32_t pr_envp; /* initial environment vector */
+ int pr_wstat; /* if zombie, the wait() status */
+ ushort_t pr_pctcpu; /* % of recent cpu time, one or all lwps */
+ ushort_t pr_pctmem; /* % of of system memory used by the process */
+ uid32_t pr_euid; /* effective user id */
+ gid32_t pr_egid; /* effective group id */
+ id32_t pr_aslwpid; /* historical; now always zero */
+ char pr_dmodel; /* data model of the process */
+ char pr_pad[3];
+ int32_t pr_filler[6]; /* for future expansion */
+} prpsinfo32_t;
+
+#if _STRUCTURED_PROC == 0
+
+typedef struct prrun32 {
+ int32_t pr_flags; /* Flags */
+ sigset_t pr_trace; /* Set of signals to be traced */
+ sigset_t pr_sighold; /* Set of signals to be held */
+ fltset_t pr_fault; /* Set of faults to be traced */
+ caddr32_t pr_vaddr; /* Virtual address at which to resume */
+ int32_t pr_filler[8]; /* Filler area for future expansion */
+} prrun32_t;
+
+typedef struct ioc_prmap32 {
+ caddr32_t pr_vaddr; /* Virtual address */
+ size32_t pr_size; /* Size of mapping in bytes */
+ off32_t pr_off; /* Offset into mapped object, if any */
+ uint32_t pr_mflags; /* Protection and attribute flags */
+ uint32_t pr_pagesize; /* pagesize (bytes) for this mapping */
+ int32_t pr_filler[3]; /* Filler for future expansion */
+} ioc_prmap32_t;
+
+typedef struct prusage32 {
+ id32_t pr_lwpid; /* lwp id. 0: process or defunct */
+ int32_t pr_count; /* number of contributing lwps */
+ timestruc32_t pr_tstamp; /* current time stamp */
+ timestruc32_t pr_create; /* process/lwp creation time stamp */
+ timestruc32_t pr_term; /* process/lwp termination time stamp */
+ timestruc32_t pr_rtime; /* total lwp real (elapsed) time */
+ timestruc32_t pr_utime; /* user level cpu time */
+ timestruc32_t pr_stime; /* system call cpu time */
+ timestruc32_t pr_ttime; /* other system trap cpu time */
+ timestruc32_t pr_tftime; /* text page fault sleep time */
+ timestruc32_t pr_dftime; /* data page fault sleep time */
+ timestruc32_t pr_kftime; /* kernel page fault sleep time */
+ timestruc32_t pr_ltime; /* user lock wait sleep time */
+ timestruc32_t pr_slptime; /* all other sleep time */
+ timestruc32_t pr_wtime; /* wait-cpu (latency) time */
+ timestruc32_t pr_stoptime; /* stopped time */
+ timestruc32_t filltime[6]; /* filler for future expansion */
+ uint32_t pr_minf; /* minor page faults */
+ uint32_t pr_majf; /* major page faults */
+ uint32_t pr_nswap; /* swaps */
+ uint32_t pr_inblk; /* input blocks */
+ uint32_t pr_oublk; /* output blocks */
+ uint32_t pr_msnd; /* messages sent */
+ uint32_t pr_mrcv; /* messages received */
+ uint32_t pr_sigs; /* signals received */
+ uint32_t pr_vctx; /* voluntary context switches */
+ uint32_t pr_ictx; /* involuntary context switches */
+ uint32_t pr_sysc; /* system calls */
+ uint32_t pr_ioch; /* chars read and written */
+ uint32_t filler[10]; /* filler for future expansion */
+} prusage32_t;
+
+typedef struct ioc_prpageheader32 {
+ timestruc32_t pr_tstamp; /* real time stamp */
+ uint32_t pr_nmap; /* number of address space mappings */
+ uint32_t pr_npage; /* total number of pages */
+} ioc_prpageheader32_t;
+
+typedef struct ioc_prasmap32 {
+ caddr32_t pr_vaddr; /* virtual address */
+ size32_t pr_npage; /* number of pages in mapping */
+ off32_t pr_off; /* offset into mapped object, if any */
+ uint32_t pr_mflags; /* protection and attribute flags */
+ uint32_t pr_pagesize; /* pagesize (bytes) for this mapping */
+ int32_t pr_filler[3]; /* filler for future expansion */
+} ioc_prasmap32_t;
+
+#endif /* _STRUCTURED_PROC == 0 */
+
+#endif /* _SYSCALL32 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_OLD_PROCFS_H */
diff --git a/usr/src/uts/sparc/sys/pcb.h b/usr/src/uts/sparc/sys/pcb.h
new file mode 100644
index 0000000000..7ac9a68504
--- /dev/null
+++ b/usr/src/uts/sparc/sys/pcb.h
@@ -0,0 +1,80 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 1990-2002 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_PCB_H
+#define _SYS_PCB_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <sys/regset.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Sun software process control block
+ */
+
+#ifndef _ASM
+typedef struct pcb {
+ int pcb_flags; /* various state flags; cleared on fork */
+ uint32_t pcb_trap0addr; /* addr of user level trap 0 handler */
+ /* deliberately restricted to 32 bits */
+ /* because only used for SunOS programs */
+ uint_t pcb_instr; /* /proc: instruction at stop */
+ enum { XREGNONE = 0, XREGPRESENT, XREGMODIFIED }
+ pcb_xregstat; /* state of contents of pcb_xregs */
+ struct rwindow pcb_xregs; /* locals+ins fetched/set via /proc */
+ int pcb_step; /* used while single-stepping */
+ caddr_t pcb_tracepc; /* used while single-stepping */
+} pcb_t;
+#endif /* ! _ASM */
+
+/* pcb_flags */
+#define INSTR_VALID 0x02 /* value in pcb_instr is valid (/proc) */
+#define NORMAL_STEP 0x04 /* normal debugger requested single-step */
+#define WATCH_STEP 0x08 /* single-stepping in watchpoint emulation */
+#define CPC_OVERFLOW 0x10 /* performance counters overflowed */
+#define ASYNC_HWERR 0x20 /* asynchronous h/w error (e.g. parity error) */
+#define ASYNC_BERR 0x40 /* asynchronous bus error */
+#define ASYNC_BTO 0x80 /* asynchronous bus timeout */
+#define ASYNC_MOD_ILL 0x100 /* async module error w/ illegal instr/cycle */
+#define ASYNC_MOD_SEGV 0x200 /* async module error w/ address violation */
+#define ASYNC_ERR (ASYNC_HWERR | ASYNC_BERR | ASYNC_BTO | \
+ ASYNC_MOD_ILL | ASYNC_MOD_SEGV)
+
+/* pcb_step */
+#define STEP_NONE 0 /* no single step */
+#define STEP_REQUESTED 1 /* arrange to single-step the lwp */
+#define STEP_ACTIVE 2 /* actively patching addr, set active flag */
+#define STEP_WASACTIVE 3 /* wrap up after taking single-step fault */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_PCB_H */
diff --git a/usr/src/uts/sparc/sys/polled_io.h b/usr/src/uts/sparc/sys/polled_io.h
new file mode 100644
index 0000000000..48fb35e64c
--- /dev/null
+++ b/usr/src/uts/sparc/sys/polled_io.h
@@ -0,0 +1,110 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 1999 by Sun Microsystems, Inc.
+ * All rights reserved.
+ */
+
+#ifndef _SYS_POLLED_IO_H
+#define _SYS_POLLED_IO_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct polled_device {
+ /*
+ * This lock is only used to lock writing from
+ * the fields on the structure. The values in the
+ * structure can be read under obp, so the lock
+ * isn't valid then.
+ */
+ kmutex_t polled_device_lock;
+
+ /*
+ * When we switch over the console, this is the old value
+ * so that we can restore it later.
+ */
+ uint64_t polled_old_handle;
+
+ /*
+ * Pointer to registerd polled I/O callbacks.
+ */
+ cons_polledio_t *polled_io;
+
+} polled_device_t;
+
+_NOTE(MUTEX_PROTECTS_DATA(polled_device_t::polled_device_lock,
+ polled_device_t))
+
+#define CIF_SUCCESS ((uint_t)0)
+#define CIF_FAILURE ((uint_t)-1)
+
+/*
+ * The lower layers did not find any characters.
+ */
+#define CIF_NO_CHARACTERS ((uint_t)-2)
+
+/*
+ * Every CIF has at least 3 arguments: 0 (name), 1 (in args), and 2 (out args).
+ */
+#define CIF_MIN_SIZE 3
+
+#define CIF_NAME 0 /* name of function */
+#define CIF_NUMBER_IN_ARGS 1 /* number of arguments passed in */
+#define CIF_NUMBER_OUT_ARGS 2 /* number of arguments for return */
+
+/*
+ * These are the types of polled I/O that this module handles.
+ */
+typedef enum polled_io_console_type {
+ POLLED_IO_CONSOLE_INPUT = 0,
+ POLLED_IO_CONSOLE_OUTPUT = 1
+} polled_io_console_type_t;
+
+/*
+ * Initialize the polled I/O kernel structures
+ */
+void polled_io_init(void);
+
+/*
+ * De-initialize the polled I/O kernel structures
+ */
+void polled_io_fini(void);
+
+/*
+ * Register a device to be used as a console for OBP.
+ */
+int polled_io_register_callbacks(cons_polledio_t *, int);
+
+/*
+ * Unregister a device to be used as a console for OBP.
+ */
+int polled_io_unregister_callbacks(cons_polledio_t *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_POLLED_IO_H */
diff --git a/usr/src/uts/sparc/sys/procfs_isa.h b/usr/src/uts/sparc/sys/procfs_isa.h
new file mode 100644
index 0000000000..a1c98655b5
--- /dev/null
+++ b/usr/src/uts/sparc/sys/procfs_isa.h
@@ -0,0 +1,269 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
+ * All rights reserved.
+ */
+
+#ifndef _SYS_PROCFS_ISA_H
+#define _SYS_PROCFS_ISA_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Instruction Set Architecture specific component of <sys/procfs.h>
+ * sparc v8/v9 version
+ */
+
+#include <sys/regset.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Possible values of pr_dmodel.
+ * This isn't isa-specific, but it needs to be defined here for other reasons.
+ */
+#define PR_MODEL_UNKNOWN 0
+#define PR_MODEL_ILP32 1 /* process data model is ILP32 */
+#define PR_MODEL_LP64 2 /* process data model is LP64 */
+
+/*
+ * To determine whether application is running native.
+ */
+#if defined(_LP64)
+#define PR_MODEL_NATIVE PR_MODEL_LP64
+#elif defined(_ILP32)
+#define PR_MODEL_NATIVE PR_MODEL_ILP32
+#else
+#error "No DATAMODEL_NATIVE specified"
+#endif /* _LP64 || _ILP32 */
+
+/*
+ * Holds one sparc instruction, for both ILP32 and LP64.
+ */
+typedef uint32_t instr_t;
+
+/*
+ * General register access (sparc).
+ * Don't confuse definitions here with definitions in <sys/regset.h>.
+ * Registers are 32 bits for ILP32, 64 bits for LP64.
+ */
+#define NPRGREG 38
+#if defined(_LP64) || defined(_I32LPx)
+typedef long prgreg_t;
+#else
+typedef int prgreg_t;
+#endif
+typedef prgreg_t prgregset_t[NPRGREG];
+
+#define R_G0 0
+#define R_G1 1
+#define R_G2 2
+#define R_G3 3
+#define R_G4 4
+#define R_G5 5
+#define R_G6 6
+#define R_G7 7
+#define R_O0 8
+#define R_O1 9
+#define R_O2 10
+#define R_O3 11
+#define R_O4 12
+#define R_O5 13
+#define R_O6 14
+#define R_O7 15
+#define R_L0 16
+#define R_L1 17
+#define R_L2 18
+#define R_L3 19
+#define R_L4 20
+#define R_L5 21
+#define R_L6 22
+#define R_L7 23
+#define R_I0 24
+#define R_I1 25
+#define R_I2 26
+#define R_I3 27
+#define R_I4 28
+#define R_I5 29
+#define R_I6 30
+#define R_I7 31
+
+#ifdef __sparcv9
+#define R_CCR 32 /* v9 condition code register */
+#else
+#define R_PSR 32 /* v7/v8 processor status register */
+#endif
+
+#define R_PC 33
+#define R_nPC 34
+#define R_Y 35
+
+#ifdef __sparcv9
+#define R_ASI 36
+#define R_FPRS 37
+#else
+#define R_WIM 36
+#define R_TBR 37
+#endif
+
+/*
+ * The following defines are for portability.
+ */
+#ifdef __sparcv9
+#define R_PS R_CCR
+#else
+#define R_PS R_PSR
+#endif
+#define R_SP R_O6
+#define R_FP R_I6
+#define R_R0 R_O0
+#define R_R1 R_O1
+
+#if defined(_SYSCALL32)
+/*
+ * kernel view of the _ILP32 register set
+ */
+typedef int32_t prgreg32_t;
+typedef prgreg32_t prgregset32_t[NPRGREG];
+#define R_PSR 32
+#define R_WIM 36
+#define R_TBR 37
+#endif
+
+/*
+ * Floating-point register access (sparc FPU).
+ * See <sys/regset.h> for details of interpretation.
+ */
+#ifdef __sparcv9
+typedef struct prfpregset {
+ union { /* FPU floating point regs */
+ uint32_t pr_regs[32]; /* 32 singles */
+ double pr_dregs[32]; /* 32 doubles */
+ long double pr_qregs[16]; /* 16 quads */
+ } pr_fr;
+ uint64_t pr_filler;
+ uint64_t pr_fsr; /* FPU status register */
+ uint8_t pr_qcnt; /* # of entries in saved FQ */
+ uint8_t pr_q_entrysize; /* # of bytes per FQ entry */
+ uint8_t pr_en; /* flag signifying fpu in use */
+ char pr_pad[13]; /* ensure sizeof(prfpregset)%16 == 0 */
+ struct fq pr_q[16]; /* contains the FQ array */
+} prfpregset_t;
+#else
+typedef struct prfpregset {
+ union { /* FPU floating point regs */
+ uint32_t pr_regs[32]; /* 32 singles */
+ double pr_dregs[16]; /* 16 doubles */
+ } pr_fr;
+ uint32_t pr_filler;
+ uint32_t pr_fsr; /* FPU status register */
+ uint8_t pr_qcnt; /* # of entries in saved FQ */
+ uint8_t pr_q_entrysize; /* # of bytes per FQ entry */
+ uint8_t pr_en; /* flag signifying fpu in use */
+ struct fq pr_q[32]; /* contains the FQ array */
+} prfpregset_t;
+#endif /* __sparcv9 */
+
+#if defined(_SYSCALL32)
+/*
+ * kernel view of the _ILP32 floating point register set
+ */
+typedef struct prfpregset32 {
+ union { /* FPU floating point regs */
+ uint32_t pr_regs[32]; /* 32 singles */
+ double pr_dregs[16]; /* 16 doubles */
+ } pr_fr;
+ uint32_t pr_filler;
+ uint32_t pr_fsr; /* FPU status register */
+ uint8_t pr_qcnt; /* # of entries in saved FQ */
+ uint8_t pr_q_entrysize; /* # of bytes per FQ entry */
+ uint8_t pr_en; /* flag signifying fpu in use */
+ struct fq32 pr_q[32]; /* contains the FQ array */
+} prfpregset32_t;
+#endif /* _SYSCALL32 */
+
+/*
+ * Extra register access
+ */
+
+#define XR_G0 0
+#define XR_G1 1
+#define XR_G2 2
+#define XR_G3 3
+#define XR_G4 4
+#define XR_G5 5
+#define XR_G6 6
+#define XR_G7 7
+#define NPRXGREG 8
+
+#define XR_O0 0
+#define XR_O1 1
+#define XR_O2 2
+#define XR_O3 3
+#define XR_O4 4
+#define XR_O5 5
+#define XR_O6 6
+#define XR_O7 7
+#define NPRXOREG 8
+
+#define NPRXFILLER 8
+
+#define XR_TYPE_V8P 1 /* interpret union as pr_v8p */
+
+typedef struct prxregset {
+ uint32_t pr_type; /* how to interpret union */
+ uint32_t pr_align; /* alignment for the union */
+ union {
+ struct pr_v8p {
+ union { /* extra FP registers */
+ uint32_t pr_regs[32];
+ double pr_dregs[16];
+#ifndef __sparcv9 /* 32-bit alignment problem */
+ long double pr_qregs[8];
+#endif
+ } pr_xfr;
+ uint32_t pr_xfsr; /* upper 32bits, FP state reg */
+ uint32_t pr_fprs; /* FP registers state */
+ uint32_t pr_xg[NPRXGREG]; /* upper 32bits, G registers */
+ uint32_t pr_xo[NPRXOREG]; /* upper 32bits, O registers */
+ uint64_t pr_tstate; /* TSTATE register */
+ uint32_t pr_filler[NPRXFILLER];
+ } pr_v8p;
+ } pr_un;
+} prxregset_t;
+
+/*
+ * Given a pointer to a prxregset structure, this macro yields the value
+ * of the %gsr embedded in the structure. It is an lvalue, so it can
+ * be used to assign the value of the %gsr into the structure.
+ * (Please don't ask why this is done this way.)
+ */
+#define PRXREG_GSR(xrp) (*(uint64_t *)((xrp)->pr_un.pr_v8p.pr_filler))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_PROCFS_ISA_H */
diff --git a/usr/src/uts/sparc/sys/psw.h b/usr/src/uts/sparc/sys/psw.h
new file mode 100644
index 0000000000..a7e565baec
--- /dev/null
+++ b/usr/src/uts/sparc/sys/psw.h
@@ -0,0 +1,65 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 1986 by Sun Microsystems, Inc.
+ */
+
+#ifndef _SYS_PSW_H
+#define _SYS_PSW_H
+
+#pragma ident "%Z%%M% %I% %E% SMI" /* from SunOS psl.h 1.2 */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This file only exists for v7 backwards compatibility.
+ * Kernel code shoulf not include it.
+ */
+#ifdef _KERNEL
+#error Kernel include of psw.h
+#else
+
+#include <v7/sys/psr.h>
+
+/*
+ * The following defines are obsolete; they exist only for existing
+ * application compatibility.
+ */
+#define SR_SMODE PSR_PS
+
+/*
+ * Macros to decode psr.
+ *
+ * XXX - note that AT&T's usage of BASEPRI() is reversed from ours
+ * (i.e. (!BASEPRI(ps)) means that you *are* at the base priority).
+ */
+#define BASEPRI(ps) (((ps) & PSR_PIL) == 0)
+
+#endif /* _KERNEL */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_PSW_H */
diff --git a/usr/src/uts/sparc/sys/reg.h b/usr/src/uts/sparc/sys/reg.h
new file mode 100644
index 0000000000..7a02d2ae39
--- /dev/null
+++ b/usr/src/uts/sparc/sys/reg.h
@@ -0,0 +1,89 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 1989, 1995 by Sun Microsystems, Inc.
+ * All Rights Reserved.
+ */
+
+#ifndef _SYS_REG_H
+#define _SYS_REG_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This file only exists for v7 backwards compatibility.
+ * Kernel code should not include it.
+ */
+#ifdef _KERNEL
+#error Kernel include of reg.h
+#else
+
+#include <sys/regset.h>
+
+/*
+ * NWINDOW is obsolete; it exists only for existing application compatibility.
+ */
+#define NWINDOW 7
+
+/*
+ * Location of the users' stored registers relative to R0.
+ * Used as an index into a gregset_t array.
+ */
+#define PSR (0)
+#define PC (1)
+#define nPC (2)
+#define Y (3)
+#define G1 (4)
+#define G2 (5)
+#define G3 (6)
+#define G4 (7)
+#define G5 (8)
+#define G6 (9)
+#define G7 (10)
+#define O0 (11)
+#define O1 (12)
+#define O2 (13)
+#define O3 (14)
+#define O4 (15)
+#define O5 (16)
+#define O6 (17)
+#define O7 (18)
+
+/*
+ * The following defines are for portability.
+ */
+#define PS PSR
+#define SP O6
+#define R0 O0
+#define R1 O1
+
+#endif /* _KERNEL */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_REG_H */
diff --git a/usr/src/uts/sparc/sys/regset.h b/usr/src/uts/sparc/sys/regset.h
new file mode 100644
index 0000000000..4116600782
--- /dev/null
+++ b/usr/src/uts/sparc/sys/regset.h
@@ -0,0 +1,605 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
+/* All Rights Reserved */
+
+
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_REGSET_H
+#define _SYS_REGSET_H
+
+#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
+
+#include <sys/feature_tests.h>
+
+#if !defined(_ASM)
+#include <sys/int_types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Location of the users' stored registers relative to R0.
+ * Usage is as an index into a gregset_t array or as u.u_ar0[XX].
+ */
+#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
+
+#if defined(__sparcv9)
+#define REG_CCR (0)
+#if defined(_SYSCALL32)
+#define REG_PSR (0)
+#endif /* _SYSCALL32 */
+#else
+#define REG_PSR (0)
+#endif /* __sparcv9 */
+
+#define REG_PC (1)
+#define REG_nPC (2)
+#define REG_Y (3)
+#define REG_G1 (4)
+#define REG_G2 (5)
+#define REG_G3 (6)
+#define REG_G4 (7)
+#define REG_G5 (8)
+#define REG_G6 (9)
+#define REG_G7 (10)
+#define REG_O0 (11)
+#define REG_O1 (12)
+#define REG_O2 (13)
+#define REG_O3 (14)
+#define REG_O4 (15)
+#define REG_O5 (16)
+#define REG_O6 (17)
+#define REG_O7 (18)
+#if defined(__sparcv9)
+#define REG_ASI (19)
+#define REG_FPRS (20)
+#endif /* __sparcv9 */
+
+/* the following defines are for portability */
+#if !defined(__sparcv9)
+#define REG_PS REG_PSR
+#endif /* __sparcv9 */
+#define REG_SP REG_O6
+#define REG_R0 REG_O0
+#define REG_R1 REG_O1
+#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
+
+/*
+ * A gregset_t is defined as an array type for compatibility with the reference
+ * source. This is important due to differences in the way the C language
+ * treats arrays and structures as parameters.
+ *
+ * Note that NGREG is really (sizeof (struct regs) / sizeof (greg_t)),
+ * but that the SPARC V8 ABI defines it absolutely to be 19.
+ */
+#if defined(__sparcv9)
+#define _NGREG 21
+#else /* __sparcv9 */
+#define _NGREG 19
+#endif /* __sparcv9 */
+#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
+#define NGREG _NGREG
+#endif
+
+#ifndef _ASM
+
+#if defined(_LP64) || defined(_I32LPx)
+typedef long greg_t;
+#else
+typedef int greg_t;
+#endif
+
+#if defined(_SYSCALL32)
+
+typedef int32_t greg32_t;
+typedef int64_t greg64_t;
+
+#endif /* _SYSCALL32 */
+
+typedef greg_t gregset_t[_NGREG];
+
+#if defined(_SYSCALL32)
+
+#define _NGREG32 19
+#define _NGREG64 21
+
+typedef greg32_t gregset32_t[_NGREG32];
+typedef greg64_t gregset64_t[_NGREG64];
+
+#endif /* _SYSCALL32 */
+
+#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
+/*
+ * The following structures define how a register window can appear on the
+ * stack. This structure is available (when required) through the `gwins'
+ * field of an mcontext (nested within ucontext). SPARC_MAXWINDOW is the
+ * maximum number of outstanding regiters window defined in the SPARC
+ * architecture (*not* implementation).
+ */
+#define SPARC_MAXREGWINDOW 31 /* max windows in SPARC arch. */
+
+struct rwindow {
+ greg_t rw_local[8]; /* locals */
+ greg_t rw_in[8]; /* ins */
+};
+
+#if defined(_SYSCALL32)
+
+struct rwindow32 {
+ greg32_t rw_local[8]; /* locals */
+ greg32_t rw_in[8]; /* ins */
+};
+
+struct rwindow64 {
+ greg64_t rw_local[8]; /* locals */
+ greg64_t rw_in[8]; /* ins */
+};
+
+#if defined(_KERNEL)
+extern void rwindow_nto32(struct rwindow *, struct rwindow32 *);
+extern void rwindow_32ton(struct rwindow32 *, struct rwindow *);
+#endif
+
+#endif /* _SYSCALL32 */
+
+#define rw_fp rw_in[6] /* frame pointer */
+#define rw_rtn rw_in[7] /* return address */
+
+typedef struct gwindows {
+ int wbcnt;
+ greg_t *spbuf[SPARC_MAXREGWINDOW];
+ struct rwindow wbuf[SPARC_MAXREGWINDOW];
+} gwindows_t;
+
+#if defined(_SYSCALL32)
+
+typedef struct gwindows32 {
+ int32_t wbcnt;
+ caddr32_t spbuf[SPARC_MAXREGWINDOW];
+ struct rwindow32 wbuf[SPARC_MAXREGWINDOW];
+} gwindows32_t;
+
+typedef struct gwindows64 {
+ int wbcnt;
+ greg64_t *spbuf[SPARC_MAXREGWINDOW];
+ struct rwindow64 wbuf[SPARC_MAXREGWINDOW];
+} gwindows64_t;
+
+#endif /* _SYSCALL32 */
+
+
+/*
+ * Floating point definitions.
+ */
+
+#define MAXFPQ 16 /* max # of fpu queue entries currently supported */
+
+/*
+ * struct fq defines the minimal format of a floating point instruction queue
+ * entry. The size of entries in the floating point queue are implementation
+ * dependent. The union FQu is guarenteed to be the first field in any ABI
+ * conformant system implementation. Any additional fields provided by an
+ * implementation should not be used applications designed to be ABI conformant.
+ */
+
+struct fpq {
+ unsigned int *fpq_addr; /* address */
+ unsigned int fpq_instr; /* instruction */
+};
+
+struct fq {
+ union { /* FPU inst/addr queue */
+ double whole;
+ struct fpq fpq;
+ } FQu;
+};
+
+#if defined(_SYSCALL32)
+
+struct fpq32 {
+ caddr32_t fpq_addr; /* address */
+ uint32_t fpq_instr; /* instruction */
+};
+
+struct fq32 {
+ union { /* FPU inst/addr queue */
+ double whole;
+ struct fpq32 fpq;
+ } FQu;
+};
+
+#endif /* _SYSCALL32 */
+
+/*
+ * struct fpu is the floating point processor state. struct fpu is the sum
+ * total of all possible floating point state which includes the state of
+ * external floating point hardware, fpa registers, etc..., if it exists.
+ *
+ * A floating point instuction queue may or may not be associated with
+ * the floating point processor state. If a queue does exist, the field
+ * fpu_q will point to an array of fpu_qcnt entries where each entry is
+ * fpu_q_entrysize long. fpu_q_entry has a lower bound of sizeof (union FQu)
+ * and no upper bound. If no floating point queue entries are associated
+ * with the processor state, fpu_qcnt will be zeo and fpu_q will be NULL.
+ */
+
+/*
+ * The following #define's are obsolete and may be removed in a future release.
+ * The corresponding integer types should be used instead (i.e. uint64_t).
+ */
+#define FPU_REGS_TYPE uint32_t
+#define FPU_DREGS_TYPE uint64_t
+#define V7_FPU_FSR_TYPE uint32_t
+#define V9_FPU_FSR_TYPE uint64_t
+#define V9_FPU_FPRS_TYPE uint32_t
+
+#if defined(__sparcv9)
+
+struct fpu {
+ union { /* FPU floating point regs */
+ uint32_t fpu_regs[32]; /* 32 singles */
+ double fpu_dregs[32]; /* 32 doubles */
+ long double fpu_qregs[16]; /* 16 quads */
+ } fpu_fr;
+ struct fq *fpu_q; /* ptr to array of FQ entries */
+ uint64_t fpu_fsr; /* FPU status register */
+ uint8_t fpu_qcnt; /* # of entries in saved FQ */
+ uint8_t fpu_q_entrysize; /* # of bytes per FQ entry */
+ uint8_t fpu_en; /* flag specifying fpu in use */
+};
+
+#else /* __sparcv9 */
+
+struct fpu {
+ union { /* FPU floating point regs */
+ uint32_t fpu_regs[32]; /* 32 singles */
+ double fpu_dregs[16]; /* 16 doubles */
+ } fpu_fr;
+ struct fq *fpu_q; /* ptr to array of FQ entries */
+ uint32_t fpu_fsr; /* FPU status register */
+ uint8_t fpu_qcnt; /* # of entries in saved FQ */
+ uint8_t fpu_q_entrysize; /* # of bytes per FQ entry */
+ uint8_t fpu_en; /* flag signifying fpu in use */
+};
+
+#endif /* __sparcv9 */
+
+typedef struct fpu fpregset_t;
+
+#if defined(_SYSCALL32)
+
+/* Kernel view of user sparcv7/v8 fpu structure */
+
+struct fpu32 {
+ union { /* FPU floating point regs */
+ uint32_t fpu_regs[32]; /* 32 singles */
+ double fpu_dregs[16]; /* 16 doubles */
+ } fpu_fr;
+ caddr32_t fpu_q; /* ptr to array of FQ entries */
+ uint32_t fpu_fsr; /* FPU status register */
+ uint8_t fpu_qcnt; /* # of entries in saved FQ */
+ uint8_t fpu_q_entrysize; /* # of bytes per FQ entry */
+ uint8_t fpu_en; /* flag signifying fpu in use */
+};
+
+typedef struct fpu32 fpregset32_t;
+
+#endif /* _SYSCALL32 */
+
+/*
+ * The ABI uses struct fpu, so we use this to describe the kernel's view of the
+ * fpu.
+ */
+typedef struct {
+ union _fpu_fr { /* V9 FPU floating point regs */
+ uint32_t fpu_regs[32]; /* 32 singles */
+ uint64_t fpu_dregs[32]; /* 32 doubles */
+ long double fpu_qregs[16]; /* 16 quads */
+ } fpu_fr;
+ uint64_t fpu_fsr; /* FPU status register */
+ uint32_t fpu_fprs; /* fprs register */
+ struct fq *fpu_q;
+ uint8_t fpu_qcnt;
+ uint8_t fpu_q_entrysize;
+ uint8_t fpu_en; /* flag signifying fpu in use */
+} kfpu_t;
+
+#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
+
+#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
+/*
+ * The following structure is for associating extra register state with
+ * the ucontext structure and is kept within the uc_mcontext filler area.
+ *
+ * If (xrs_id == XRS_ID) then the xrs_ptr field is a valid pointer to
+ * extra register state. The exact format of the extra register state
+ * pointed to by xrs_ptr is platform-dependent.
+ *
+ * Note: a platform may or may not manage extra register state.
+ */
+typedef struct {
+ unsigned int xrs_id; /* indicates xrs_ptr validity */
+ caddr_t xrs_ptr; /* ptr to extra reg state */
+} xrs_t;
+
+#define XRS_ID 0x78727300 /* the string "xrs" */
+
+#if defined(_SYSCALL32)
+
+typedef struct {
+ uint32_t xrs_id; /* indicates xrs_ptr validity */
+ caddr32_t xrs_ptr; /* ptr to extra reg state */
+} xrs32_t;
+
+#endif /* _SYSCALL32 */
+
+#if defined(__sparcv9)
+
+/*
+ * Ancillary State Registers
+ *
+ * The SPARC V9 architecture defines 25 ASRs, numbered from 7 through 31.
+ * ASRs 16 through 31 are available to user programs, though the meaning
+ * and content of these registers is implementation dependent.
+ */
+typedef int64_t asrset_t[16]; /* %asr16 - > %asr31 */
+
+#endif /* __sparcv9 */
+
+/*
+ * Structure mcontext defines the complete hardware machine state. If
+ * the field `gwins' is non NULL, it points to a save area for register
+ * window frames. If `gwins' is NULL, the register windows were saved
+ * on the user's stack.
+ *
+ * The filler of 21 longs is historical (now filler[19] plus the xrs_t
+ * field). The value was selected to provide binary compatibility with
+ * statically linked ICL binaries. It is in the ABI (do not change). It
+ * actually appears in the ABI as a single filler of 44 is in the field
+ * uc_filler of struct ucontext. It is split here so that ucontext.h can
+ * (hopefully) remain architecture independent.
+ *
+ * Note that 2 longs of the filler are used to hold extra register state info.
+ */
+typedef struct {
+ gregset_t gregs; /* general register set */
+ gwindows_t *gwins; /* POSSIBLE pointer to register windows */
+ fpregset_t fpregs; /* floating point register set */
+ xrs_t xrs; /* POSSIBLE extra register state association */
+#if defined(__sparcv9)
+ asrset_t asrs; /* ancillary registers */
+ long filler[4]; /* room for expansion */
+#else /* __sparcv9 */
+ long filler[19];
+#endif /* __sparcv9 */
+} mcontext_t;
+
+#if defined(_SYSCALL32)
+
+typedef struct {
+ gregset32_t gregs; /* general register set */
+ caddr32_t gwins; /* POSSIBLE pointer to register windows */
+ fpregset32_t fpregs; /* floating point register set */
+ xrs32_t xrs; /* POSSIBLE extra register state association */
+ int32_t filler[19];
+} mcontext32_t;
+
+#endif /* _SYSCALL32 */
+
+#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
+#endif /* _ASM */
+
+/*
+ * The version of privregs.h that is used on implementations that run
+ * on processors that support the V9 instruction set is deliberately not
+ * imported here.
+ *
+ * The V9 'struct regs' definition is -not- compatible with either 32-bit
+ * or 64-bit core file contents, nor with the ucontext. As a result, the
+ * 'regs' structure cannot be used portably by applications, and should
+ * only be used by the kernel implementation.
+ *
+ * The inclusion of the SPARC V7 version of privregs.h allows for some
+ * limited source compatibility with 32-bit applications who expect to use
+ * 'struct regs' to match the content of a 32-bit core file, or a ucontext_t.
+ *
+ * Note that the ucontext_t actually describes the general registers in
+ * terms of the gregset_t data type, as described in this file. Note also
+ * that the core file content is defined by core(4) in terms of data types
+ * defined by procfs -- see proc(4).
+ */
+#if !defined(__sparcv9)
+#if !defined(_KERNEL) && !defined(_XPG4_2) || defined(__EXTENSIONS__)
+#include <v7/sys/privregs.h>
+#endif /* !_KERNEL && !_XPG4_2 || __EXTENSIONS__ */
+#endif /* __sparcv9 */
+
+/*
+ * The following is here for XPG4.2 standards compliance.
+ * regset.h is included in ucontext.h for the definition of
+ * mcontext_t, all of which breaks XPG4.2 namespace.
+ */
+
+#if defined(_XPG4_2) && !defined(__EXTENSIONS__)
+/*
+ * The following is here for UNIX 95 compliance (XPG Issue 4, Version 2
+ * System Interfaces and Headers. The structures included here are identical
+ * to those visible elsewhere in this header except that the structure
+ * element names have been changed in accordance with the X/Open namespace
+ * rules. Specifically, depending on the name and scope, the names have
+ * been prepended with a single or double underscore (_ or __). See the
+ * structure definitions in the non-X/Open namespace for more detailed
+ * comments describing each of these structures.
+ */
+
+#ifndef _ASM
+
+/*
+ * The following structures define how a register window can appear on the
+ * stack.
+ */
+#define _SPARC_MAXREGWINDOW 31 /* max windows in SPARC arch. */
+
+struct __rwindow {
+ greg_t __rw_local[8]; /* locals */
+ greg_t __rw_in[8]; /* ins */
+};
+
+#define __rw_fp __rw_in[6] /* frame pointer */
+#define __rw_rtn __rw_in[7] /* return address */
+
+struct __gwindows {
+ int __wbcnt;
+ greg_t *__spbuf[_SPARC_MAXREGWINDOW];
+ struct __rwindow __wbuf[_SPARC_MAXREGWINDOW];
+};
+
+typedef struct __gwindows gwindows_t;
+
+/*
+ * The fq structure defines the minimal format of a floating point
+ * instruction queue entry.
+ */
+
+struct __fpq {
+ unsigned int *__fpq_addr; /* address */
+ unsigned int __fpq_instr; /* instruction */
+};
+
+struct __fq {
+ union { /* FPU inst/addr queue */
+ double __whole;
+ struct __fpq __fpq;
+ } _FQu;
+};
+
+/*
+ * The fpu structure is the floating point processor state.
+ */
+
+/*
+ * The following #define's are obsolete and may be removed in a future release.
+ * The corresponding integer types should be used instead (i.e. uint64_t).
+ */
+#define _FPU_REGS_TYPE uint32_t
+#define _FPU_DREGS_TYPE uint64_t
+#define _V7_FPU_FSR_TYPE uint32_t
+#define _V9_FPU_FSR_TYPE uint64_t
+#define _V9_FPU_FPRS_TYPE uint32_t
+
+#if defined(__sparcv9)
+
+/*
+ * SPARC Version 9 floating point
+ */
+
+struct __fpu {
+ union { /* FPU floating point regs */
+ uint32_t __fpu_regs[32]; /* 32 singles */
+ double __fpu_dregs[32]; /* 32 doubles */
+ long double __fpu_qregs[16]; /* 16 quads */
+ } __fpu_fr;
+ struct __fq *__fpu_q; /* ptr to array of FQ entries */
+ uint64_t __fpu_fsr; /* FPU status register */
+ uint8_t __fpu_qcnt; /* # of entries in saved FQ */
+ uint8_t __fpu_q_entrysize; /* # of bytes per FQ entry */
+ uint8_t __fpu_en; /* flag signifying fpu in use */
+};
+
+#else /* __sparcv9 */
+
+/*
+ * SPARC Version 7 and 8 floating point
+ */
+
+struct __fpu {
+ union { /* FPU floating point regs */
+ uint32_t __fpu_regs[32]; /* 32 singles */
+ double __fpu_dregs[16]; /* 16 doubles */
+ } __fpu_fr;
+ struct __fq *__fpu_q; /* ptr to array of FQ entries */
+ uint32_t __fpu_fsr; /* FPU status register */
+ uint8_t __fpu_qcnt; /* # of entries in saved FQ */
+ uint8_t __fpu_q_entrysize; /* # of bytes per FQ entry */
+ uint8_t __fpu_en; /* flag signifying fpu in use */
+};
+
+#endif /* __sparcv9 */
+
+typedef struct __fpu fpregset_t;
+
+/*
+ * The xrs_t structure is for associating extra register state with
+ * the ucontext structure and is kept within the uc_mcontext filler area.
+ */
+typedef struct {
+ unsigned int __xrs_id; /* indicates xrs_ptr validity */
+ caddr_t __xrs_ptr; /* ptr to extra reg state */
+} xrs_t;
+
+#define _XRS_ID 0x78727300 /* the string "xrs" */
+
+#if defined(__sparcv9)
+
+/*
+ * Ancillary State Registers
+ *
+ * The SPARC V9 architecture defines 25 ASRs, numbered from 7 through 31.
+ * ASRs 16 through 31 are available to user programs, though the meaning
+ * and content of these registers is implementation dependent.
+ */
+typedef int64_t asrset_t[16]; /* %asr16 - > %asr31 */
+
+#endif /* __sparcv9 */
+
+/*
+ * Structure mcontext defines the complete hardware machine state.
+ */
+typedef struct {
+ gregset_t __gregs; /* general register set */
+ gwindows_t *__gwins; /* POSSIBLE pointer to register windows */
+ fpregset_t __fpregs; /* floating point register set */
+ xrs_t __xrs; /* POSSIBLE extra register state association */
+#if defined(__sparcv9)
+ asrset_t __asrs; /* ancillary registers */
+ long __filler[4]; /* room for expansion */
+#else /* __sparcv9 */
+ long __filler[19];
+#endif /* __sparcv9 */
+} mcontext_t;
+
+#endif /* _ASM */
+#endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_REGSET_H */
diff --git a/usr/src/uts/sparc/sys/simulate.h b/usr/src/uts/sparc/sys/simulate.h
new file mode 100644
index 0000000000..7ae629dd1f
--- /dev/null
+++ b/usr/src/uts/sparc/sys/simulate.h
@@ -0,0 +1,162 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 1991-1998,2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_SIMULATE_H
+#define _SYS_SIMULATE_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* SPARC instruction simulator return codes. */
+
+#define SIMU_SUCCESS 1 /* simulation worked */
+#define SIMU_ILLEGAL 2 /* tried to simulate an illegal instuction */
+#define SIMU_FAULT 3 /* simulation generated an illegal access */
+#define SIMU_DZERO 4 /* simulation generated divide by zero */
+#define SIMU_UNALIGN 5 /* simulation generated an unaligned access */
+#define SIMU_RETRY 6 /* fixed up instruction, now retry it */
+
+
+/*
+ * Opcode types.
+ */
+#define OP_V8_BRANCH 0
+#define OP_V8_CALL 1
+#define OP_V8_ARITH 2 /* includes control xfer (e.g. JMPL) */
+#define OP_V8_LDSTR 3
+
+/*
+ * Relevant instruction opcodes.
+ */
+
+/* OP_V8_LDSTR */
+#define IOP_V8_LD 0x00
+#define IOP_V8_LDA 0x10
+#define IOP_V8_LDUBA 0x11
+#define IOP_V8_LDUHA 0x12
+#define IOP_V8_LDDA 0x13
+#define IOP_V8_STA 0x14
+#define IOP_V8_STBA 0x15
+#define IOP_V8_STHA 0x16
+#define IOP_V8_STDA 0x17
+#define IOP_V8_LDSBA 0x19
+#define IOP_V8_LDSHA 0x1a
+#define IOP_V8_LDSTUBA 0x1d
+#define IOP_V8_SWAPA 0x1f
+#define IOP_V8_LDFSR 0x21
+#define IOP_V8_LDQF 0x22
+#define IOP_V8_STFSR 0x25
+#define IOP_V8_STQF 0x26
+#define IOP_V8_LDQFA 0x32
+#define IOP_V8_LDDFA 0x33
+#define IOP_V8_STQFA 0x36
+#define IOP_V8_STDFA 0x37
+
+/* OP_V8_ARITH */
+#define IOP_V8_ADD 0x00
+#define IOP_V8_AND 0x01
+#define IOP_V8_OR 0x02
+#define IOP_V8_XOR 0x03
+#define IOP_V8_SUB 0x04
+#define IOP_V8_ANDN 0x05
+#define IOP_V8_ORN 0x06
+#define IOP_V8_XNOR 0x07
+#define IOP_V8_ADDC 0x08
+#define IOP_V8_UMUL 0x0a
+#define IOP_V8_SMUL 0x0b
+#define IOP_V8_SUBC 0x0c
+#define IOP_V8_UDIV 0x0e
+#define IOP_V8_SDIV 0x0f
+#define IOP_V8_ADDcc 0x10
+#define IOP_V8_ANDcc 0x11
+#define IOP_V8_ORcc 0x12
+#define IOP_V8_XORcc 0x13
+#define IOP_V8_SUBcc 0x14
+#define IOP_V8_ANDNcc 0x15
+#define IOP_V8_ORNcc 0x16
+#define IOP_V8_XNORcc 0x17
+#define IOP_V8_ADDCcc 0x18
+#define IOP_V8_UMULcc 0x1a
+#define IOP_V8_SMULcc 0x1b
+#define IOP_V8_SUBCcc 0x1c
+#define IOP_V8_UDIVcc 0x1e
+#define IOP_V8_SDIVcc 0x1f
+#define IOP_V8_TADDcc 0x20
+#define IOP_V8_TSUBcc 0x21
+#define IOP_V8_TADDccTV 0x22
+#define IOP_V8_TSUBccTV 0x23
+#define IOP_V8_MULScc 0x24
+#define IOP_V8_SLL 0x25
+#define IOP_V8_SRL 0x26
+#define IOP_V8_SRA 0x27
+#define IOP_V8_RDASR 0x28
+#define IOP_V8_POPC 0x2e
+#define IOP_V8_WRASR 0x30
+#define IOP_V8_FCMP 0x35
+#define IOP_V8_JMPL 0x38
+#define IOP_V8_RETT 0x39
+#define IOP_V8_TCC 0x3a
+#define IOP_V8_FLUSH 0x3b
+#define IOP_V8_SAVE 0x3c
+#define IOP_V8_RESTORE 0x3d
+
+/*
+ * Check for a load/store to alternate space. All other ld/st
+ * instructions should have bits 12-5 clear, if the i-bit is 0.
+ */
+#define IS_LDST_ALT(x) \
+ (((x) == IOP_V8_LDA || (x) == IOP_V8_LDDA || \
+ (x) == IOP_V8_LDSBA || (x) == IOP_V8_LDSHA || \
+ (x) == IOP_V8_LDSTUBA || (x) == IOP_V8_LDUBA || \
+ (x) == IOP_V8_LDUHA || (x) == IOP_V8_STA || \
+ (x) == IOP_V8_STBA || (x) == IOP_V8_STDA || \
+ (x) == IOP_V8_STHA || (x) == IOP_V8_SWAPA) ? 1 : 0)
+
+
+#ifndef _ASM
+
+#include <vm/seg_enum.h>
+
+extern int32_t fetch_user_instr(caddr_t);
+extern int simulate_unimp(struct regs *, caddr_t *);
+extern int do_unaligned(struct regs *, caddr_t *);
+extern int calc_memaddr(struct regs *, caddr_t *);
+extern int is_atomic(struct regs *);
+extern int instr_size(struct regs *, caddr_t *, enum seg_rw);
+extern int getreg(struct regs *, uint_t, uint64_t *, caddr_t *);
+extern int putreg(uint64_t *, struct regs *, uint_t, caddr_t *);
+extern int extended_asi_size(int asi);
+
+#endif /* _ASM */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_SIMULATE_H */
diff --git a/usr/src/uts/sparc/sys/spl.h b/usr/src/uts/sparc/sys/spl.h
new file mode 100644
index 0000000000..787ca18df6
--- /dev/null
+++ b/usr/src/uts/sparc/sys/spl.h
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 1986,2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_SPL_H
+#define _SYS_SPL_H
+
+#pragma ident "%Z%%M% %I% %E% SMI" /* from SunOS psl.h 1.2 */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * v9 spl and ipl are identical since pil is a separate register.
+ */
+#define ipltospl(n) (n)
+#define spltoipl(n) (n)
+
+/*
+ * Hardware spl levels
+ * XXX - This is a hack for softcall to block all i/o interrupts.
+ * XXX - SPL5 and SPL3 are hacks for the latest zs code.
+ * it should be replace by the appropriate interrupt class info.
+ */
+#define SPL8 15
+#define SPL7 13
+#define SPL5 12
+#define SPLTTY SPL5
+#define SPL3 6
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_SPL_H */
diff --git a/usr/src/uts/sparc/sys/stack.h b/usr/src/uts/sparc/sys/stack.h
new file mode 100644
index 0000000000..692832f21e
--- /dev/null
+++ b/usr/src/uts/sparc/sys/stack.h
@@ -0,0 +1,173 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_STACK_H
+#define _SYS_STACK_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#if !defined(_ASM)
+
+#include <sys/types.h>
+
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * A stack frame looks like:
+ *
+ * %fp->| |
+ * |-------------------------------|
+ * | Locals, temps, saved floats |
+ * |-------------------------------|
+ * | outgoing parameters past 6 |
+ * |-------------------------------|-\
+ * | 6 words for callee to dump | |
+ * | register arguments | |
+ * |-------------------------------| > minimum stack frame
+ * | One word struct-ret address | |
+ * |-------------------------------| |
+ * | 16 words to save IN and | |
+ * %sp->| LOCAL register on overflow | |
+ * |-------------------------------|-/
+ */
+
+/*
+ * Constants defining a 32-bit stack frame.
+ */
+#define WINDOWSIZE32 (16*4) /* size of window save area */
+#define ARGPUSHSIZE32 (6*4) /* size of arg dump area */
+#define ARGPUSH32 (WINDOWSIZE32 + 4) /* arg dump area offset */
+#define MINFRAME32 (WINDOWSIZE32 + ARGPUSHSIZE32 + 4) /* min frame */
+
+#define STACK_GROWTH_DOWN /* stacks grow from high to low addresses */
+
+/*
+ * Stack alignment macros.
+ */
+#define STACK_ALIGN32 8
+#define STACK_ENTRY_ALIGN32 8
+#define SA32(X) (((X)+(STACK_ALIGN32-1)) & ~(STACK_ALIGN32-1))
+
+#if defined(__sparcv9)
+/*
+ * The 64-bit C ABI uses a stack frame that looks like:
+ *
+ * | |
+ * |-------------------------------|
+ * | Locals, temps, saved floats |
+ * |-------------------------------|
+ * | outgoing parameters past 6 |
+ * |-------------------------------|-\
+ * | outgoing parameters thru 6 | |
+ * |-------------------------------| > minimum stack frame
+ * | 16 xwords to save IN and | |
+ * | LOCAL register on overflow | |
+ * |-------------------------------|-/-\
+ * | | |
+ * | | > v9 abi bias
+ * | | |
+ * %sp->|-------------------------------|---/
+ */
+
+/*
+ * Constants defining a stack frame.
+ */
+#define WINDOWSIZE64 (16*8) /* size of window save area */
+#define ARGPUSHSIZE64 (6*8) /* size of arg dump area */
+#define MINFRAME64 (WINDOWSIZE64 + 48) /* min frame */
+#define ARGPUSH64 (WINDOWSIZE64) /* arg dump area offset */
+#define V9BIAS64 (2048-1) /* v9 abi stack bias */
+
+#define STACK_ALIGN64 16
+#define STACK_ENTRY_ALIGN64 16
+#define SA64(X) (((X)+(STACK_ALIGN64-1)) & ~(STACK_ALIGN64-1))
+
+#define IS_V9STACK(x) ((((uintptr_t)(x) + V9BIAS64) & \
+ (STACK_ALIGN64-1)) == 0)
+
+#define WINDOWSIZE WINDOWSIZE64
+#define ARGPUSHSIZE ARGPUSHSIZE64
+#define ARGPUSH ARGPUSH64
+#define MINFRAME MINFRAME64
+#define STACK_ALIGN STACK_ALIGN64
+#define STACK_ENTRY_ALIGN STACK_ENTRY_ALIGN64
+#define STACK_BIAS V9BIAS64
+#define SA(x) SA64(x)
+
+#else
+
+#define WINDOWSIZE WINDOWSIZE32
+#define ARGPUSHSIZE ARGPUSHSIZE32
+#define ARGPUSH ARGPUSH32
+#define MINFRAME MINFRAME32
+#define STACK_ALIGN STACK_ALIGN32
+#define STACK_ENTRY_ALIGN STACK_ENTRY_ALIGN32
+#define STACK_BIAS 0
+#define SA(x) SA32(x)
+#define STACK_V9BIAS64 (2048-1) /* v9 abi stack bias */
+
+#endif /* __sparcv9 */
+
+#if defined(_KERNEL) && !defined(_ASM)
+
+#if defined(DEBUG)
+#if STACK_ALIGN == 8
+#define ASSERT_STACK_ALIGNED() \
+ { \
+ uint64_t __tmp; \
+ ASSERT((((uintptr_t)&__tmp) & (STACK_ALIGN - 1)) == 0); \
+ }
+#elif (STACK_ALIGN == 16) && (_LONG_DOUBLE_ALIGNMENT == 16)
+#define ASSERT_STACK_ALIGNED() \
+ { \
+ long double __tmp; \
+ ASSERT((((uintptr_t)&__tmp) & (STACK_ALIGN - 1)) == 0); \
+ }
+#endif
+#else /* DEBUG */
+#define ASSERT_STACK_ALIGNED()
+#endif /* DEBUG */
+
+struct regs;
+
+void flush_windows(void);
+void flush_user_windows(void);
+int flush_user_windows_to_stack(caddr_t *);
+void trash_user_windows(void);
+void traceregs(struct regs *);
+void traceback(caddr_t);
+
+#endif /* defined(_KERNEL) && !defined(_ASM) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_STACK_H */
diff --git a/usr/src/uts/sparc/sys/stat_impl.h b/usr/src/uts/sparc/sys/stat_impl.h
new file mode 100644
index 0000000000..4b351b9cec
--- /dev/null
+++ b/usr/src/uts/sparc/sys/stat_impl.h
@@ -0,0 +1,80 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_STAT_IMPL_H
+#define _SYS_STAT_IMPL_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <sys/feature_tests.h>
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The implementation specific header for <sys/stat.h>
+ */
+
+#if !defined(_KERNEL) || defined(_BOOT)
+
+#if defined(__STDC__)
+
+extern int fstat(int, struct stat *);
+extern int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
+#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \
+ defined(_ATFILE_SOURCE)
+extern int fstatat(int, const char *, struct stat *, int);
+#endif /* defined (_ATFILE_SOURCE) */
+
+#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
+extern int lstat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD);
+extern int mknod(const char *, mode_t, dev_t);
+#endif /* (!defined(__XOPEN_OR_POSIX) ... */
+
+#else /* !__STDC__ */
+
+extern int fstat(), stat();
+
+#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \
+ defined(_ATFILE_SOURCE)
+extern int fstatat();
+#endif
+
+#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
+extern int lstat(), mknod();
+#endif /* !defined(__XOPEN_OR_POSIX)... */
+
+#endif /* !__STDC__ */
+
+#endif /* !defined(_KERNEL) || defined(_BOOT) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_STAT_IMPL_H */
diff --git a/usr/src/uts/sparc/sys/synch32.h b/usr/src/uts/sparc/sys/synch32.h
new file mode 100644
index 0000000000..1d45147bda
--- /dev/null
+++ b/usr/src/uts/sparc/sys/synch32.h
@@ -0,0 +1,86 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_SYNCH32_H
+#define _SYS_SYNCH32_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* special defines for LWP mutexes */
+#define mutex_flag flags.flag1
+#define mutex_ceiling flags.ceiling
+#define mutex_type flags.mbcp_type_un.mtype_rcount.count_type2
+#define mutex_rcount flags.mbcp_type_un.mtype_rcount.count_type1
+#define mutex_magic flags.magic
+#define mutex_owner data
+/* used to atomically operate on whole word via cas or swap instruction */
+#define mutex_lockword lock.lock32.lockword /* address of */
+#define mutex_lockw lock.lock64.pad[4]
+#define mutex_waiters lock.lock64.pad[7]
+
+/* process-shared lock owner pid */
+#define mutex_ownerpid lock.lock32.ownerpid
+
+/* Max. recusrion count for recursive mutexes */
+#define RECURSION_MAX 255
+
+/* special defines for LWP condition variables */
+#define cond_type flags.type
+#define cond_magic flags.magic
+#define cond_clockid flags.flag[1]
+#define cond_waiters_user flags.flag[2]
+#define cond_waiters_kernel flags.flag[3]
+
+/* special defines for LWP semaphores */
+#define sema_count count
+#define sema_type type
+#define sema_waiters flags[7]
+
+/* special defines for LWP rwlocks */
+#define rwlock_readers readers
+#define rwlock_type type
+#define rwlock_magic magic
+#define rwlock_mwaiters mutex.mutex_waiters
+#define rwlock_mlockw mutex.mutex_lockw
+#define rwlock_mowner mutex.mutex_owner
+#define rwlock_mownerpid mutex.mutex_ownerpid
+#define rwlock_owner readercv.data
+#define rwlock_ownerpid writercv.data
+
+#define URW_HAS_WAITERS 0x80000000
+#define URW_WRITE_WANTED 0x40000000
+#define URW_WRITE_LOCKED 0x20000000
+#define URW_READERS_MASK 0x1fffffff
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_SYNCH32_H */
diff --git a/usr/src/uts/sparc/sys/sysconfig_impl.h b/usr/src/uts/sparc/sys/sysconfig_impl.h
new file mode 100644
index 0000000000..0a715fc518
--- /dev/null
+++ b/usr/src/uts/sparc/sys/sysconfig_impl.h
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 1995 Sun Microsystems, Inc.
+ */
+/*
+ * sysconfig_impl.h:
+ *
+ * platform-specific variables for the SUN private sysconfig syscall
+ *
+ */
+
+#ifndef _SYS_SYSCONFIG_IMPL_H
+#define _SYS_SYSCONFIG_IMPL_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_SYSCONFIG_IMPL_H */
diff --git a/usr/src/uts/sparc/sys/trap.h b/usr/src/uts/sparc/sys/trap.h
new file mode 100644
index 0000000000..c3c5d2ba6d
--- /dev/null
+++ b/usr/src/uts/sparc/sys/trap.h
@@ -0,0 +1,88 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_TRAP_H
+#define _SYS_TRAP_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * This file is machine specific as is.
+ * Some trap types could be made common
+ * for all sparcs, but that is a project
+ * in and of itself.
+ */
+
+/*
+ * Software traps (ticc instructions).
+ */
+#define ST_OSYSCALL 0x00
+#define ST_BREAKPOINT 0x01
+#define ST_DIV0 0x02
+#define ST_FLUSH_WINDOWS 0x03
+#define ST_CLEAN_WINDOWS 0x04
+#define ST_RANGE_CHECK 0x05
+#define ST_FIX_ALIGN 0x06
+#define ST_INT_OVERFLOW 0x07
+#define ST_SYSCALL 0x08
+
+/*
+ * Software trap vectors 16 - 31 are reserved for use by the user
+ * and will not be usurped by Sun.
+ */
+
+#define ST_GETCC 0x20
+#define ST_SETCC 0x21
+#define ST_GETPSR 0x22
+#define ST_SETPSR 0x23
+#define ST_GETHRTIME 0x24
+#define ST_GETHRVTIME 0x25
+#define ST_SELFXCALL 0x26
+#define ST_GETHRESTIME 0x27
+#define ST_SETV9STACK 0x28
+#define ST_GETLGRP 0x29
+
+/*
+ * DTrace traps used for user-land tracing.
+ */
+#define ST_DTRACE_PID 0x38
+#define ST_DTRACE_PROBE 0x39
+#define ST_DTRACE_RETURN 0x3a
+
+#define ST_KMDB_TRAP 0x7d
+#define ST_KMDB_BREAKPOINT 0x7e
+#define ST_MON_BREAKPOINT 0x7f
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_TRAP_H */
diff --git a/usr/src/uts/sparc/sys/ucontext.h b/usr/src/uts/sparc/sys/ucontext.h
new file mode 100644
index 0000000000..ded11fdb95
--- /dev/null
+++ b/usr/src/uts/sparc/sys/ucontext.h
@@ -0,0 +1,160 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
+/* All Rights Reserved */
+
+
+/*
+ * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H
+
+#pragma ident "%Z%%M% %I% %E% SMI" /* from SVr4.0 1.10 */
+
+#include <sys/feature_tests.h>
+
+#include <sys/types.h>
+#include <sys/regset.h>
+#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
+#include <sys/signal.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Inclusion of <sys/signal.h> for sigset_t and stack_t definitions
+ * breaks XPG4v2 namespace. Therefore we must duplicate the defines
+ * for these types here when _XPG4_2 is defined.
+ */
+
+#if defined(_XPG4_2) && !defined(__EXTENSIONS__)
+#ifndef _SIGSET_T
+#define _SIGSET_T
+typedef struct { /* signal set type */
+ unsigned int __sigbits[4];
+} sigset_t;
+#endif /* _SIGSET_T */
+
+#ifndef _STACK_T
+#define _STACK_T
+typedef struct {
+ void *ss_sp;
+ size_t ss_size;
+ int ss_flags;
+} stack_t;
+
+#endif /* _STACK_T */
+#endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */
+
+#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
+typedef struct ucontext ucontext_t;
+#else
+typedef struct __ucontext ucontext_t;
+#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
+
+#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
+struct ucontext {
+#else
+struct __ucontext {
+#endif
+ uint_t uc_flags;
+ ucontext_t *uc_link;
+ sigset_t uc_sigmask;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+#ifdef __sparcv9
+ long uc_filler[4];
+#else /* __sparcv9 */
+ long uc_filler[23];
+#endif /* __sparcv9 */
+};
+
+#ifdef _SYSCALL32
+
+/* Kernel view of user ILP32 ucontext structure */
+
+typedef struct ucontext32 {
+ uint32_t uc_flags;
+ caddr32_t uc_link;
+ sigset32_t uc_sigmask;
+ stack32_t uc_stack;
+ mcontext32_t uc_mcontext;
+ int32_t uc_filler[23];
+} ucontext32_t;
+
+#ifdef _KERNEL
+extern void ucontext_32ton(const ucontext32_t *, ucontext_t *,
+ const struct fq32 *, struct fq *);
+extern void fpuregset_nto32(const fpregset_t *, fpregset32_t *, struct fq32 *);
+#endif
+
+#endif /* _SYSCALL32 */
+
+#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
+#define GETCONTEXT 0
+#define SETCONTEXT 1
+#define GETUSTACK 2
+#define SETUSTACK 3
+
+/*
+ * values for uc_flags
+ * these are implementation dependent flags, that should be hidden
+ * from the user interface, defining which elements of ucontext
+ * are valid, and should be restored on call to setcontext
+ */
+
+#define UC_SIGMASK 0x01
+#define UC_STACK 0x02
+#define UC_CPU 0x04
+#define UC_MAU 0x08
+#define UC_FPU UC_MAU
+#define UC_INTR 0x10
+#define UC_ASR 0x20
+
+#define UC_MCONTEXT (UC_CPU|UC_FPU|UC_ASR)
+
+/*
+ * UC_ALL specifies the default context
+ */
+
+#define UC_ALL (UC_SIGMASK|UC_STACK|UC_MCONTEXT)
+#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
+
+#ifdef _KERNEL
+extern void savecontext(ucontext_t *, k_sigset_t);
+extern void restorecontext(ucontext_t *);
+
+#ifdef _SYSCALL32
+extern void savecontext32(ucontext32_t *, k_sigset_t, struct fq32 *);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_UCONTEXT_H */
diff --git a/usr/src/uts/sparc/sys/utrap.h b/usr/src/uts/sparc/sys/utrap.h
new file mode 100644
index 0000000000..4dc0573f23
--- /dev/null
+++ b/usr/src/uts/sparc/sys/utrap.h
@@ -0,0 +1,116 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 1995-1999,2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _UTRAP_H
+#define _UTRAP_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * this file contains definitions for user-level traps.
+ */
+
+#define UT_INSTRUCTION_DISABLED 1
+#define UT_INSTRUCTION_ERROR 2
+#define UT_INSTRUCTION_PROTECTION 3
+#define UT_ILLTRAP_INSTRUCTION 4
+#define UT_ILLEGAL_INSTRUCTION 5
+#define UT_PRIVILEGED_OPCODE 6
+#define UT_FP_DISABLED 7
+#define UT_FP_EXCEPTION_IEEE_754 8
+#define UT_FP_EXCEPTION_OTHER 9
+#define UT_TAG_OVERFLOW 10
+#define UT_DIVISION_BY_ZERO 11
+#define UT_DATA_EXCEPTION 12
+#define UT_DATA_ERROR 13
+#define UT_DATA_PROTECTION 14
+#define UT_MEM_ADDRESS_NOT_ALIGNED 15
+#define UT_PRIVILEGED_ACTION 16
+#define UT_ASYNC_DATA_ERROR 17
+#define UT_TRAP_INSTRUCTION_16 18
+#define UT_TRAP_INSTRUCTION_17 19
+#define UT_TRAP_INSTRUCTION_18 20
+#define UT_TRAP_INSTRUCTION_19 21
+#define UT_TRAP_INSTRUCTION_20 22
+#define UT_TRAP_INSTRUCTION_21 23
+#define UT_TRAP_INSTRUCTION_22 24
+#define UT_TRAP_INSTRUCTION_23 25
+#define UT_TRAP_INSTRUCTION_24 26
+#define UT_TRAP_INSTRUCTION_25 27
+#define UT_TRAP_INSTRUCTION_26 28
+#define UT_TRAP_INSTRUCTION_27 29
+#define UT_TRAP_INSTRUCTION_28 30
+#define UT_TRAP_INSTRUCTION_29 31
+#define UT_TRAP_INSTRUCTION_30 32
+#define UT_TRAP_INSTRUCTION_31 33
+
+/*
+ * These defines exist only for the private v8plus install_utrap interface.
+ */
+#define UTRAP_V8P_FP_DISABLED UT_FP_DISABLED
+#define UTRAP_V8P_MEM_ADDRESS_NOT_ALIGNED UT_MEM_ADDRESS_NOT_ALIGNED
+
+#ifndef _ASM
+
+#define UTH_NOCHANGE ((utrap_handler_t)(-1))
+#define UTRAP_UTH_NOCHANGE UTH_NOCHANGE
+
+typedef int utrap_entry_t;
+typedef void *utrap_handler_t; /* user trap handler entry point */
+
+#ifdef __sparcv8plus
+int
+install_utrap(utrap_entry_t type, utrap_handler_t new_handler,
+ utrap_handler_t *old_handlerp);
+#endif /* __sparcv8plus */
+
+#ifdef _KERNEL
+struct proc;
+void utrap_dup(struct proc *pp, struct proc *cp);
+void utrap_free(struct proc *p);
+#endif /* _KERNEL */
+
+#ifdef __sparcv9
+int
+__sparc_utrap_install(utrap_entry_t type,
+ utrap_handler_t new_precise, utrap_handler_t new_deferred,
+ utrap_handler_t *old_precise, utrap_handler_t *old_deferred);
+#endif
+
+/* The trap_instruction user traps are precise only. */
+#define UT_PRECISE_MAXTRAPS 33
+
+#endif /* ASM */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _UTRAP_H */
diff --git a/usr/src/uts/sparc/sys/vmparam.h b/usr/src/uts/sparc/sys/vmparam.h
new file mode 100644
index 0000000000..25666e8540
--- /dev/null
+++ b/usr/src/uts/sparc/sys/vmparam.h
@@ -0,0 +1,85 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 1998 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
+/* All Rights Reserved */
+
+/*
+ * Portions of this source code were derived from Berkeley 4.3 BSD
+ * under license from the Regents of the University of California.
+ */
+
+#ifndef _SYS_VMPARAM_H
+#define _SYS_VMPARAM_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#if (defined(_KERNEL) || defined(_KMEMUSER)) && defined(_MACHDEP)
+#include <sys/vm_machparam.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SSIZE 4096 /* initial stack size */
+#define SINCR 4096 /* increment of stack */
+
+/*
+ * USRSTACK is the top (end) of the user stack.
+ */
+#define USRSTACK USERLIMIT
+#define USRSTACK32 USERLIMIT32
+
+/*
+ * Implementation architecture independent sections of the kernel use
+ * this section.
+ */
+#if (defined(_KERNEL) || defined(_KMEMUSER)) && !defined(_MACHDEP)
+
+#if defined(_KERNEL) && !defined(_ASM)
+extern const unsigned int _diskrpm;
+extern const unsigned long _dsize_limit;
+extern const unsigned long _ssize_limit;
+extern const unsigned long _pgthresh;
+extern const unsigned int _maxslp;
+extern const unsigned long _maxhandspreadpages;
+#endif /* defined(_KERNEL) && !defined(_ASM) */
+
+#define DISKRPM _diskrpm
+#define DSIZE_LIMIT _dsize_limit
+#define SSIZE_LIMIT _ssize_limit
+#define PGTHRESH _pgthresh
+#define MAXSLP _maxslp
+#define MAXHANDSPREADPAGES _maxhandspreadpages
+
+#endif /* (defined(_KERNEL) || defined(_KMEMUSER)) && !defined(_MACHDEP) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_VMPARAM_H */