From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 23 23:11:24 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A964CD93; Tue, 23 Apr 2013 23:11:24 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-da0-x22b.google.com (mail-da0-x22b.google.com [IPv6:2607:f8b0:400e:c00::22b]) by mx1.freebsd.org (Postfix) with ESMTP id 78F1C1437; Tue, 23 Apr 2013 23:11:24 +0000 (UTC) Received: by mail-da0-f43.google.com with SMTP id u36so575329dak.30 for ; Tue, 23 Apr 2013 16:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=UpOSoI/f7aU3ztHUzBoayNpLR0/nrqsrBjsNaHA6hfo=; b=ajpFHw8BGS2Ss5ey3499bdnJfAZ4aZFZVr79wemGbNcxEuSRDxObfEQGLqkW5nkQpD 23uWJM0Fc0wh64rA7fGC15mxuJct9WfQvEFALO+mLd5IbXEVd8TAwjuX3DdDgyEr3qlG Ts3UK951eThkZ9KcyHzcw7ELFWjP3naQXcnhncF8ZjaGVZ3Oh/gtkaJgZZa/zBm5SDJn qIpNn89PGNbf2Nomb7Z1bhseUnpTPhWwXquNEcvUygvkMwqQIznZaw5OCIiY4GBxmHdW mYzFP2A9hGjbfPHXxxlQE+/rKKT96g2ZeUkhlSaQK0SyxLhdF8g4KcAV/zxaQuE+2pLi bDsw== MIME-Version: 1.0 X-Received: by 10.69.0.200 with SMTP id ba8mr45260374pbd.4.1366758684311; Tue, 23 Apr 2013 16:11:24 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.70.37.234 with HTTP; Tue, 23 Apr 2013 16:11:24 -0700 (PDT) In-Reply-To: <4735123C-E912-4D32-80D4-D057E2821626@FreeBSD.org> References: <20130419162834.GA90217@icarus.home.lan> <006B20F1-F67B-4E9D-B0DF-D4ED843F7E8E@FreeBSD.org> <5176B238.7030306@FreeBSD.org> <201304231231.38765.jhb@freebsd.org> <51770149.6020802@FreeBSD.org> <650A4439-B258-4FDA-BD5C-C9DEF5DC81ED@FreeBSD.org> <4735123C-E912-4D32-80D4-D057E2821626@FreeBSD.org> Date: Tue, 23 Apr 2013 16:11:24 -0700 X-Google-Sender-Auth: 47fpOoGi4UIARhQ5EyOiW6yIuys Message-ID: Subject: Re: Rebooting from loader causes a "fault" in VMware Workstation From: Adrian Chadd To: Dimitry Andric Content-Type: text/plain; charset=ISO-8859-1 Cc: Jeremy Chadwick , freebsd-hackers@freebsd.org, Joshua Isom , Andriy Gapon X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Apr 2013 23:11:24 -0000 Hah, nice catch! You guys rock. Scratch one less weird shit thing with FreeBSD on VMWARE. Adrian On 23 April 2013 16:03, Dimitry Andric wrote: > > On Apr 24, 2013, at 00:03, Dimitry Andric wrote: > >> On Apr 23, 2013, at 23:46, Andriy Gapon wrote: >>> on 23/04/2013 19:31 John Baldwin said the following: >>>> On Tuesday, April 23, 2013 12:09:28 pm Andriy Gapon wrote: >> ... >>>>> 0x00000000000090e8: lgdtl 0x95d0 >>>>> 0x00000000000090ef: ljmpw $0x18,$0x90f5 >>>>> >>>>> Triple fault >>>>> CPU Reset (CPU 0) >>>>> ESI=0004503c EDI=3fe50968 EBP=00094a80 ESP=00001800 >>>>> EIP=000090ef EFL=00000046 [---Z-P-] CPL=0 II=0 A20=1 SMM=0 HLT=0 >>>>> ES =0033 0000a000 ffffffff 00cff300 DPL=3 DS [-WA] >>>>> CS =0008 00000000 ffffffff 00cf9a00 DPL=0 CS32 [-R-] >>>>> SS =0010 00000000 ffffffff 00cf9300 DPL=0 DS [-WA] >>>>> DS =0033 0000a000 ffffffff 00cff300 DPL=3 DS [-WA] >>>>> FS =0033 0000a000 ffffffff 00cff300 DPL=3 DS [-WA] >>>>> GS =0033 0000a000 ffffffff 00cff300 DPL=3 DS [-WA] >>>>> LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT >>>>> TR =0038 00005f98 00002067 00008900 DPL=0 TSS32-avl >>>>> GDT= ff85c789 00000000 >>>> >>>> This seems wrong (address is way too high). I wonder if the gdtdesc was >>>> trashed by something? Can you dump memory before the lgdtl instruction at the >>>> 0x95d0 address? >>> >>> Looks correct: >>> Breakpoint 1, 0x000090e8 in ?? () >>> (gdb) x/i $eip >>> 0x90e8: lgdtl 0x95d0 >>> (gdb) x/3xh 0x95d0 >>> 0x95d0: 0x003f 0x9590 0x0000 >>> (gdb) x/16xh 0x9590 >>> 0x9590: 0x0000 0x0000 0x0000 0x0000 0xffff 0x0000 0x9a00 0x00cf >>> 0x95a0: 0xffff 0x0000 0x9300 0x00cf 0xffff 0x0000 0x9a00 0x0000 >>> >>> Nevertheless doing stepi leads to exactly the same triple fault. >> >> >> Is it because lgdt loads the GDT from the ds segment, and ds is now 33, >> not 0 (or equal to CS, I'm not sure which is correct here)? > > Indeed, the DS segment was incorrect, the GDT should be loaded from the > CS segment instead. This diff fixes the issue for me (and now "reboot" > command from loader nicely reboots in VMware): > > Index: sys/boot/i386/btx/btx/btx.S > =================================================================== > --- sys/boot/i386/btx/btx/btx.S (revision 248910) > +++ sys/boot/i386/btx/btx/btx.S (working copy) > @@ -248,7 +248,7 @@ exit: cli # Disable interrupts > /* > * Restore the GDT in case we caught a kernel trap. > */ > - lgdt gdtdesc # Set GDT > + lgdt %cs:gdtdesc # Set GDT > /* > * To 16 bits. > */ > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"