Index: kernel/arch/sparc64/include/stack.h
===================================================================
--- kernel/arch/sparc64/include/stack.h	(revision 9b35499759aea1863b4a5b9ea28a713e50adcb90)
+++ kernel/arch/sparc64/include/stack.h	(revision d40a8ffa6b8ec244d5fe541f890ee182cc6727a9)
@@ -47,7 +47,23 @@
 
 /**
+ * Six extended words for first six arguments.
+ */
+#define STACK_ARG_SAVE_AREA_SIZE	(6 * STACK_ITEM_SIZE)
+
+/**
  * By convention, the actual top of the stack is %sp + STACK_BIAS.
  */
 #define STACK_BIAS            2047
+
+/*
+ * Offsets of arguments on stack.
+ */
+#define STACK_ARG0			0
+#define STACK_ARG1			8
+#define STACK_ARG2			16
+#define STACK_ARG3			24
+#define STACK_ARG4			32
+#define STACK_ARG5			40
+#define STACK_ARG6			48
 
 #endif
Index: kernel/arch/sparc64/include/syscall.h
===================================================================
--- kernel/arch/sparc64/include/syscall.h	(revision 9b35499759aea1863b4a5b9ea28a713e50adcb90)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup sparc64interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_SYSCALL_H_
-#define KERN_sparc64_SYSCALL_H_
-
-#include <arch/types.h>
-#include <arch/interrupt.h>
-
-extern unative_t syscall(int n, istate_t *istate, unative_t a1, unative_t a2, unative_t a3, unative_t a4);
-
-#endif
-
-/** @}
- */
Index: kernel/arch/sparc64/include/trap/syscall.h
===================================================================
--- kernel/arch/sparc64/include/trap/syscall.h	(revision 9b35499759aea1863b4a5b9ea28a713e50adcb90)
+++ kernel/arch/sparc64/include/trap/syscall.h	(revision d40a8ffa6b8ec244d5fe541f890ee182cc6727a9)
@@ -46,8 +46,6 @@
 
 .macro TRAP_INSTRUCTION n
-	mov TT_TRAP_INSTRUCTION(\n), %g2
-	sethi %hi(syscall), %g1
 	ba trap_instruction_handler
-	or %g1, %lo(syscall), %g1
+	mov TT_TRAP_INSTRUCTION(\n) - TT_TRAP_INSTRUCTION(0), %g2
 .endm
 
Index: kernel/arch/sparc64/include/trap/trap_table.h
===================================================================
--- kernel/arch/sparc64/include/trap/trap_table.h	(revision 9b35499759aea1863b4a5b9ea28a713e50adcb90)
+++ kernel/arch/sparc64/include/trap/trap_table.h	(revision d40a8ffa6b8ec244d5fe541f890ee182cc6727a9)
@@ -78,20 +78,24 @@
 
 /*
- * The following needs to be in sync with the
- * definition of the istate structure.
+ * 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+(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)
+#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
