changeset 4127:64886a16cf93

6539878 sparc brandz syscall wrappers don't collect trapstat data 6539890 sparc brandz syscall wrappers don't support sun4v 6540634 sparc sn1 brand fail on platforms where NCPU > 31
author edp
date Fri, 27 Apr 2007 14:21:30 -0700
parents 31652d91f33e
children b829e57f48ec
files usr/src/Makefile.psm usr/src/Makefile.psm.targ usr/src/pkgdefs/SUNWsn1rint/prototype_sparc usr/src/tools/scripts/bfu.sh usr/src/uts/Makefile.uts usr/src/uts/intel/Makefile.intel.shared usr/src/uts/sun4/brand/sn1/sn1_brand_asm.s usr/src/uts/sun4/ml/offsets.in usr/src/uts/sun4u/Makefile.rules usr/src/uts/sun4u/Makefile.sun4u.shared usr/src/uts/sun4u/brand/sn1/sn1_brand_asm.s usr/src/uts/sun4u/ml/trap_table.s usr/src/uts/sun4u/sn1_brand/Makefile usr/src/uts/sun4u/sys/machcpuvar.h usr/src/uts/sun4v/Makefile.files usr/src/uts/sun4v/Makefile.rules usr/src/uts/sun4v/Makefile.sun4v.shared usr/src/uts/sun4v/ml/trap_table.s usr/src/uts/sun4v/sn1_brand/Makefile usr/src/uts/sun4v/sys/machcpuvar.h
diffstat 20 files changed, 445 insertions(+), 190 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/Makefile.psm	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/Makefile.psm	Fri Apr 27 14:21:30 2007 -0700
@@ -66,6 +66,7 @@
 ROOT_PSM_DACF_DIR_32	 = $(ROOT_PSM_MOD_DIR)/dacf
 ROOT_PSM_CRYPTO_DIR_32	 = $(ROOT_PSM_MOD_DIR)/crypto
 ROOT_PSM_PCBE_DIR_32	 = $(ROOT_PSM_MOD_DIR)/pcbe
+ROOT_PSM_BRAND_DIR_32	 = $(ROOT_PSM_MOD_DIR)/brand
 
 ROOT_PSM_KERN_DIR_64	 = $(ROOT_PSM_MOD_DIR)/$(SUBDIR64)
 ROOT_PSM_DRV_DIR_64	 = $(ROOT_PSM_MOD_DIR)/drv/$(SUBDIR64)
@@ -84,6 +85,7 @@
 ROOT_PSM_DACF_DIR_64	 = $(ROOT_PSM_MOD_DIR)/dacf/$(SUBDIR64)
 ROOT_PSM_CRYPTO_DIR_64	 = $(ROOT_PSM_MOD_DIR)/crypto/$(SUBDIR64)
 ROOT_PSM_PCBE_DIR_64	 = $(ROOT_PSM_MOD_DIR)/pcbe/$(SUBDIR64)
+ROOT_PSM_BRAND_DIR_64	 = $(ROOT_PSM_MOD_DIR)/brand/$(SUBDIR64)
 
 ROOT_PSM_KERN_DIR	 = $(ROOT_PSM_KERN_DIR_$(CLASS))
 ROOT_PSM_DRV_DIR	 = $(ROOT_PSM_DRV_DIR_$(CLASS))
@@ -102,6 +104,7 @@
 ROOT_PSM_DACF_DIR	 = $(ROOT_PSM_DACF_DIR_$(CLASS))
 ROOT_PSM_CRYPTO_DIR	 = $(ROOT_PSM_CRYPTO_DIR_$(CLASS))
 ROOT_PSM_PCBE_DIR	 = $(ROOT_PSM_PCBE_DIR_$(CLASS))
+ROOT_PSM_BRAND_DIR	 = $(ROOT_PSM_BRAND_DIR_$(CLASS))
 
 ROOT_PSM_MOD_DIRS_32	 = $(ROOT_PSM_DRV_DIR_32)
 ROOT_PSM_MOD_DIRS_32 	+= $(ROOT_PSM_EXEC_DIR_32) $(ROOT_PSM_FS_DIR_32)
@@ -114,6 +117,7 @@
 ROOT_PSM_MOD_DIRS_32	+= $(ROOT_PSM_DACF_DIR_32)
 ROOT_PSM_MOD_DIRS_32	+= $(ROOT_PSM_CRYPTO_DIR_32)
 ROOT_PSM_MOD_DIRS_32	+= $(ROOT_PSM_PCBE_DIR_32)
+ROOT_PSM_MOD_DIRS_32	+= $(ROOT_PSM_BRAND_DIR_32)
 
 USR_PLAT_DIR		 = $(ROOT)/usr/platform
 
--- a/usr/src/Makefile.psm.targ	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/Makefile.psm.targ	Fri Apr 27 14:21:30 2007 -0700
@@ -111,6 +111,9 @@
 $(ROOT_PSM_PCBE_DIR)/%:		$(OBJS_DIR)/% $(ROOT_PSM_PCBE_DIR) FRC
 	$(INS.file)
 
+$(ROOT_PSM_BRAND_DIR)/%:	$(OBJS_DIR)/% $(ROOT_PSM_BRAND_DIR) FRC
+	$(INS.file)
+
 #
 #
 #
--- a/usr/src/pkgdefs/SUNWsn1rint/prototype_sparc	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/pkgdefs/SUNWsn1rint/prototype_sparc	Fri Apr 27 14:21:30 2007 -0700
@@ -19,7 +19,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -33,7 +33,14 @@
 !include prototype_com
 
 # the kernel brand module
