[pvmfw]Refactor non UART exception handling failure reporting

No behavior change in this cl.

Test: m pvmfw_img
Bug: 284462758
Change-Id: Ic771eead8a2a0a1e9087263214c7972cd4f40533
diff --git a/pvmfw/src/exceptions.rs b/pvmfw/src/exceptions.rs
index c3f8a29..430b524 100644
--- a/pvmfw/src/exceptions.rs
+++ b/pvmfw/src/exceptions.rs
@@ -114,9 +114,16 @@
     }
 }
 
+/// Prints the details of an exception failure, excluding UART exceptions.
 #[inline]
-fn handling_uart_exception(esr: Esr, far: usize) -> bool {
-    esr == Esr::DataAbortSyncExternalAbort && page_4kb_of(far) == UART_PAGE
+fn print_exception_failure(esr: Esr, far: usize, elr: u64, e: HandleExceptionError) {
+    let is_uart_exception = esr == Esr::DataAbortSyncExternalAbort && page_4kb_of(far) == UART_PAGE;
+    // Don't print to the UART if we are handling an exception it could raise.
+    if !is_uart_exception {
+        eprintln!("sync_exception_current");
+        eprintln!("{e}");
+        eprintln!("{esr}, far={far:#08x}, elr={elr:#08x}");
+    }
 }
 
 #[no_mangle]
@@ -127,12 +134,7 @@
     let far = read_sysreg!("far_el1");
 
     if let Err(e) = handle_exception(esr, far) {
-        // Don't print to the UART if we are handling an exception it could raise.
-        if !handling_uart_exception(esr, far) {
-            eprintln!("sync_exception_current");
-            eprintln!("{e}");
-            eprintln!("{esr}, far={far:#08x}, elr={elr:#08x}");
-        }
+        print_exception_failure(esr, far, elr, e);
         reboot()
     }
 }