From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwA3s-00021N-I3 for qemu-devel@nongnu.org; Wed, 24 Aug 2011 05:47:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QwA3r-0000TX-O3 for qemu-devel@nongnu.org; Wed, 24 Aug 2011 05:47:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35369) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwA3r-0000TT-Gz for qemu-devel@nongnu.org; Wed, 24 Aug 2011 05:47:51 -0400 Message-ID: <4E54C8C3.4050609@redhat.com> Date: Wed, 24 Aug 2011 12:47:47 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1312831898-18702-1-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1312831898-18702-1-git-send-email-aliguori@us.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] pc: make vgabios exit port more useful List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Lucas Meneghel Rodrigues , qemu-devel@nongnu.org On 08/08/2011 10:31 PM, Anthony Liguori wrote: > We've always listened on port 501 for vgabios panic messages. In the entire > time I've worked on QEMU, I've never actually seen a vgabios panic message :-) > > If we change the semantics of this port a little bit, it makes it possible to > use it for more interesting use-cases. I chose this approach instead of adding > a new I/O port because it avoids having a guest visible change. > > This change allows single-byte access to port 501 and also uses the value > written to construct an exit code. A little late to review but... > > diff --git a/hw/pc.c b/hw/pc.c > index 1c9d89a..4b07b35 100644 > --- a/hw/pc.c > +++ b/hw/pc.c > @@ -549,8 +549,7 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val) > /* LGPL'ed VGA BIOS messages */ > case 0x501: > case 0x502: > - fprintf(stderr, "VGA BIOS panic, line %d\n", val); > - exit(1); > + exit((val<< 1) | 1); This code (before the patch) circumvents -no-shutdown. Shifting val left is surprising. What's wrong with even exit codes? -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.