From owner-freebsd-emulation@FreeBSD.ORG Sat Feb 16 18:34:19 2008 Return-Path: Delivered-To: emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C72E16A417 for ; Sat, 16 Feb 2008 18:34:19 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay02.kiev.sovam.com (relay02.kiev.sovam.com [62.64.120.197]) by mx1.freebsd.org (Postfix) with ESMTP id DE51713C442 for ; Sat, 16 Feb 2008 18:34:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [212.82.216.226] (helo=skuns.kiev.zoral.com.ua) by relay02.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1JQRrb-0002Za-KW for emulation@FreeBSD.org; Sat, 16 Feb 2008 20:34:18 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by skuns.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id m1GIXoAn028970 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 16 Feb 2008 20:33:50 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m1GIYBDF020368; Sat, 16 Feb 2008 20:34:11 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m1GIYBiP020367; Sat, 16 Feb 2008 20:34:11 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 16 Feb 2008 20:34:11 +0200 From: Kostik Belousov To: Juergen Lock Message-ID: <20080216183411.GL57756@deviant.kiev.zoral.com.ua> References: <20080216164331.GJ57756@deviant.kiev.zoral.com.ua> <20080216181850.GA35839@saturn.kn-bremen.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+j5CnouwYkpW7UmB" Content-Disposition: inline In-Reply-To: <20080216181850.GA35839@saturn.kn-bremen.de> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.91.2, clamav-milter version 0.91.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on skuns.kiev.zoral.com.ua X-Scanner-Signature: 21f1cdc77deae757bfd40713fd6c3781 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Info: Profiles 2246 [Feb 15 2008] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {received from trusted relay: not dialup} X-SpamTest-Method: none X-SpamTest-Method: Local Lists X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Cc: emulation@FreeBSD.org Subject: Re: qemu-system-amd64 and freebsd guest X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Feb 2008 18:34:19 -0000 --+j5CnouwYkpW7UmB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Feb 16, 2008 at 07:18:50PM +0100, Juergen Lock wrote: > On Sat, Feb 16, 2008 at 06:43:31PM +0200, Kostik Belousov wrote: > > My recent attempts to boot CURRENT amd64 on QEMU 0.9.1 resulted in the > > consistent kernel panic in the first instruction of the root_bus_ocnfig= ure() > > function. Looking around, I noted that this instruction is the second o= ne > > executed after "sti" in the amd64/amd64/autoconf.c:configure(). > > CPU executes > > sti > > call root_bus_configure > > pushq %rbp <- General Protection Fault there > >=20 > > It makes me suspect that fault happen when hardware interrupt is delive= red. > > Indeed, looking around qemu source code and setting breakpoints in QEMU, > > I noted that hw interrupt is delivered, with into =3D -1. Calculation of > > the IDT index in the QEMU' target-i386/helper.c:do_interrupt64() as > > intno*16 and comparision with unsigned limit looked as overflow and GPF > > was delivered instead. > >=20 > > Then, it appears that -1 comes from cpu_get_pic_interrupt() when > > apic_accept_pic_intr() returns false. This happen, in particular, when > > corresponding lapic vector is masked. The situation is legitimate, and > > I think that QEMU shall not deliver an interrupt in this case. > >=20 > > The following patch allows me to boot the amd64 freebsd on qemu 0.9.1 > > from ports. > >=20 > > --- cpu-exec.c.orig 2008-02-16 18:23:53.134009488 +0200 > > +++ cpu-exec.c 2008-02-16 18:24:47.127662872 +0200 > > @@ -452,13 +452,15 @@ > > svm_check_intercept(SVM_EXIT_INTR); > > env->interrupt_request &=3D ~(CPU_INTERRUPT_HA= RD | CPU_INTERRUPT_VIRQ); > > intno =3D cpu_get_pic_interrupt(env); > > - if (loglevel & CPU_LOG_TB_IN_ASM) { > > - fprintf(logfile, "Servicing hardware INT= =3D0x%02x\n", intno); > > - } > > - do_interrupt(intno, 0, 0, 0, 1); > > - /* ensure that no TB jump will be modified as > > - the program flow was changed */ > > - BREAK_CHAIN; > > + if (intno !=3D -1) { > > + if (loglevel & CPU_LOG_TB_IN_ASM) { > > + fprintf(logfile, "Servicing hardware INT=3D0x%02x\n", intno); > > + } > > + do_interrupt(intno, 0, 0, 0, 1); > > + /* ensure that no TB jump will be modified as > > + the program flow was changed */ > > + BREAK_CHAIN; > > + } > > #if !defined(CONFIG_USER_ONLY) > > } else if ((interrupt_request & CPU_INTERRUPT_VIRQ= ) && > > (env->eflags & IF_MASK) && !(env->hflags & HF_= INHIBIT_IRQ_MASK)) { >=20 > Hey, thanks for looking at this one! :) Maybe you should post the patch > on the qemu list so the right ppl can look at it, and see if it is correc= t: > http://lists.gnu.org/mailman/listinfo/qemu-devel >=20 > Thanx, > Juergen Could you do this, please, as the maintainer of the qemu port ? I actually have no time to participate in the qemu ml, I am only qemu user. --+j5CnouwYkpW7UmB Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (FreeBSD) iEYEARECAAYFAke3LKIACgkQC3+MBN1Mb4jT8ACfQC2dGC4UNH6d2GLYWH4dv8KV Ct0AoKeRSNAsPBxDQFQDklFoDdHCbs6k =r6Vm -----END PGP SIGNATURE----- --+j5CnouwYkpW7UmB--