From 99aa65c72532315a614871648034af83cd29e442 Mon Sep 17 00:00:00 2001 From: Filip Kokosinski Date: Fri, 10 May 2024 09:52:23 +0200 Subject: [PATCH] drivers/console/xtensa_sim_console: force `\r\n` byte sequence Force `\r\n` byte sequence for newline for the Xtensa simulator console driver. This effectively mirrors the behavior of the UART console driver. Signed-off-by: Filip Kokosinski --- drivers/console/xtensa_sim_console.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/console/xtensa_sim_console.c b/drivers/console/xtensa_sim_console.c index 316162ddc0c1..1d52f93af73e 100644 --- a/drivers/console/xtensa_sim_console.c +++ b/drivers/console/xtensa_sim_console.c @@ -25,6 +25,14 @@ int arch_printk_char_out(int c) register int ret_err __asm__ ("a3"); buf[0] = (char)c; + + if (buf[0] == '\n') { + buf[1] = buf[0]; + buf[0] = '\r'; + a3++; + a5++; + } + __asm__ volatile ("simcall" : "=a" (ret_val), "=a" (ret_err) : "a" (a2), "a" (a3), "a" (a4), "a" (a5)