Index: kernel/arch/sparc64/include/trap/syscall.h
===================================================================
--- kernel/arch/sparc64/include/trap/syscall.h	(revision d93a1c5a998734e45dee0e8958fd96dda0093dac)
+++ kernel/arch/sparc64/include/trap/syscall.h	(revision 3b8fe85c2724c9334d223f7746537735cb1b95e0)
@@ -32,7 +32,5 @@
 /**
  * @file
- * @brief This file contains the trap_instruction handler.
- *
- * The trap_instruction trap is used to implement syscalls.
+ * @brief
  */
 
@@ -40,15 +38,5 @@
 #define KERN_sparc64_SYSCALL_TRAP_H_
 
-#define TT_TRAP_INSTRUCTION(n)		(0x100 + (n))
-#define TT_TRAP_INSTRUCTION_LAST	TT_TRAP_INSTRUCTION(127)
-
-#ifdef __ASM__
-
-.macro TRAP_INSTRUCTION n
-	ba trap_instruction_handler
-	mov TT_TRAP_INSTRUCTION(\n) - TT_TRAP_INSTRUCTION(0), %g2
-.endm
-
-#endif /* __ASM__ */
+#define TT_TRAP_INSTRUCTION_0		0x100
 
 #endif
Index: kernel/arch/sparc64/src/trap/trap_table.S
===================================================================
--- kernel/arch/sparc64/src/trap/trap_table.S	(revision d93a1c5a998734e45dee0e8958fd96dda0093dac)
+++ kernel/arch/sparc64/src/trap/trap_table.S	(revision 3b8fe85c2724c9334d223f7746537735cb1b95e0)
@@ -330,249 +330,19 @@
 	FILL_NORMAL_HANDLER_USERSPACE
 
