[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCHv2 19/19] unicore32-softmmu: Add a minimal curses scr
From: |
gxt |
Subject: |
[Qemu-devel] [PATCHv2 19/19] unicore32-softmmu: Add a minimal curses screen support |
Date: |
Fri, 10 Aug 2012 14:42:39 +0800 |
From: Guan Xuetao <address@hidden>
This patch adds a minimal curses screen support for unicore32-softmmu.
We assume 80*30 screen size to minimize the implementation.
Two problems are not solved, but they are innocuous.
1. curses windows will be blank when switching to monitor screen and back
2. backspace is not handled yet
v1->v2: add extra handler for '\r'
Signed-off-by: Zhang Mengchi <address@hidden>
Signed-off-by: Guan Xuetao <address@hidden>
---
target-unicore32/helper.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c
index d6eb758..a9e226b 100644
--- a/target-unicore32/helper.c
+++ b/target-unicore32/helper.c
@@ -13,6 +13,7 @@
#include "gdbstub.h"
#include "helper.h"
#include "host-utils.h"
+#include "console.h"
#undef DEBUG_UC32
@@ -186,10 +187,50 @@ uint32_t helper_cp0_get(CPUUniCore32State *env, uint32_t
creg, uint32_t cop)
return 0;
}
+#ifdef CONFIG_CURSES
+/*
+ * FIXME:
+ * 1. curses windows will be blank when switching back
+ * 2. backspace is not handled yet
+ */
+static void putc_on_screen(unsigned char ch)
+{
+ static WINDOW *localwin;
+ static int init;
+
+ if (!init) {
+ /* Assume 80 * 30 screen to minimize the implementation */
+ localwin = newwin(30, 80, 0, 0);
+ scrollok(localwin, TRUE);
+ init = TRUE;
+ }
+
+ if (isprint(ch)) {
+ wprintw(localwin, "%c", ch);
+ } else {
+ switch (ch) {
+ case '\n':
+ wprintw(localwin, "%c", ch);
+ break;
+ case '\r':
+ /* If '\r' is put before '\n', the curses window will destroy the
+ * last print line. And meanwhile, '\n' implifies '\r' inside. */
+ break;
+ default: /* Not handled, so just print it hex code */
+ wprintw(localwin, "-- 0x%x --", ch);
+ }
+ }
+
+ wrefresh(localwin);
+}
+#else
+#define putc_on_screen(c) do { } while (0)
+#endif
+
void helper_cp1_putc(target_ulong x)
{
- /* TODO: curses display should be added here for screen output. */
- DPRINTF("%c", x);
+ putc_on_screen((unsigned char)x); /* Output to screen */
+ DPRINTF("%c", x); /* Output to stdout */
}
#endif
--
1.7.0.4
- [Qemu-devel] [PATCHv2 02/19] unicore32-softmmu: Add coprocessor 0(sysctrl) and 1(ocd) instruction support, (continued)
- [Qemu-devel] [PATCHv2 02/19] unicore32-softmmu: Add coprocessor 0(sysctrl) and 1(ocd) instruction support, gxt, 2012/08/10
- [Qemu-devel] [PATCHv2 01/19] unicore32-softmmu: Add unicore32-softmmu build support, gxt, 2012/08/10
- [Qemu-devel] [PATCHv2 05/19] unicore32-softmmu: Implement softmmu specific functions, gxt, 2012/08/10
- [Qemu-devel] [PATCHv2 07/19] unicore32-softmmu: Add puv3 soc/board support, gxt, 2012/08/10
- [Qemu-devel] [PATCHv2 11/19] unicore32-softmmu: Add puv3 pm support, gxt, 2012/08/10
- [Qemu-devel] [PATCHv2 08/19] unicore32-softmmu: Add puv3 interrupt support, gxt, 2012/08/10
- [Qemu-devel] [PATCHv2 14/19] unicore32-softmmu: Add maintainer information for UniCore32 machine, gxt, 2012/08/10
- [Qemu-devel] [PATCHv2 12/19] unicore32-softmmu: Add puv3 dma support, gxt, 2012/08/10
- [Qemu-devel] [PATCHv2 10/19] unicore32-softmmu: Add puv3 gpio support, gxt, 2012/08/10
- [Qemu-devel] [PATCHv2 16/19] unicore32: Split UniCore-F64 instruction helpers from helper.c, gxt, 2012/08/10
- [Qemu-devel] [PATCHv2 19/19] unicore32-softmmu: Add a minimal curses screen support,
gxt <=
- [Qemu-devel] [PATCHv2 15/19] unicore32-softmmu: Add is_default setting for puv3 machine, gxt, 2012/08/10
- [Qemu-devel] [PATCHv2 18/19] unicore32: Close dump-option of cpu_dump_state_ucf64 function, gxt, 2012/08/10
- [Qemu-devel] [PATCHv2 17/19] unicore32: Disintegrate cpu_dump_state_ucf64 function, gxt, 2012/08/10
- [Qemu-devel] [PATCHv2 06/19] unicore32-softmmu: Make sure that kernel can access user space, gxt, 2012/08/10
- [Qemu-devel] [PATCHv2 09/19] unicore32-softmmu: Add puv3 ostimer support, gxt, 2012/08/10
- [Qemu-devel] [PATCHv2 13/19] unicore32-softmmu: Add ps2 support, gxt, 2012/08/10
- Re: [Qemu-devel] [PATCHv2 00/19] unicore32: Add unicore32-softmmu support, Blue Swirl, 2012/08/11