-d none kernel 0755 root sys
-d none kernel/brand 0755 root sys
-d none kernel/brand/sparcv9 0755 root sys
-f none kernel/brand/sparcv9/sn1_brand 0755 root sys
+d none platform 0755 root sys
+d none platform/sun4u 0755 root sys
+d none platform/sun4u/kernel 0755 root sys
+d none platform/sun4u/kernel/brand 0755 root sys
+d none platform/sun4u/kernel/brand/sparcv9 0755 root sys
+f none platform/sun4u/kernel/brand/sparcv9/sn1_brand 0755 root sys
+d none platform/sun4v 0755 root sys
+d none platform/sun4v/kernel 0755 root sys
+d none platform/sun4v/kernel/brand 0755 root sys
+d none platform/sun4v/kernel/brand/sparcv9 0755 root sys
+f none platform/sun4v/kernel/brand/sparcv9/sn1_brand 0755 root sys
--- a/usr/src/tools/scripts/bfu.sh	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/tools/scripts/bfu.sh	Fri Apr 27 14:21:30 2007 -0700
@@ -6702,6 +6702,12 @@
 	rm -f $root/dev/cfg/*pci*
 
 	#
+	# remove the architecture-specific sn1_brand module since it's being
+	# replaced with platform-specific modules.
+	#
+	rm -f $root/kernel/brand/sparcv9/sn1_brand
+
+	#
 	# Remove I2O.
 	#
 	rm -f $root/kernel/drv/i2o_bs
--- a/usr/src/uts/Makefile.uts	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/uts/Makefile.uts	Fri Apr 27 14:21:30 2007 -0700
@@ -581,7 +581,7 @@
 		 $(MMU_KMODS) $(DACF_KMODS) $(EXPORT_KMODS) $(IPP_KMODS) \
 		 $(CRYPTO_KMODS) $(CRYPTO_EK_KMODS) $(PCBE_KMODS) \
 		 $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS)) $(MAC_KMODS) \
-		 $(DEVNAME_KMODS)
+		 $(DEVNAME_KMODS) $(BRAND_KMODS)
 
 KMODS = $(GENUNIX_KMODS) $(PARALLEL_KMODS)
 
@@ -595,7 +595,8 @@
 	  $(TOD_KMODS) $(STRMOD_KMODS) $(SYS_KMODS) $(MISC_KMODS) \
 	  $(MACH_KMODS) $(GSS_KMODS) $(DACF_KMODS) $(IPP_KMODS) \
 	  $(CRYPTO_KMODS) $(PCBE_KMODS) $(DEVNAME_KMODS) \
-	  $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS)) $(MAC_KMODS)
+	  $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS)) $(MAC_KMODS) \
+	  $(BRAND_KMODS)
 
 $(CLOSED_BUILD)CLOSED_LINT_KMODS = $(CLOSED_DRV_KMODS) $(CLOSED_TOD_KMODS) \
 	  $(CLOSED_MISC_KMODS) $(CLOSED_DRV_KMODS_$(CLASS))
--- a/usr/src/uts/intel/Makefile.intel.shared	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/uts/intel/Makefile.intel.shared	Fri Apr 27 14:21:30 2007 -0700
@@ -430,7 +430,7 @@
 #
 #	Brand modules
 #
-MISC_KMODS	+= sn1_brand lx_brand
+BRAND_KMODS	+= sn1_brand lx_brand
 DRV_KMODS	+= lx_systrace lx_ptm lx_audio
 STRMOD_KMODS	+= ldlinux
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/uts/sun4/brand/sn1/sn1_brand_asm.s	Fri Apr 27 14:21:30 2007 -0700
@@ -0,0 +1,185 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (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 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#if defined(lint)
+
+#include <sys/systm.h>
+
+#else	/* lint */
+
+#include <sys/asm_linkage.h>
+#include <sys/machthread.h>
+#include <sys/privregs.h>
+#include "assym.h"
+
+#endif	/* lint */
+
+#ifdef	lint
+
+void
+sn1_brand_syscall_callback(void)
+{
+}
+
+#else	/* lint */
+
+#ifdef sun4v
+
+#define GLOBALS_SWAP(reg)				\
+	rdpr	%gl, reg				;\
+	wrpr	reg, 1, %gl
+
+#define GLOBALS_RESTORE(reg)				\
+	wrpr	reg, 0, %gl
+
+#else /* !sun4v */
+
+#define GLOBALS_SWAP(reg)				\
+	rdpr	%pstate, reg				;\
+	wrpr	reg, PSTATE_AG, %pstate
+
+#define GLOBALS_RESTORE(reg)				\
+	wrpr	reg, %g0, %pstate
+
+#endif /* !sun4v */
+
+	/*
+	 * Input parameters:
+	 * %g1: return point
+	 * %g2: pointer to our cpu structure
+	 */
+	ENTRY(sn1_brand_syscall_callback)
+
+	/*
+	 * save some locals in the CPU tmp area to give us a little
+	 * room to work.
+	 */
+	stn	%l0, [%g2 + CPU_TMP1]
+	stn	%l1, [%g2 + CPU_TMP2]
+
+#ifdef sun4v
+	/*
+	 * On sun4v save our input parameters (which are stored in the
+	 * alternate globals) since we'll need to switch between alternate
+	 * globals and normal globals, and on sun4v the alternate globals
+	 * are not preserved across these types of switches.
+	 */
+	stn	%l2, [%g2 + CPU_TMP3]
+	stn	%l3, [%g2 + CPU_TMP4]
+	mov	%g1, %l2
+	mov	%g2, %l3
+#endif /* sun4v */
+
+	/*
+	 * Switch from the alternate to user globals to grab the syscall
+	 * number, then switch back to the alternate globals.
+	 *
+	 * If the system call number is >= 1024, then it is coming from the
+	 * emulation support library and should not be emulated.
+	 */
+	GLOBALS_SWAP(%l0)		! switch to normal globals
+	cmp	%g1, 1024		! is this call from the library?
+	bl,a	1f
+	mov	%g1, %l1		! delay slot - grab syscall number
+	sub	%g1, 1024, %g1		! convert magic num to real syscall
+	ba	2f			! jump back into syscall path
+1:
+	GLOBALS_RESTORE(%l0)		! delay slot -
+					! switch back to alternate globals
+
+	/*
+	 * Check to see if we want to interpose on this system call.  If
+	 * not, we jump back into the normal syscall path and pretend
+	 * nothing happened.
+	 */
+	set	sn1_emulation_table, %g3
+	ldn	[%g3], %g3
+	add	%g3, %l1, %g3
+	ldub	[%g3], %g3
+	brz	%g3, 2f
+	nop
+
+	/*
+	 * Find the address of the userspace handler.
+	 * cpu->cpu_thread->t_procp->p_brandhdlr.
+	 */
+#ifdef sun4v
+	! restore the alternate global registers after incrementing %gl
+	mov	%l3, %g2
+#endif /* sun4v */
+	ldn	[%g2 + CPU_THREAD], %g3		! load thread pointer
+	ldn	[%g3 + T_PROCP], %g3		! get proc pointer
+	ldn	[%g3 + P_BRAND_DATA], %g3	! get brand handler
+	brz	%g3, 2f				! has it been set?
+	nop
+
+	/*
+	 * Now the magic happens.  Grab the trap return address and then
+	 * reset it to point to the user space handler.  When we execute
+	 * the 'done' instruction, we will jump into our handler instead of
+	 * the user's code.  We also stick the old return address in %g6,
+	 * so we can return to the proper instruction in the user's code.
+	 * Note: we also pass back the base address of the syscall
+	 * emulation table.  This is a performance hack to avoid having to
+	 * look it up on every call.
+	 */
+	rdpr	%tnpc, %l1		! save old tnpc
+	wrpr	%g0, %g3, %tnpc		! setup tnpc
+	GLOBALS_SWAP(%l0)		! switch to normal globals
+	mov	%l1, %g6		! pass tnpc to user code in %g6
+	GLOBALS_RESTORE(%l0)		! switch back to alternate globals
+
+	/* Update the address we're going to return to */
+#ifdef sun4v
+	set	fast_trap_done_chk_intr, %l2
+#else /* !sun4v */
+	set	fast_trap_done_chk_intr, %g1
+#endif /* !sun4v */
+
+2:
+	/*
+	 * Restore registers before returning.
+	 *
+	 * Note that %g2 should be loaded with the CPU struct addr and
+	 * %g1 should be loaded the address we're going to return to.
+	 */
+#ifdef sun4v
+	! restore the alternate global registers after incrementing %gl
+	mov	%l3, %g2
+	mov	%l2, %g1
+
+	ldn	[%g2 + CPU_TMP4], %l3	! restore locals
+	ldn	[%g2 + CPU_TMP3], %l2
+#endif /* sun4v */
+
+	ldn	[%g2 + CPU_TMP2], %l1	! restore locals
+	ldn	[%g2 + CPU_TMP1], %l0
+
+	jmp	%g1
+	nop
+	SET_SIZE(sn1_brand_syscall_callback)
+#endif	/* lint */
--- a/usr/src/uts/sun4/ml/offsets.in	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/uts/sun4/ml/offsets.in	Fri Apr 27 14:21:30 2007 -0700
@@ -373,6 +373,8 @@
 	cpu_m.intrcnt			CPU_INTRCNT
 	cpu_m.tmp1			CPU_TMP1
 	cpu_m.tmp2			CPU_TMP2
