[RFC,1/3] core/exceptions.c: rearrange code to allow more interrupt types
diff mbox series

Message ID 20190605023616.26893-2-npiggin@gmail.com
State New
Headers show
Series
  • WIP VMM for OPAL boot
Related show

Checks

Context Check Description
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot fail Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (0a2f8fbf931491ed97c1d11a5ae85b9d30338162)

Commit Message

Nicholas Piggin June 5, 2019, 2:36 a.m. UTC
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 core/exceptions.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/core/exceptions.c b/core/exceptions.c
index 4e5c0819e..5e453264e 100644
--- a/core/exceptions.c
+++ b/core/exceptions.c
@@ -78,9 +78,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, EXCEPTION_MAX_STR - l,
 				"Fatal System Reset at "REG"   ", nip);
@@ -88,14 +89,21 @@  void exception_entry(struct stack_frame *stack)
 			l += snprintf(buf + l, EXCEPTION_MAX_STR - l,
 				"System Reset at "REG"   ", nip);
 		}
-	} else if (stack->type == 0x200) {
+		break;
+
+	case 0x200:
 		fatal = true;
+		prerror("***********************************************\n");
 		l += snprintf(buf + l, EXCEPTION_MAX_STR - l,
 			"Fatal MCE at "REG"   ", nip);
-	} else {
+		break;
+
+	default:
 		fatal = true;
+		prerror("***********************************************\n");
 		l += snprintf(buf + l, EXCEPTION_MAX_STR - l,
 			"Fatal Exception 0x%llx at "REG"  ", stack->type, nip);
+		break;
 	}
 	l += snprintf_symbol(buf + l, EXCEPTION_MAX_STR - l, nip);
 	l += snprintf(buf + l, EXCEPTION_MAX_STR - l, "  MSR "REG, msr);