From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK3Ge-0006Ku-81 for qemu-devel@nongnu.org; Mon, 04 Jul 2016 08:46:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bK3Gd-0001DD-0f for qemu-devel@nongnu.org; Mon, 04 Jul 2016 08:46:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47716) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK3Gc-0001D7-R9 for qemu-devel@nongnu.org; Mon, 04 Jul 2016 08:46:26 -0400 Message-ID: <1467636384.15123.177.camel@redhat.com> From: Gerd Hoffmann Date: Mon, 04 Jul 2016 14:46:24 +0200 In-Reply-To: <7c1baeab-b8b0-93d1-a9a2-054dfd92ece0@redhat.com> References: <1467370471-20554-1-git-send-email-kraxel@redhat.com> <1467370471-20554-2-git-send-email-kraxel@redhat.com> <20160701154732.GA11200@morn.lan> <1467620195.15123.133.camel@redhat.com> <7c1baeab-b8b0-93d1-a9a2-054dfd92ece0@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 Subject: Re: [Qemu-devel] [RFC PATCH 1/2] serial console, output List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin O'Connor , seabios@seabios.org, qemu-devel@nongnu.org On Mo, 2016-07-04 at 11:11 +0200, Paolo Bonzini wrote: >=20 > On 04/07/2016 10:16, Gerd Hoffmann wrote: > >=20 > > + sercon_putchar('\x1b'); > > + sercon_putchar('c'); > > + /* clear screen */ > > + sercon_putchar('\x1b'); > > + sercon_putchar('['); > > + sercon_putchar('2'); > > + sercon_putchar('J'); > > +} > > + > > +static void sercon_set_color(u8 fg, u8 bg, u8 bold) > > +{ > > + sercon_putchar('\x1b'); > > + sercon_putchar('['); > > + sercon_putchar('0'); > > + if (fg !=3D 7) { > > + sercon_putchar(';'); > > + sercon_putchar('3'); > > + sercon_putchar(GET_LOW(sercon_cmap[fg & 7])); > > + } > > + if (bg !=3D 0) { > > + sercon_putchar(';'); > > + sercon_putchar('4'); > > + sercon_putchar(GET_LOW(sercon_cmap[bg & 7])); > > + } > > + if (bold) { > > + sercon_putchar(';'); > > + sercon_putchar('1'); > > + } > > + sercon_putchar('m'); >=20 > Add a sercon_putstr perhaps? We run in real mode, so passing around pointers isn't that easy. Given this would make sense for constant strings only (like the 4-byte clear-screen sequence) and not so much for variable stuff we might put all strings in the global segment. Would this ... void sercon_putchar(char *ptr) { char c =3D GET_GLOBAL(ptr[0]); [ ... ] ... work? > > Maybe we can reuse the output buffer which we have anyway. Logic needs > > reworked a bit. We can't just clear characters after printing them out > > if we want be able to read them later, so we need a separate > > pending-updates bit. Also should be bigger I guess, maybe 80 chars so > > it can cover a complete line. >=20 > 80x25 is just 2K... Perhaps it's simpler to just allocate the whole > video buffer from the UMB or EBDA when serial console is in use? 4k, we need both character and attribute. But, yes, if we can allocate that somewhere in real mode address space without running into memory pressure this might be the best option. cheers, Gerd