From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MIYFI-0008ON-LH for mharc-grub-devel@gnu.org; Sun, 21 Jun 2009 21:22:52 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MIYFG-0008O3-TK for grub-devel@gnu.org; Sun, 21 Jun 2009 21:22:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MIYFB-0008No-GT for grub-devel@gnu.org; Sun, 21 Jun 2009 21:22:49 -0400 Received: from [199.232.76.173] (port=59522 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MIYFB-0008Nl-BX for grub-devel@gnu.org; Sun, 21 Jun 2009 21:22:45 -0400 Received: from c60.cesmail.net ([216.154.195.49]:38491) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1MIYFA-0004My-T2 for grub-devel@gnu.org; Sun, 21 Jun 2009 21:22:45 -0400 Received: from unknown (HELO smtprelay2.cesmail.net) ([192.168.1.112]) by c60.cesmail.net with ESMTP; 21 Jun 2009 21:22:43 -0400 Received: from [192.168.0.22] (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by smtprelay2.cesmail.net (Postfix) with ESMTPSA id A8C7C34C6A for ; Sun, 21 Jun 2009 21:28:45 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: <20090621225332.GB2360@thorin> References: <20090621181748.GA21152@thorin> <20090621225332.GB2360@thorin> Content-Type: text/plain Date: Sun, 21 Jun 2009 21:22:41 -0400 Message-Id: <1245633761.9864.34.camel@mj> Mime-Version: 1.0 X-Mailer: Evolution 2.26.2 (2.26.2-1.fc11) Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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 01:22:51 -0000 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. Maybe you are trying to use a copy of gdtdesc in the beginning of memory? If GRUB serves as BIOS in i386-qemu, I'd rather use the "BIOS" value in the 0xF000 segment rather than the "RAM". 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. -- Regards, Pavel Roskin