From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK5ly-0006KM-8n for qemu-devel@nongnu.org; Mon, 04 Jul 2016 11:26:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bK5ls-00056R-AB for qemu-devel@nongnu.org; Mon, 04 Jul 2016 11:26:57 -0400 Received: from mail-qk0-x234.google.com ([2607:f8b0:400d:c09::234]:33214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bK5ls-00056E-58 for qemu-devel@nongnu.org; Mon, 04 Jul 2016 11:26:52 -0400 Received: by mail-qk0-x234.google.com with SMTP id e3so66369034qkd.0 for ; Mon, 04 Jul 2016 08:26:51 -0700 (PDT) Date: Mon, 4 Jul 2016 11:26:48 -0400 From: Kevin O'Connor Message-ID: <20160704152648.GA2039@morn.lan> 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> <1467636384.15123.177.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1467636384.15123.177.camel@redhat.com> Subject: Re: [Qemu-devel] [RFC PATCH 1/2] serial console, output List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Paolo Bonzini , seabios@seabios.org, qemu-devel@nongnu.org On Mon, Jul 04, 2016 at 02:46:24PM +0200, Gerd Hoffmann wrote: > On Mo, 2016-07-04 at 11:11 +0200, Paolo Bonzini wrote: > > On 04/07/2016 10:16, Gerd Hoffmann wrote: > > > +static void sercon_set_color(u8 fg, u8 bg, u8 bold) > > > +{ > > > + sercon_putchar('\x1b'); > > > + sercon_putchar('['); > > > + sercon_putchar('0'); > > 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 = GET_GLOBAL(ptr[0]); > [ ... ] > > ... work? Yes. See output.c:puts_cs() as an example. It only works if it's a constant string (as opposed to a string built on the stack). > > > 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. > > > > 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. Unfortunately, the screen can be larger than 80x25. If a large buffer is desired, it's also possible to malloc_high() it and then use either: call32() to access it, or int1587 to read/write it (see ramdisk.c:ramdisk_copy() as an example). Either way it seems ugly. At one point I looked through the sgabios code and was able to understand how it did caching. I'll take another look and see if I can describe it. -Kevin