+	cpu_m.tmp3			CPU_TMP3
+	cpu_m.tmp4			CPU_TMP4
 	cpu_m.ofd			CPU_OFD
 	cpu_m.lfd			CPU_LFD
 	cpu_m.otd			CPU_OTD
--- a/usr/src/uts/sun4u/Makefile.rules	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/uts/sun4u/Makefile.rules	Fri Apr 27 14:21:30 2007 -0700
@@ -20,7 +20,7 @@
 #
 
 #
-# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -113,7 +113,7 @@
 	$(COMPILE.c) -o $@ $<
 	$(CTFCONVERT_O)
 
-$(OBJS_DIR)/%.o:		$(UTSBASE)/sun4u/brand/sn1/%.s
+$(OBJS_DIR)/%.o:		$(UTSBASE)/sun4/brand/sn1/%.s
 	$(COMPILE.s) -o $@ $<
 
 $(OBJS_DIR)/%.o:		$(UTSBASE)/sun4u/vm/%.c
@@ -242,7 +242,7 @@
 $(LINTS_DIR)/%.ln:		$(UTSBASE)/sun4u/pcbe/%.c
 	@($(LHEAD) $(LINT.c) $< $(LTAIL))
 
-$(LINTS_DIR)/%.ln:		$(UTSBASE)/sun4u/brand/sn1/%.s
+$(LINTS_DIR)/%.ln:		$(UTSBASE)/sun4/brand/sn1/%.s
 	@($(LHEAD) $(LINT.s) $< $(LTAIL))
 
 $(LINTS_DIR)/%.ln:		$(UTSBASE)/sun4u/vm/%.c
--- a/usr/src/uts/sun4u/Makefile.sun4u.shared	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/uts/sun4u/Makefile.sun4u.shared	Fri Apr 27 14:21:30 2007 -0700
@@ -452,7 +452,7 @@
 #
 #	Brand modules
 #
-MISC_KMODS	+= sn1_brand
+BRAND_KMODS	+= sn1_brand
 
 $(CLOSED_BUILD)CLOSED_MISC_KMODS	+= gptwo_cpu gptwocfg
 
