[Skiboot] [RFC PATCH 2/4] core/exceptions.c: rearrange code to allow more interrupt types

Nicholas Piggin npiggin at gmail.com
Sun Mar 3 00:06:24 AEDT 2019


Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 core/exceptions.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/core/exceptions.c b/core/exceptions.c
index e15848ad3..9d49bad86 100644
--- a/core/exceptions.c
+++ b/core/exceptions.c
@@ -77,9 +77,10 @@ void exception_entry(struct stack_frame *stack)
 	if (!(msr & MSR_RI))
 		fatal = true;
 
-	prerror("***********************************************\n");
 	l = 0;
-	if (stack->type == 0x100) {
+	switch (stack->type) {
+	case 0x100:
+		prerror("***********************************************\n");
 		if (fatal) {
 			l += snprintf(buf + l, max - l,
 				"Fatal System Reset at "REG"   ", nip);
@@ -87,14 +88,21 @@ void exception_entry(struct stack_frame *stack)
 			l += snprintf(buf + l, max - l,
 				"System Reset at "REG"   ", nip);
 		}
-	} else if (stack->type == 0x200) {
+		break;
+
+	case 0x200:
 		fatal = true;
+		prerror("***********************************************\n");
 		l += snprintf(buf + l, max - l,
 			"Fatal MCE at "REG"   ", nip);
-	} else {
+		break;
+
+	default:
 		fatal = true;
+		prerror("***********************************************\n");
 		l += snprintf(buf + l, max - l,
 			"Fatal Exception 0x%llx at "REG"  ", stack->type, nip);
+		break;
 	}
 	l += snprintf_symbol(buf + l, max - l, nip);
 	l += snprintf(buf + l, max - l, "  MSR "REG, msr);
@@ -105,7 +113,7 @@ void exception_entry(struct stack_frame *stack)
 		abort();
 	else
 		backtrace();
-
+out:
 	if (hv) {
 		/* Set up for SRR return */
 		stack->srr0 = nip;
-- 
2.18.0



More information about the Skiboot mailing list