From: Jan Kiszka <[email protected]>

Unix tools like awk expect Unix ordering and that is different from what
we generate so far. Issue the CR first, and then the LF.

Reported-by: Michael Hinton <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
---
 hypervisor/uart.c | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/hypervisor/uart.c b/hypervisor/uart.c
index a43773c2..6980970f 100644
--- a/hypervisor/uart.c
+++ b/hypervisor/uart.c
@@ -2,9 +2,11 @@
  * Jailhouse, a Linux-based partitioning hypervisor
  *
  * Copyright (c) OTH Regensburg, 2016
+ * Copyright (c) Siemens AG, 2020
  *
  * Authors:
  *  Ralf Ramsauer <[email protected]>
+ *  Jan Kiszka <[email protected]>
  *
  * This work is licensed under the terms of the GNU GPL, version 2.  See
  * the COPYING file in the top-level directory.
@@ -17,22 +19,27 @@

 struct uart_chip *uart = NULL;

+static void uart_write_char(char c)
+{
+       while (uart->is_busy(uart))
+               cpu_relax();
+       if (panic_in_progress && panic_cpu != phys_processor_id())
+               return;
+       uart->write_char(uart, c);
+}
+
 void uart_write(const char *msg)
 {
-       char c = 0;
+       char c;

        while (1) {
-               if (c == '\n')
-                       c = '\r';
-               else
-                       c = *msg++;
+               c = *msg++;
                if (!c)
                        break;

-               while (uart->is_busy(uart))
-                       cpu_relax();
-               if (panic_in_progress && panic_cpu != phys_processor_id())
-                       break;
-               uart->write_char(uart, c);
+               if (c == '\n')
+                       uart_write_char('\r');
+
+               uart_write_char(c);
        }
 }
--
2.16.4

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/25787d78f88b97819c8769e296d4e1edeca68647.1581770164.git.jan.kiszka%40web.de.

Reply via email to