--- a/usr/src/uts/sun4u/brand/sn1/sn1_brand_asm.s	Fri Apr 27 09:21:03 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (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 2006 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-#if defined(lint)
-
-#include <sys/systm.h>
-
-#else	/* lint */
-
-#include <sys/asm_linkage.h>
-#include <sys/machthread.h>
-#include <sys/privregs.h>
-#include "assym.h"
-
-#endif	/* lint */
-
-#ifdef	lint
-
-void
-sn1_brand_syscall_callback(void)
-{
-}
-
-#else	/* lint */
-
-	ENTRY(sn1_brand_syscall_callback)
-
-	/*
-	 * save some locals in the CPU tmp area to give us a little
-	 * room to work.
-	 */
-	CPU_ADDR(%g2, %g3)		! load CPU struct addr to %g2 using %g3
-	stn	%l0, [%g2 + CPU_TMP1]
-	stn	%l1, [%g2 + CPU_TMP2]
-
-	/*
-	 * Switch from the alternate to user globals to grab the syscall
-	 * number, then switch back to the alternate globals.
-	 * 
-	 * If the system call number is >= 1024, then it is coming from the
-	 * emulation support library and should not be emulated.
-	 */
-	rdpr	%pstate, %l0
-	wrpr	%l0, PSTATE_AG, %pstate	! switch to normal globals
-	cmp	%g1, 1024		! is this call from the library?
-	bl,a	1f
-	mov	%g1, %l1		! delay slot - grab syscall number
-	sub	%g1, 1024, %g1		! convert magic num to real syscall
-	ba	2f			! jump back into syscall path
-1:
-	wrpr	%l0, %g0, %pstate	! switch back to alternate globals
-
-	/*
-	 * Check to see if we want to interpose on this system call.  If
-	 * not, we jump back into the normal syscall path and pretend
-	 * nothing happened.
-	 */
-	set	sn1_emulation_table, %g3
-	ldn	[%g3], %g3
-	add	%g3, %l1, %g3
-	ldub	[%g3], %g3
-	brz	%g3, 2f
-	nop
-
-	/*
-	 * Find the address of the userspace handler.
-	 * cpu->cpu_thread->t_procp->p_brandhdlr.
-	 */
-	ldn	[%g2 + CPU_THREAD], %g3		! load thread pointer
-	ldn	[%g3 + T_PROCP], %g3		! get proc pointer
-	ldn	[%g3 + P_BRAND_DATA], %g3	! get brand handler
-	brz	%g3, 2f				! has it been set?
-	nop
-
-	/*
-	 * Now the magic happens.  Grab the trap return address and then
-	 * reset it to point to the user space handler.  When we execute
-	 * the 'done' instruction, we will jump into our handler instead of
-	 * the user's code.  We also stick the old return address in %g6,
-	 * so we can return to the proper instruction in the user's code.
-	 * Note: we also pass back the base address of the syscall
-	 * emulation table.  This is a performance hack to avoid having to
-	 * look it up on every call.
-	 */
-	rdpr	%tnpc, %l1		! save old tnpc
-	wrpr	%g0, %g3, %tnpc		! setup tnpc
-	rdpr	%pstate, %l0
-	wrpr	%l0, PSTATE_AG, %pstate	! switch to normal globals
-	mov	%l1, %g6		! pass tnpc to user code in %g6
-	wrpr	%l0, %g0, %pstate	! switch back to alternate globals
-	set	fast_trap_done_chk_intr, %g1
-
-2:
-	! Note that %g2 still contains CPU struct addr
-	ldn	[%g2 + CPU_TMP2], %l1	! restore locals
-	ldn	[%g2 + CPU_TMP1], %l0
-	jmp	%g1
-	nop
-	SET_SIZE(sn1_brand_syscall_callback)
-#endif	/* lint */
-
--- a/usr/src/uts/sun4u/ml/trap_table.s	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/uts/sun4u/ml/trap_table.s	Fri Apr 27 14:21:30 2007 -0700
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -183,6 +183,9 @@
  */
 #define	SYSCALL(which)			\
 	TT_TRACE(trace_gen)		;\
+	SYSCALL_NOTT(which)
+
+#define	SYSCALL_NOTT(which)		\
 	set	(which), %g1		;\
 	ba,pt	%xcc, sys_trap		;\
 	sub	%g0, 1, %g4		;\
@@ -628,7 +631,7 @@
  * FILL_64bit_asi fills a 64-bit-wide register window from a 64-bit
  * wide address space via the designated asi.  It is used to fill
  * non-kernel windows.  The stack pointer is required to be eight-byte
- * aligned. 
+ * aligned.
  */
 #define	FILL_64bit_asi(asi_num, tail)				\
 	mov	V9BIAS64 + 0, %g1				;\
@@ -1441,11 +1444,11 @@
 	BAD;				/* 105	range check ?? */
 	GOTO(.fix_alignment);		/* 106	do unaligned references */
 	BAD;				/* 107	unused */
-#ifdef	DEBUG
-	GOTO(syscall_wrapper32)		/* 108	ILP32 system call on LP64 */
-#else
-	SYSCALL(syscall_trap32)		/* 108	ILP32 system call on LP64 */
-#endif
+#ifndef DEBUG
+	SYSCALL(syscall_trap32);	/* 108	ILP32 system call on LP64 */
+#else /* DEBUG */
+	GOTO(syscall_wrapper32);	/* 108	ILP32 system call on LP64 */
+#endif /* DEBUG */
 	GOTO(set_trap0_addr);		/* 109	set trap0 address */
 	BAD; BAD; BAD4;			/* 10A - 10F unused */
 	TRP4; TRP4; TRP4; TRP4;		/* 110 - 11F V9 user trap handlers */
@@ -1465,11 +1468,11 @@
 	BAD;				/* 139  unused */
 	DTRACE_RETURN;			/* 13A	dtrace pid return probe */
 	BAD; BAD4;			/* 13B - 13F unused */
-#ifdef	DEBUG
-	GOTO(syscall_wrapper)		/* 140  LP64 system call */
-#else
-	SYSCALL(syscall_trap)		/* 140  LP64 system call */
-#endif
+#ifndef DEBUG
+	SYSCALL(syscall_trap);		/* 140  LP64 system call */
+#else /* DEBUG */
+	GOTO(syscall_wrapper);		/* 140  LP64 system call */
+#endif /* DEBUG */
 	SYSCALL(nosys);			/* 141  unused system call trap */
 #ifdef DEBUG_USER_TRAPTRACECTL
 	GOTO(.traptrace_freeze);	/* 142  freeze traptrace */
@@ -1667,7 +1670,7 @@
 	set	dtlb_parity_trap, %g4
 	cmp	%g1, T_DATA_EXCEPTION		! to a IMMU exception
 	be	3f				! or DMMU exception.
-	nop	
+	nop
 2:
 	sllx	%g3, 32, %g3
 	or	%g3, %g1, %g3
@@ -1791,7 +1794,7 @@
 
 	brz,pt %g5, 3f			! if p_utraps == NULL goto trap()
 	  rdpr	%tt, %g3		! delay - get actual hw trap type
-	
+
 	sub	%g3, 254, %g1		! UT_TRAP_INSTRUCTION_16 = p_utraps[18]
 	ba,pt	%icc, 2f
 	  smul	%g1, CPTRSIZE, %g2
@@ -1805,7 +1808,7 @@
 
 	mov	1, %g1
 	st	%g1, [%g4 + CPU_TL1_HDLR] ! set CPU_TL1_HDLR
-	rdpr	%tpc, %g1		! ld trapping instruction using 
+	rdpr	%tpc, %g1		! ld trapping instruction using
 	lduwa	[%g1]ASI_AIUP, %g1	! "AS IF USER" ASI which could fault
 	st	%g0, [%g4 + CPU_TL1_HDLR] ! clr CPU_TL1_HDLR
 
@@ -1813,7 +1816,7 @@
 	andcc	%g1, %g4, %g4		! and instruction with mask
 	bnz,a,pt %icc, 3f		! if %g4 == zero, %g1 is an ILLTRAP
 	  nop				! fall thru to setup
-2:		
+2:
 	ldn	[%g5 + %g2], %g5
 	brnz,a,pt %g5, .setup_v9utrap
 	  nop
@@ -1920,7 +1923,7 @@
 	srl	%g2, FSR_FTT_SHIFT, %g7		! extract ftt from %fsr
 	and	%g7, (FSR_FTT>>FSR_FTT_SHIFT), %g7
 	cmp	%g7, FTT_UNFIN
-	set	FSR_TEM_NX, %g5	
+	set	FSR_TEM_NX, %g5
 	bne,pn	%xcc, .fp_exception_cont	! branch if NOT unfinished_FPop
 	  andcc	%g2, %g5, %g0
 	bne,pn	%xcc, .fp_exception_cont	! branch if FSR_TEM_NX enabled
@@ -2055,7 +2058,7 @@
 	ldx	[%g7], %g5
 1:
 	add	%g5, 1, %g6
-	
+
 	casxa	[%g7] ASI_N, %g5, %g6
 	cmp	%g5, %g6
 	bne,a,pn %xcc, 1b
@@ -3018,35 +3021,41 @@
  * systems.
  */
 #define	BRAND_CALLBACK(callback_id)					    \
-	CPU_ADDR(%g1, %g2)		/* load CPU struct addr to %g1	*/ ;\
-	ldn	[%g1 + CPU_THREAD], %g2	/* load thread pointer		*/ ;\
-	ldn	[%g2 + T_PROCP], %g2	/* get proc pointer		*/ ;\
-	ldn	[%g2 + P_BRAND], %g2	/* get brand pointer		*/ ;\
-	brz	%g2, 1f			/* No brand?  No callback. 	*/ ;\
+	CPU_ADDR(%g2, %g1)		/* load CPU struct addr to %g2	*/ ;\
+	ldn	[%g2 + CPU_THREAD], %g3	/* load thread pointer		*/ ;\
+	ldn	[%g3 + T_PROCP], %g3	/* get proc pointer		*/ ;\
+	ldn	[%g3 + P_BRAND], %g3	/* get brand pointer		*/ ;\
+	brz	%g3, 1f			/* No brand?  No callback. 	*/ ;\
 	nop 								   ;\
-	ldn	[%g2 + B_MACHOPS], %g2	/* get machops list		*/ ;\
-	ldn	[%g2 + (callback_id << 3)], %g2 			   ;\
-	brz	%g2, 1f							   ;\
+	ldn	[%g3 + B_MACHOPS], %g3	/* get machops list		*/ ;\
+	ldn	[%g3 + (callback_id << 3)], %g3 			   ;\
+	brz	%g3, 1f							   ;\
 	/*								    \
 	 * This isn't pretty.  We want a low-latency way for the callback   \
 	 * routine to decline to do anything.  We just pass in an address   \
 	 * the routine can directly jmp back to, pretending that nothing    \
 	 * has happened.						    \
+	 * 								    \
+	 * %g1: return address (where the brand handler jumps back to)	    \
+	 * %g2: address of CPU structure				    \
+	 * %g3: address of brand handler (where we will jump to)	    \
 	 */								    \
 	mov	%pc, %g1						   ;\
 	add	%g1, 16, %g1						   ;\
-	jmp	%g2							   ;\
+	jmp	%g3							   ;\
 	nop								   ;\
 1:
 
 	ENTRY_NP(syscall_wrapper32)
+	TT_TRACE(trace_gen)
 	BRAND_CALLBACK(BRAND_CB_SYSCALL32)
-	SYSCALL(syscall_trap32)
+	SYSCALL_NOTT(syscall_trap32)
 	SET_SIZE(syscall_wrapper32)
 
 	ENTRY_NP(syscall_wrapper)
+	TT_TRACE(trace_gen)
 	BRAND_CALLBACK(BRAND_CB_SYSCALL)
-	SYSCALL(syscall_trap)
+	SYSCALL_NOTT(syscall_trap)
 	SET_SIZE(syscall_wrapper)
 
 #endif	/* DEBUG */
--- a/usr/src/uts/sun4u/sn1_brand/Makefile	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/uts/sun4u/sn1_brand/Makefile	Fri Apr 27 14:21:30 2007 -0700
@@ -19,7 +19,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 #ident	"%Z%%M%	%I%	%E% SMI"
@@ -39,7 +39,7 @@
 MODULE		= sn1_brand
 OBJECTS		= $(SN1_BRAND_OBJS:%=$(OBJS_DIR)/%)
 LINTS		= $(SN1_BRAND_OBJS:%.o=$(LINTS_DIR)/%.ln)
-ROOTMODULE	= $(ROOT_BRAND_DIR)/$(MODULE)
+ROOTMODULE	= $(ROOT_PSM_BRAND_DIR)/$(MODULE)
 
 #
 #	Include common rules.
--- a/usr/src/uts/sun4u/sys/machcpuvar.h	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/uts/sun4u/sys/machcpuvar.h	Fri Apr 27 14:21:30 2007 -0700
@@ -104,6 +104,8 @@
 	uint8_t		intrcnt;	/* number of back-to-back interrupts */
 	u_longlong_t	tmp1;		/* per-cpu tmps */
 	u_longlong_t	tmp2;		/*  used in trap processing */
+	u_longlong_t	tmp3;
+	u_longlong_t	tmp4;
 
 	label_t		*ofd[HIGH_LEVELS];	/* saved pil ofd */
 	uintptr_t	lfd[HIGH_LEVELS];	/* saved ret PC */
--- a/usr/src/uts/sun4v/Makefile.files	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/uts/sun4v/Makefile.files	Fri Apr 27 14:21:30 2007 -0700
@@ -161,6 +161,11 @@
 PLATSVC_OBJS	= platsvc.o mdeg.o
 
 #
+#			Brand modules
+#
+SN1_BRAND_OBJS		= sn1_brand.o sn1_brand_asm.o
+
+#
 #			Performance Counter BackEnd (PCBE) Modules
 #
 NI_PCBE_OBJS	= niagara_pcbe.o
--- a/usr/src/uts/sun4v/Makefile.rules	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/uts/sun4v/Makefile.rules	Fri Apr 27 14:21:30 2007 -0700
@@ -62,6 +62,9 @@
 	$(COMPILE.c) -o $@ $<
 	$(CTFCONVERT_O)
 
+$(OBJS_DIR)/%.o:		$(UTSBASE)/sun4/brand/sn1/%.s
+	$(COMPILE.s) -o $@ $<
+
 $(OBJS_DIR)/%.o:		$(UTSBASE)/sun4v/promif/%.c
 	$(COMPILE.c) -o $@ $<
 	$(CTFCONVERT_O)
@@ -187,6 +190,9 @@
 $(LINTS_DIR)/%.ln:		$(UTSBASE)/sun4v/pcbe/%.c
 	@($(LHEAD) $(LINT.c) $< $(LTAIL))
 
+$(LINTS_DIR)/%.ln:		$(UTSBASE)/sun4/brand/sn1/%.s
+	@($(LHEAD) $(LINT.s) $< $(LTAIL))
+
 $(LINTS_DIR)/%.ln:		$(UTSBASE)/sun4v/promif/%.c
 	@($(LHEAD) $(LINT.c) $< $(LTAIL))
 
--- a/usr/src/uts/sun4v/Makefile.sun4v.shared	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/uts/sun4v/Makefile.sun4v.shared	Fri Apr 27 14:21:30 2007 -0700
@@ -72,7 +72,7 @@
 # This list should be empty.  A platform without platform modules
 # is a plain, generic sun4v platform.
 #
-#IMPLEMENTED_PLATFORM	= 
+#IMPLEMENTED_PLATFORM	=
 #PLATFORMS                = $(IMPLEMENTED_PLATFORM)
 
 IMPLEMENTATIONS		= ontario montoya
@@ -100,7 +100,7 @@
 DSF_DIR		 = $(UTSBASE)/$(PLATFORM)/genassym
 LINTS_DIR	 = $(OBJS_DIR)
 LINT_LIB_DIR	 = $(UTSBASE)/$(PLATFORM)/lint-libs/$(OBJS_DIR)
- 
+
 DTRACESTUBS_O	 = $(OBJS_DIR)/dtracestubs.o
 DTRACESTUBS	 = $(OBJS_DIR)/libdtracestubs.so
 
@@ -239,7 +239,7 @@
 DEBUG_DEFS		= $(DEBUG_DEFS_$(BUILD_TYPE))
 
 DEBUG_COND_OBJ64	:sh = echo \\043
-DEBUG_COND_DBG64	= 
+DEBUG_COND_DBG64	=
 IF_DEBUG_OBJ		= $(DEBUG_COND_$(BUILD_TYPE))$(OBJS_DIR)/
 
 $(IF_DEBUG_OBJ)trap.o		:=	DEBUG_DEFS	+= -DTRAPDEBUG
@@ -275,7 +275,7 @@
 #$(IF_DEBUG_OBJ)lock_prim.o	:= DEBUG_DEFS	+= -DDISP_LOCK_STATS
 #$(IF_DEBUG_OBJ)disp.o		:= DEBUG_DEFS	+= -DDISP_LOCK_STATS
 
-# Comment these out if you don't want dispatcher debugging 
+# Comment these out if you don't want dispatcher debugging
 
 #$(IF_DEBUG_OBJ)lock_prim.o	:= DEBUG_DEFS	+= -DDISP_DEBUG
 
@@ -341,7 +341,7 @@
 DRV_KMODS	+= rootnex
 DRV_KMODS       += su
 DRV_KMODS	+= trapstat
-DRV_KMODS	+= vcc 
+DRV_KMODS	+= vcc
 DRV_KMODS	+= vdc
 DRV_KMODS	+= vds
 DRV_KMODS	+= vldc
@@ -382,21 +382,26 @@
 #
 #	'User' Modules (/kernel/misc):
 #
-MISC_KMODS	+= bootdev 
-MISC_KMODS	+= dr_cpu 
+MISC_KMODS	+= bootdev
+MISC_KMODS	+= dr_cpu
 MISC_KMODS	+= ds
 MISC_KMODS	+= fault_iso
-MISC_KMODS	+= ldc 
-MISC_KMODS	+= obpsym 
-MISC_KMODS	+= platmod 
-MISC_KMODS	+= platsvc 
-MISC_KMODS	+= vis 
- 
+MISC_KMODS	+= ldc
+MISC_KMODS	+= obpsym
+MISC_KMODS	+= platmod
+MISC_KMODS	+= platsvc
+MISC_KMODS	+= vis
+
 #	md5 optimized for Niagara
 #
 MISC_KMODS	+= md5
 
 #
+#	Brand modules
+#
+BRAND_KMODS	+= sn1_brand
+
+#
 #	Software Cryptographic Providers (/kernel/crypto):
 #
 # Don't build this for OpenSolaris, since it will be replaced by
--- a/usr/src/uts/sun4v/ml/trap_table.s	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/uts/sun4v/ml/trap_table.s	Fri Apr 27 14:21:30 2007 -0700
@@ -36,6 +36,7 @@
 #include <sys/hypervisor_api.h>
 #include <sys/machtrap.h>
 #include <sys/machthread.h>
+#include <sys/machbrand.h>
 #include <sys/pcb.h>
 #include <sys/pte.h>
 #include <sys/mmu.h>
@@ -187,6 +188,9 @@
  */
 #define	SYSCALL(which)			\
 	TT_TRACE(trace_gen)		;\
+	SYSCALL_NOTT(which)
+
+#define	SYSCALL_NOTT(which)		\
 	set	(which), %g1		;\
 	ba,pt	%xcc, sys_trap		;\
 	sub	%g0, 1, %g4		;\
@@ -544,7 +548,7 @@
  * FILL_64bit_asi fills a 64-bit-wide register window from a 64-bit
  * wide address space via the designated asi.  It is used to fill
  * non-kernel windows.  The stack pointer is required to be eight-byte
- * aligned. 
+ * aligned.
  */
 #define	FILL_64bit_asi(asi_num, tail)				\
 	mov	V9BIAS64 + 0, %g1				;\
@@ -827,7 +831,7 @@
 	ba,a,pt	%xcc, .watchdog_trap	;\
 	.align	32
 
-	
+
 /*
  * MMU Trap Handlers.
  */
@@ -882,7 +886,7 @@
 	.align	32
 /*
  * SPARC V9 IMPL. DEP. #109(1) and (2) and #110(1) and (2)
- */	 
+ */
 
 /*
  * synthesize for trap(): SFAR in %g2, SFSR in %g3
@@ -1226,7 +1230,11 @@
 	BAD;				/* 105	range check ?? */
 	GOTO(.fix_alignment);		/* 106	do unaligned references */
 	BAD;				/* 107	unused */
+#ifndef DEBUG
 	SYSCALL(syscall_trap32);	/* 108	ILP32 system call on LP64 */
+#else /* DEBUG */
+	GOTO(syscall_wrapper32);	/* 108	ILP32 system call on LP64 */
+#endif /* DEBUG */
 	GOTO(set_trap0_addr);		/* 109	set trap0 address */
 	BAD; BAD; BAD4;			/* 10A - 10F unused */
 	TRP4; TRP4; TRP4; TRP4;		/* 110 - 11F V9 user trap handlers */
@@ -1246,7 +1254,11 @@
 	BAD;				/* 139  unused */
 	DTRACE_RETURN;			/* 13A	dtrace pid return probe */
 	BAD; BAD4;			/* 13B - 13F unused */
-	SYSCALL(syscall_trap)		/* 140  LP64 system call */
+#ifndef DEBUG
+	SYSCALL(syscall_trap);		/* 140  LP64 system call */
+#else /* DEBUG */
+	GOTO(syscall_wrapper);		/* 140  LP64 system call */
+#endif /* DEBUG */
 	SYSCALL(nosys);			/* 141  unused system call trap */
 #ifdef DEBUG_USER_TRAPTRACECTL
 	GOTO(.traptrace_freeze);	/* 142  freeze traptrace */
@@ -1569,7 +1581,7 @@
 
 	brz,pt %g5, 3f			! if p_utraps == NULL goto trap()
 	  rdpr	%tt, %g3		! delay - get actual hw trap type
-	
+
 	sub	%g3, 254, %g1		! UT_TRAP_INSTRUCTION_16 = p_utraps[18]
 	ba,pt	%icc, 2f
 	  smul	%g1, CPTRSIZE, %g2
@@ -1583,7 +1595,7 @@
 
 	mov	1, %g1
 	st	%g1, [%g4 + CPU_TL1_HDLR] ! set CPU_TL1_HDLR
-	rdpr	%tpc, %g1		! ld trapping instruction using 
+	rdpr	%tpc, %g1		! ld trapping instruction using
 	lduwa	[%g1]ASI_AIUP, %g1	! "AS IF USER" ASI which could fault
 	st	%g0, [%g4 + CPU_TL1_HDLR] ! clr CPU_TL1_HDLR
 
@@ -1591,7 +1603,7 @@
 	andcc	%g1, %g4, %g4		! and instruction with mask
 	bnz,a,pt %icc, 3f		! if %g4 == zero, %g1 is an ILLTRAP
 	  nop				! fall thru to setup
-2:		
+2:
 	ldn	[%g5 + %g2], %g5
 	brnz,a,pt %g5, .setup_v9utrap
 	  nop
@@ -1698,7 +1710,7 @@
 	srl	%g2, FSR_FTT_SHIFT, %g7		! extract ftt from %fsr
 	and	%g7, (FSR_FTT>>FSR_FTT_SHIFT), %g7
 	cmp	%g7, FTT_UNFIN
-	set	FSR_TEM_NX, %g5	
+	set	FSR_TEM_NX, %g5
 	bne,pn	%xcc, .fp_exception_cont	! branch if NOT unfinished_FPop
 	  andcc	%g2, %g5, %g0
 	bne,pn	%xcc, .fp_exception_cont	! branch if FSR_TEM_NX enabled
@@ -1833,7 +1845,7 @@
 	ldx	[%g7], %g5
 1:
 	add	%g5, 1, %g6
-	
+
 	casxa	[%g7] ASI_N, %g5, %g6
 	cmp	%g5, %g6
 	bne,a,pn %xcc, 1b
@@ -2849,4 +2861,52 @@
 	retl
 	nop
 
+#ifdef	DEBUG
+/*
+ * Currently we only support syscall interposition for branded zones on
+ * DEBUG kernels.  The only brand that makes use of this functionality is
+ * the fake Solaris 10 brand.  Since this brand is only used for exercising
+ * the framework, we don't want this overhead incurred on production
+ * systems.
+ */
+#define	BRAND_CALLBACK(callback_id)					    \
+	CPU_ADDR(%g2, %g1)		/* load CPU struct addr to %g2	*/ ;\
+	ldn	[%g2 + CPU_THREAD], %g3	/* load thread pointer		*/ ;\
+	ldn	[%g3 + T_PROCP], %g3	/* get proc pointer		*/ ;\
+	ldn	[%g3 + P_BRAND], %g3	/* get brand pointer		*/ ;\
+	brz	%g3, 1f			/* No brand?  No callback. 	*/ ;\
+	nop 								   ;\
+	ldn	[%g3 + B_MACHOPS], %g3	/* get machops list		*/ ;\
+	ldn	[%g3 + (callback_id << 3)], %g3 			   ;\
+	brz	%g3, 1f							   ;\
+	/*								    \
+	 * This isn't pretty.  We want a low-latency way for the callback   \
+	 * routine to decline to do anything.  We just pass in an address   \
+	 * the routine can directly jmp back to, pretending that nothing    \
+	 * has happened.						    \
+	 * 								    \
+	 * %g1: return address (where the brand handler jumps back to)	    \
+	 * %g2: address of CPU structure				    \
+	 * %g3: address of brand handler (where we will jump to)	    \
+	 */								    \
+	mov	%pc, %g1						   ;\
+	add	%g1, 16, %g1						   ;\
+	jmp	%g3							   ;\
+	nop								   ;\
+1:
+
+	ENTRY_NP(syscall_wrapper32)
+	TT_TRACE(trace_gen)
+	BRAND_CALLBACK(BRAND_CB_SYSCALL32)
+	SYSCALL_NOTT(syscall_trap32)
+	SET_SIZE(syscall_wrapper32)
+
+	ENTRY_NP(syscall_wrapper)
+	TT_TRACE(trace_gen)
+	BRAND_CALLBACK(BRAND_CB_SYSCALL)
+	SYSCALL_NOTT(syscall_trap)
+	SET_SIZE(syscall_wrapper)
+
+#endif	/* DEBUG */
+
 #endif	/* lint */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/uts/sun4v/sn1_brand/Makefile	Fri Apr 27 14:21:30 2007 -0700
@@ -0,0 +1,83 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (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 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+#
+#	This makefile drives the production of the kernel component of
+#	the N-1 Solaris brand
+#
+
+#
+#	Path to the base of the uts directory tree (usually /usr/src/uts).
+#
+UTSBASE		= ../..
+
+#
+#	Define the module and object file sets.
+#
+MODULE		= sn1_brand
+OBJECTS		= $(SN1_BRAND_OBJS:%=$(OBJS_DIR)/%)
+LINTS		= $(SN1_BRAND_OBJS:%.o=$(LINTS_DIR)/%.ln)
+ROOTMODULE	= $(ROOT_PSM_BRAND_DIR)/$(MODULE)
+
+#
+#	Include common rules.
+#
+include $(UTSBASE)/sun4v/Makefile.sun4v
+
+#
+#	Define targets
+#
+ALL_TARGET	= $(BINARY)
+LINT_TARGET	= $(MODULE).lint
+INSTALL_TARGET	= $(BINARY) $(ROOTMODULE)
+
+INC_PATH += -I$(UTSBASE)/common/brand/sn1
+
+
+#
+#	Default build targets.
+#
+.KEEP_STATE:
+
+def:		$(DEF_DEPS)
+
+all:		$(ALL_DEPS)
+
+clean:		$(CLEAN_DEPS)
+
+clobber:	$(CLOBBER_DEPS)
+
+lint:		$(LINT_DEPS)
+
+modlintlib:	$(MODLINTLIB_DEPS)
+
+clean.lint:	$(CLEAN_LINT_DEPS)
+
+install:	$(INSTALL_DEPS)
+
+#
+#	Include common targets.
+#
+include $(UTSBASE)/sun4v/Makefile.targ
--- a/usr/src/uts/sun4v/sys/machcpuvar.h	Fri Apr 27 09:21:03 2007 -0700
+++ b/usr/src/uts/sun4v/sys/machcpuvar.h	Fri Apr 27 14:21:30 2007 -0700
@@ -111,6 +111,8 @@
 	uint8_t		intrcnt;	/* number of back-to-back interrupts */
 	u_longlong_t	tmp1;		/* per-cpu tmps */
 	u_longlong_t	tmp2;		/*  used in trap processing */
+	u_longlong_t	tmp3;
+	u_longlong_t	tmp4;
 
 	label_t		*ofd[HIGH_LEVELS];	/* saved pil ofd */
 	uintptr_t	lfd[HIGH_LEVELS];	/* saved ret PC */