Index: kernel/arch/sparc64/include/trap/trap_table.h
===================================================================
--- kernel/arch/sparc64/include/trap/trap_table.h	(revision 2ee907e74a1d87d148ea499f185a9d7ca1af4b61)
+++ kernel/arch/sparc64/include/trap/trap_table.h	(revision 819a7680d7084ac5520e063d46ba2f7f896b0183)
@@ -42,4 +42,26 @@
 #define TRAP_TABLE_SIZE		(TRAP_TABLE_ENTRY_COUNT * TRAP_TABLE_ENTRY_SIZE)
 
+/*
+ * The following needs to be in sync with the definition of the istate
+ * structure. The one STACK_ITEM_SIZE is counted for space holding the 7th
+ * argument to syscall_handler (i.e. syscall number) and the other
+ * STACK_ITEM_SIZE is counted because of the required alignment.
+ */
+#define PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE \
+    (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE + \
+    (2 * STACK_ITEM_SIZE) + (12 * 8))
+#define SAVED_TSTATE	-(1 * 8)
+#define SAVED_TPC	-(2 * 8)
+#define SAVED_TNPC	-(3 * 8)	/* <-- istate_t begins here */
+#define SAVED_Y		-(4 * 8)
+#define SAVED_I0	-(5 * 8)
+#define SAVED_I1	-(6 * 8)
+#define SAVED_I2	-(7 * 8)
+#define SAVED_I3	-(8 * 8)
+#define SAVED_I4	-(9 * 8)
+#define SAVED_I5	-(10 * 8)
+#define SAVED_I6	-(11 * 8)
+#define SAVED_I7	-(12 * 8)
+
 #ifndef __ASM__
 
@@ -77,26 +99,4 @@
 .endm
 
-/*
- * The following needs to be in sync with the definition of the istate
- * structure. The one STACK_ITEM_SIZE is counted for space holding the 7th
- * argument to syscall_handler (i.e. syscall number) and the other
- * STACK_ITEM_SIZE is counted because of the required alignment.
- */
-#define PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE	\
-    (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE + \
-    (2 * STACK_ITEM_SIZE) + (12 * 8))
-#define SAVED_TSTATE	-(1 * 8)
-#define SAVED_TPC	-(2 * 8)
-#define SAVED_TNPC	-(3 * 8)	/* <-- istate_t begins here */
-#define SAVED_Y		-(4 * 8)
-#define SAVED_I0	-(5 * 8)
-#define SAVED_I1	-(6 * 8)
-#define SAVED_I2	-(7 * 8)
-#define SAVED_I3	-(8 * 8)
-#define SAVED_I4	-(9 * 8)
-#define SAVED_I5	-(10 * 8)
-#define SAVED_I6	-(11 * 8)
-#define SAVED_I7	-(12 * 8)
-
 .macro PREEMPTIBLE_HANDLER f
 	sethi %hi(\f), %g1
Index: kernel/arch/sparc64/src/debug/stacktrace.c
===================================================================
--- kernel/arch/sparc64/src/debug/stacktrace.c	(revision 2ee907e74a1d87d148ea499f185a9d7ca1af4b61)
+++ kernel/arch/sparc64/src/debug/stacktrace.c	(revision 819a7680d7084ac5520e063d46ba2f7f896b0183)
@@ -37,5 +37,11 @@
 #include <typedefs.h>
 
+#include <arch.h>
 #include <arch/stack.h>
+#include <arch/trap/trap_table.h>
+
+#if defined(SUN4V)
+#include <arch/sun4v/arch.h>
+#endif
 
 #define FRAME_OFFSET_FP_PREV	14
@@ -46,4 +52,17 @@
 bool kernel_frame_pointer_validate(uintptr_t fp)
 {
+	uintptr_t kstack;
+	
+#if defined(SUN4U)
+	kstack = read_from_ag_g6();
+#elif defined(SUN4V)
+	kstack = asi_u64_read(ASI_SCRATCHPAD, SCRATCHPAD_KSTACK);
+#endif
+
+	kstack += STACK_BIAS;
+	kstack -= PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE;
+
+	if (THREAD && (fp == kstack))
+		return false;
 	return fp != 0;
 }