-/* TT = 0x100, TL = 0, trap_instruction_0 */
-.org trap_table + TT_TRAP_INSTRUCTION(0)*ENTRY_SIZE
-.global trap_instruction_0_tl0
-trap_instruction_0_tl0:
-	TRAP_INSTRUCTION 0
-
-/* TT = 0x101, TL = 0, trap_instruction_1 */
-.org trap_table + TT_TRAP_INSTRUCTION(1)*ENTRY_SIZE
-.global trap_instruction_1_tl0
-trap_instruction_1_tl0:
-	TRAP_INSTRUCTION 1
-
-/* TT = 0x102, TL = 0, trap_instruction_2 */
-.org trap_table + TT_TRAP_INSTRUCTION(2)*ENTRY_SIZE
-.global trap_instruction_2_tl0
-trap_instruction_2_tl0:
-	TRAP_INSTRUCTION 2
-
-/* TT = 0x103, TL = 0, trap_instruction_3 */
-.org trap_table + TT_TRAP_INSTRUCTION(3)*ENTRY_SIZE
-.global trap_instruction_3_tl0
-trap_instruction_3_tl0:
-	TRAP_INSTRUCTION 3
-
-/* TT = 0x104, TL = 0, trap_instruction_4 */
-.org trap_table + TT_TRAP_INSTRUCTION(4)*ENTRY_SIZE
-.global trap_instruction_4_tl0
-trap_instruction_4_tl0:
-	TRAP_INSTRUCTION 4
-
-/* TT = 0x105, TL = 0, trap_instruction_5 */
-.org trap_table + TT_TRAP_INSTRUCTION(5)*ENTRY_SIZE
-.global trap_instruction_5_tl0
-trap_instruction_5_tl0:
-	TRAP_INSTRUCTION 5
-
-/* TT = 0x106, TL = 0, trap_instruction_6 */
-.org trap_table + TT_TRAP_INSTRUCTION(6)*ENTRY_SIZE
-.global trap_instruction_6_tl0
-trap_instruction_6_tl0:
-	TRAP_INSTRUCTION 6
-
-/* TT = 0x107, TL = 0, trap_instruction_7 */
-.org trap_table + TT_TRAP_INSTRUCTION(7)*ENTRY_SIZE
-.global trap_instruction_7_tl0
-trap_instruction_7_tl0:
-	TRAP_INSTRUCTION 7
-
-/* TT = 0x108, TL = 0, trap_instruction_8 */
-.org trap_table + TT_TRAP_INSTRUCTION(8)*ENTRY_SIZE
-.global trap_instruction_8_tl0
-trap_instruction_8_tl0:
-	TRAP_INSTRUCTION 8
-
-/* TT = 0x109, TL = 0, trap_instruction_9 */
-.org trap_table + TT_TRAP_INSTRUCTION(9)*ENTRY_SIZE
-.global trap_instruction_9_tl0
-trap_instruction_9_tl0:
-	TRAP_INSTRUCTION 9
-
-/* TT = 0x10a, TL = 0, trap_instruction_10 */
-.org trap_table + TT_TRAP_INSTRUCTION(10)*ENTRY_SIZE
-.global trap_instruction_10_tl0
-trap_instruction_10_tl0:
-	TRAP_INSTRUCTION 10
-
-/* TT = 0x10b, TL = 0, trap_instruction_11 */
-.org trap_table + TT_TRAP_INSTRUCTION(11)*ENTRY_SIZE
-.global trap_instruction_11_tl0
-trap_instruction_11_tl0:
-	TRAP_INSTRUCTION 11
-
-/* TT = 0x10c, TL = 0, trap_instruction_12 */
-.org trap_table + TT_TRAP_INSTRUCTION(12)*ENTRY_SIZE
-.global trap_instruction_12_tl0
-trap_instruction_12_tl0:
-	TRAP_INSTRUCTION 12
-
-/* TT = 0x10d, TL = 0, trap_instruction_13 */
-.org trap_table + TT_TRAP_INSTRUCTION(13)*ENTRY_SIZE
-.global trap_instruction_13_tl0
-trap_instruction_13_tl0:
-	TRAP_INSTRUCTION 13
-
-/* TT = 0x10e, TL = 0, trap_instruction_14 */
-.org trap_table + TT_TRAP_INSTRUCTION(14)*ENTRY_SIZE
-.global trap_instruction_14_tl0
-trap_instruction_14_tl0:
-	TRAP_INSTRUCTION 14
-
-/* TT = 0x10f, TL = 0, trap_instruction_15 */
-.org trap_table + TT_TRAP_INSTRUCTION(15)*ENTRY_SIZE
-.global trap_instruction_15_tl0
-trap_instruction_15_tl0:
-	TRAP_INSTRUCTION 15
-
-/* TT = 0x110, TL = 0, trap_instruction_16 */
-.org trap_table + TT_TRAP_INSTRUCTION(16)*ENTRY_SIZE
-.global trap_instruction_16_tl0
-trap_instruction_16_tl0:
-	TRAP_INSTRUCTION 16
-
-/* TT = 0x111, TL = 0, trap_instruction_17 */
-.org trap_table + TT_TRAP_INSTRUCTION(17)*ENTRY_SIZE
-.global trap_instruction_17_tl0
-trap_instruction_17_tl0:
-	TRAP_INSTRUCTION 17
-
-/* TT = 0x112, TL = 0, trap_instruction_18 */
-.org trap_table + TT_TRAP_INSTRUCTION(18)*ENTRY_SIZE
-.global trap_instruction_18_tl0
-trap_instruction_18_tl0:
-	TRAP_INSTRUCTION 18
-
-/* TT = 0x113, TL = 0, trap_instruction_19 */
-.org trap_table + TT_TRAP_INSTRUCTION(19)*ENTRY_SIZE
-.global trap_instruction_19_tl0
-trap_instruction_19_tl0:
-	TRAP_INSTRUCTION 19
-
-/* TT = 0x114, TL = 0, trap_instruction_20 */
-.org trap_table + TT_TRAP_INSTRUCTION(20)*ENTRY_SIZE
-.global trap_instruction_20_tl0
-trap_instruction_20_tl0:
-	TRAP_INSTRUCTION 20
-
-/* TT = 0x115, TL = 0, trap_instruction_21 */
-.org trap_table + TT_TRAP_INSTRUCTION(21)*ENTRY_SIZE
-.global trap_instruction_21_tl0
-trap_instruction_21_tl0:
-	TRAP_INSTRUCTION 21
-
-/* TT = 0x116, TL = 0, trap_instruction_22 */
-.org trap_table + TT_TRAP_INSTRUCTION(22)*ENTRY_SIZE
-.global trap_instruction_22_tl0
-trap_instruction_22_tl0:
-	TRAP_INSTRUCTION 22
-
-/* TT = 0x117, TL = 0, trap_instruction_23 */
-.org trap_table + TT_TRAP_INSTRUCTION(23)*ENTRY_SIZE
-.global trap_instruction_23_tl0
-trap_instruction_23_tl0:
-	TRAP_INSTRUCTION 23
-
-/* TT = 0x118, TL = 0, trap_instruction_24 */
-.org trap_table + TT_TRAP_INSTRUCTION(24)*ENTRY_SIZE
-.global trap_instruction_24_tl0
-trap_instruction_24_tl0:
-	TRAP_INSTRUCTION 24
-
-/* TT = 0x119, TL = 0, trap_instruction_25 */
-.org trap_table + TT_TRAP_INSTRUCTION(25)*ENTRY_SIZE
-.global trap_instruction_25_tl0
-trap_instruction_25_tl0:
-	TRAP_INSTRUCTION 25
-
-/* TT = 0x11a, TL = 0, trap_instruction_26 */
-.org trap_table + TT_TRAP_INSTRUCTION(26)*ENTRY_SIZE
-.global trap_instruction_26_tl0
-trap_instruction_26_tl0:
-	TRAP_INSTRUCTION 26
-
-/* TT = 0x11b, TL = 0, trap_instruction_27 */
-.org trap_table + TT_TRAP_INSTRUCTION(27)*ENTRY_SIZE
-.global trap_instruction_27_tl0
-trap_instruction_27_tl0:
-	TRAP_INSTRUCTION 27
-
-/* TT = 0x11c, TL = 0, trap_instruction_28 */
-.org trap_table + TT_TRAP_INSTRUCTION(28)*ENTRY_SIZE
-.global trap_instruction_28_tl0
-trap_instruction_28_tl0:
-	TRAP_INSTRUCTION 28
-
-/* TT = 0x11d, TL = 0, trap_instruction_29 */
-.org trap_table + TT_TRAP_INSTRUCTION(29)*ENTRY_SIZE
-.global trap_instruction_29_tl0
-trap_instruction_29_tl0:
-	TRAP_INSTRUCTION 29
-
-/* TT = 0x11e, TL = 0, trap_instruction_30 */
-.org trap_table + TT_TRAP_INSTRUCTION(30)*ENTRY_SIZE
-.global trap_instruction_30_tl0
-trap_instruction_30_tl0:
-	TRAP_INSTRUCTION 30
-
-/* TT = 0x11f, TL = 0, trap_instruction_31 */
-.org trap_table + TT_TRAP_INSTRUCTION(31)*ENTRY_SIZE
-.global trap_instruction_31_tl0
-trap_instruction_31_tl0:
-	TRAP_INSTRUCTION 31
-
-/* TT = 0x120, TL = 0, trap_instruction_32 */
-.org trap_table + TT_TRAP_INSTRUCTION(32)*ENTRY_SIZE
-.global trap_instruction_32_tl0
-trap_instruction_32_tl0:
-	TRAP_INSTRUCTION 32
-
-/* TT = 0x121, TL = 0, trap_instruction_33 */
-.org trap_table + TT_TRAP_INSTRUCTION(33)*ENTRY_SIZE
-.global trap_instruction_33_tl0
-trap_instruction_33_tl0:
-	TRAP_INSTRUCTION 33
-
-/* TT = 0x122, TL = 0, trap_instruction_34 */
-.org trap_table + TT_TRAP_INSTRUCTION(34)*ENTRY_SIZE
-.global trap_instruction_34_tl0
-trap_instruction_34_tl0:
-	TRAP_INSTRUCTION 34
-
-/* TT = 0x123, TL = 0, trap_instruction_35 */
-.org trap_table + TT_TRAP_INSTRUCTION(35)*ENTRY_SIZE
-.global trap_instruction_35_tl0
-trap_instruction_35_tl0:
-	TRAP_INSTRUCTION 35
-
-/* TT = 0x124, TL = 0, trap_instruction_36 */
-.org trap_table + TT_TRAP_INSTRUCTION(36)*ENTRY_SIZE
-.global trap_instruction_36_tl0
-trap_instruction_36_tl0:
-	TRAP_INSTRUCTION 36
-
-/* TT = 0x125, TL = 0, trap_instruction_37 */
-.org trap_table + TT_TRAP_INSTRUCTION(37)*ENTRY_SIZE
-.global trap_instruction_37_tl0
-trap_instruction_37_tl0:
-	TRAP_INSTRUCTION 37
-
-/* TT = 0x126, TL = 0, trap_instruction_38 */
-.org trap_table + TT_TRAP_INSTRUCTION(38)*ENTRY_SIZE
-.global trap_instruction_38_tl0
-trap_instruction_38_tl0:
-	TRAP_INSTRUCTION 38
-
-/* TT = 0x127, TL = 0, trap_instruction_39 */
-.org trap_table + TT_TRAP_INSTRUCTION(39)*ENTRY_SIZE
-.global trap_instruction_39_tl0
-trap_instruction_39_tl0:
-	TRAP_INSTRUCTION 39
-
-/* TT = 0x128, TL = 0, trap_instruction_40 */
-.org trap_table + TT_TRAP_INSTRUCTION(40)*ENTRY_SIZE
-.global trap_instruction_40_tl0
-trap_instruction_40_tl0:
-	TRAP_INSTRUCTION 40
+/* TT = 0x100 - 0x17f, TL = 0, trap_instruction_0 - trap_instruction_7f */
+.irp cur, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,\
+    20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,\
+    39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,\
+    58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,\
+    77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,\
+    96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,\
+    112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,\
+    127
+.org trap_table + (TT_TRAP_INSTRUCTION_0+\cur)*ENTRY_SIZE
+.global trap_instruction_\cur\()_tl0
+trap_instruction_\cur\()_tl0:
+	ba trap_instruction_handler
+	mov \cur, %g2
+.endr
 
 /*
