From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MIgD3-0005HL-Oq for mharc-grub-devel@gnu.org; Mon, 22 Jun 2009 05:53:05 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MIgD0-0005DT-Lb for grub-devel@gnu.org; Mon, 22 Jun 2009 05:53:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MIgCv-00059m-GZ for grub-devel@gnu.org; Mon, 22 Jun 2009 05:53:01 -0400 Received: from [199.232.76.173] (port=59509 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MIgCv-00059c-32 for grub-devel@gnu.org; Mon, 22 Jun 2009 05:52:57 -0400 Received: from aybabtu.com ([69.60.117.155]:45963) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MIgCt-0002Z3-El for grub-devel@gnu.org; Mon, 22 Jun 2009 05:52:55 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtp (Exim 4.69) (envelope-from ) id 1MIf9u-0006oi-UL for grub-devel@gnu.org; Mon, 22 Jun 2009 10:45:47 +0200 Received: from rmh by thorin with local (Exim 4.69) (envelope-from ) id 1MIgCq-0002Nj-O1 for grub-devel@gnu.org; Mon, 22 Jun 2009 11:52:52 +0200 Date: Mon, 22 Jun 2009 11:52:52 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20090622095252.GC8969@thorin> References: <20090621181748.GA21152@thorin> <20090621225332.GB2360@thorin> <1245633761.9864.34.camel@mj> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1245633761.9864.34.camel@mj> Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) Subject: Re: [PATCH] access gdtdesc on segment 0 unconditionally (Re: [PATCH] i386-qemu port) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 09:53:03 -0000 On Sun, Jun 21, 2009 at 09:22:41PM -0400, Pavel Roskin wrote: > On Mon, 2009-06-22 at 00:53 +0200, Robert Millan wrote: > > In this line of code in real_to_prot(): > > > > DATA32 ADDR32 lgdt %cs:gdtdesc > > > > GAS generates an absolute address for `gdtdesc' (not relative to segment), > > and so for the code to work %cs must be zero. In current usage of > > real_to_prot(), %cs is always zero because we jump to 0x0:0x82xx early on. > > > > However, in other situations this is not possible. On i386-qemu, before > > moving to i386 mode the code we're running is in the 0xf0000-0x100000 > > range, which is inaccessible from segment 0. > > But gdtdesc should be next to the code we are running, since startup.S > includes realmode.S where gdtdesc is defined, so they compile into one > object file. > > Since %cs is pointing to the code, it should be possible to point it to > gdtdesc. They should be nearby. It is nearby, but the address reference for `gdtdesc' is absolute, NOT relative to %cs. Of course, when %cs is 0 that's no problem. But in my case I can't set %cs to 0 because my code is above 0x10000. > As for the APPLE_CC issue, I guess the Apple compiler doesn't understand > the segment prefix at that position. The right fix would be to use > ".byte" statements to create the same bytecode instead of introducing a > different behavior to work around a compiler limitation. > > Then I guess the Apple compiler won't accepted %ds: either, so if we > want to use %ds, we should omit it. Yes, this should work. -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."