Add exception vector guards

This patch adds guards so that an exception vector exceeding 32
instructions will generate a compile-time error. This keeps the
exception handlers in check from spilling over.

Change-Id: I7aa56dd0071a333664e2814c656d3896032046fe
diff --git a/include/asm_macros.S b/include/asm_macros.S
index decef0b..f94d75f 100644
--- a/include/asm_macros.S
+++ b/include/asm_macros.S
@@ -68,3 +68,15 @@
 	ubfx	\end_level, \clidr, \shift, \fw
 	lsl	\end_level, \end_level, \ls
 	.endm
+
+	/*
+	 * This macro verifies that the a given vector doesn't exceed the
+	 * architectural limit of 32 instructions. This is meant to be placed
+	 * immedately after the last instruction in the vector. It takes the
+	 * vector entry as the parameter
+	 */
+	.macro check_vector_size since
+	  .if (. - \since) > (32 * 4)
+	    .error "Vector exceeds 32 instructions"
+	  .endif
+	.endm