From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwZqC-0001jz-Ub for qemu-devel@nongnu.org; Wed, 01 Aug 2012 10:24:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SwZqA-0002mS-RF for qemu-devel@nongnu.org; Wed, 01 Aug 2012 10:24:00 -0400 Received: from cantor2.suse.de ([195.135.220.15]:58105 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwZqA-0002mM-Gn for qemu-devel@nongnu.org; Wed, 01 Aug 2012 10:23:58 -0400 Message-ID: <50193BF7.80601@suse.de> Date: Wed, 01 Aug 2012 16:23:51 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <6e00a77f0ea5e11b7a060803040d4e58bf935c01.1343790517.git.gxt@mprc.pku.edu.cn> In-Reply-To: <6e00a77f0ea5e11b7a060803040d4e58bf935c01.1343790517.git.gxt@mprc.pku.edu.cn> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCHv2] unicore32-softmmu: Add a minimal curses screen support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: gxt@mprc.pku.edu.cn Cc: blauwirbel@gmail.com, Zhang Mengchi , qemu-devel@nongnu.org, chenwj@iis.sinica.edu.tw Am 01.08.2012 05:09, schrieb gxt@mprc.pku.edu.cn: > From: Guan Xuetao >=20 > 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 ba= ck > 2. backspace is not handled yet >=20 > v1->v2: add extra handler for '\r' >=20 > Signed-off-by: Zhang Mengchi > Signed-off-by: Guan Xuetao > --- > target-unicore32/helper.c | 45 +++++++++++++++++++++++++++++++++++++= ++++++-- > 1 files changed, 43 insertions(+), 2 deletions(-) >=20 > diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c > index d6eb758..d21e7df 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" > =20 > #undef DEBUG_UC32 > =20 > @@ -186,10 +187,50 @@ uint32_t helper_cp0_get(CPUUniCore32State *env, u= int32_t creg, uint32_t cop) > return 0; > } > =20 > +#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 =3D newwin(30, 80, 0, 0); > + scrollok(localwin, TRUE); > + init =3D 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 dest= roy the > + * last print line. And meanwhile, '\n' implifies '\r' ins= ide. */ > + break; > + default: /* Not handled, so just print it hex code */ > + wprintw(localwin, "-- 0x%h --", 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 > =20 Why is a TCG helper missing with curses directly? Shouldn't that use QEMU's console infrastructure and leave it to the user whether to use curses as a backend at runtime? What is the problem you are trying to solve? If you just need scrolling support you can already use -curses, -nographic and friends... Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg