vmbase: Replace emergency_write_str with eprintln!

Similar to vmbase_example and pvmfw, use the macro in Rialto, instead of
the function directly.

Update the README to only recommend eprintln!() as the comment about
emergency_write_str() not accessing the stack is not guaranteed (and
relies on an implementation-defined behavior of the compiler), which is
less likely to be relevant since aosp/2550864 as synchronous exception
handlers now have a dedicated stack.

Test: m pvmfw librialto libvmbase_example
Change-Id: Ia2c90b0c2896016fa93a0f2cd326ae72844a9c84
diff --git a/rialto/src/exceptions.rs b/rialto/src/exceptions.rs
index b806b08..e87e0d3 100644
--- a/rialto/src/exceptions.rs
+++ b/rialto/src/exceptions.rs
@@ -15,7 +15,6 @@
 //! Exception handlers.
 
 use vmbase::{
-    console::emergency_write_str,
     eprintln,
     exceptions::{ArmException, Esr, HandleExceptionError},
     logger,
@@ -49,45 +48,45 @@
 
 #[no_mangle]
 extern "C" fn irq_current() {
-    emergency_write_str("irq_current\n");
+    eprintln!("irq_current");
     reboot();
 }
 
 #[no_mangle]
 extern "C" fn fiq_current() {
-    emergency_write_str("fiq_current\n");
+    eprintln!("fiq_current");
     reboot();
 }
 
 #[no_mangle]
 extern "C" fn serr_current() {
-    emergency_write_str("serr_current\n");
+    eprintln!("serr_current");
     print_esr();
     reboot();
 }
 
 #[no_mangle]
 extern "C" fn sync_lower() {
-    emergency_write_str("sync_lower\n");
+    eprintln!("sync_lower");
     print_esr();
     reboot();
 }
 
 #[no_mangle]
 extern "C" fn irq_lower() {
-    emergency_write_str("irq_lower\n");
+    eprintln!("irq_lower");
     reboot();
 }
 
 #[no_mangle]
 extern "C" fn fiq_lower() {
-    emergency_write_str("fiq_lower\n");
+    eprintln!("fiq_lower");
     reboot();
 }
 
 #[no_mangle]
 extern "C" fn serr_lower() {
-    emergency_write_str("serr_lower\n");
+    eprintln!("serr_lower");
     print_esr();
     reboot();
 }
diff --git a/vmbase/README.md b/vmbase/README.md
index 280d7e1..28d930a 100644
--- a/vmbase/README.md
+++ b/vmbase/README.md
@@ -76,10 +76,10 @@
 must use the C ABI, and have the expected names. For example, to log sync exceptions and reboot:
 
 ```rust
-use vmbase::{console::emergency_write_str, power::reboot};
+use vmbase::power::reboot;
 
 extern "C" fn sync_exception_current() {
-    emergency_write_str("sync_exception_current\n");
+    eprintln!("sync_exception_current");
 
     let mut esr: u64;
     unsafe {
@@ -93,14 +93,9 @@
 
 The `println!` macro shouldn't be used in exception handlers, because it relies on a global instance
 of the UART driver which might be locked when the exception happens, which would result in deadlock.
-Instead you can use `emergency_write_str` and `eprintln!`, which will re-initialize the UART every
-time to ensure that it can be used. This should still be used with care, as it may interfere with
-whatever the rest of the program is doing with the UART.
-
-Note also that in some cases when the system is in a bad state resulting in the stack not working
-properly, `eprintln!` may hang. `emergency_write_str` may be more reliable as it seems to avoid
-any stack allocation. This is why the example above uses `emergency_write_str` first to ensure that
-at least something is logged, before trying `eprintln!` to print more details.
+Instead you can use `eprintln!`, which will re-initialize the UART every time to ensure that it can
+be used. This should still be used with care, as it may interfere with whatever the rest of the
+program is doing with the UART.
 
 See [example/src/exceptions.rs](examples/src/exceptions.rs) for a complete example.