From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1I2KcX-00030w-3w for mharc-grub-devel@gnu.org; Sun, 24 Jun 2007 01:26:45 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I2KcU-00030J-Ll for grub-devel@gnu.org; Sun, 24 Jun 2007 01:26:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I2KcT-0002y2-Ou for grub-devel@gnu.org; Sun, 24 Jun 2007 01:26:42 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I2KcT-0002xi-L0 for grub-devel@gnu.org; Sun, 24 Jun 2007 01:26:41 -0400 Received: from m15-111.126.com ([220.181.15.111]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1I2KcS-00053Q-D1 for grub-devel@gnu.org; Sun, 24 Jun 2007 01:26:41 -0400 Received: from localhost (unknown [123.49.201.18]) by smtp1 (Coremail) with SMTP id wKjJCx0AaR6LAH5Gx47PAg==.63487S2; Sun, 24 Jun 2007 13:26:35 +0800 (CST) Date: Sun, 24 Jun 2007 13:26:16 +0800 From: Bean To: The development of GRUB 2 Message-ID: <20070624052616.GA8516@ws3.vdp.com> References: <8c0c43de0706232131t48e63e45jf99963529a2f2304@mail.gmail.com> <20070624045135.GA8487@ws3.vdp.com> <8c0c43de0706232200h73f5d857t3cb4fae3f655ddbb@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8c0c43de0706232200h73f5d857t3cb4fae3f655ddbb@mail.gmail.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-Coremail-Antispam: 1U3Yxn0WfASr-VFAUDIcSsGvfJTRUUUj5AFxVCF77xC6IxKo4 kEV4ylIxAIcVC2z280aVAFwI0_Jr0_Gr1lnxkEFVAIw20F6cxK64vIFxWlx4CE17CEb7AF 67AKxVWUJVWUXwCjxxvEw4Wle4C267I2x7xF54xIwI1lYx0E2Ix0cI8IcVAFwI0_Jr0_Jr 4l4x8a6c8ajcxJMcIj6I8E87Iv67AKxVWUJVW8JwAFxVCaYxvI4VCIwcAKzIAtMxkI7II2 jI8vz4vEwIxGrwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r4UM7AC8VAFwI0_Jr0_Gr1lb4 IE77IF4wAFIxvE14AKwVWUJVWUGwAqx4xG64xvF2IEw4CE5I8CrVC2j2Wlc7Ca8VAvwVAK O7xYrVA2I41lb7Iv0xC_ArUanT9S1TB71UUUUUUa7-sFnT9fnUUI43ZEXa7IU1-eOJUUUU UFnT9fnsW5prWfAr4DZryDXr18uFWUJw13AoXrpw4xXoZ3K3WSga18Kr18Ja4UCr1UA3Wx XF1Sg343Wr1DXrn5XFWDJrZ0y3sxtws0g3929ryfKa1DGa4xAayrZ3Z2qFn7= X-detected-kernel: Linux 2.4-2.6 Subject: Re: Loading boot image retrieved from CD-ROM 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: Sun, 24 Jun 2007 05:26:43 -0000 On Sun, Jun 24, 2007 at 01:00:13AM -0400, Alex Roman wrote: > On 24/06/07, Bean wrote: > >Maybe the image overwrites code in statrt.S after it's copied to 0x7c00. To > >verify, you can print the address of function like grub_eltorito_boot, > >grub_gate_a20 and prot_to_real, see if they're within range of 0x7c00 to > >0x7c00 + image length. > > I don't have access from C code to grub_gate_a20 or prot_to_real > (unless I don't include the right header files)... However > grub_eltorito_boot ends up being at address 0x872c > > I happen to copy 4 sectors, 2048 bytes each, so it would definitely > overwrite the code for grub_eltorito_boot. > > So, what do I do in this case? The eltorito specs say the code should > reside at segment 7c0h... Here is a possible solution. First, copy the image to 0x7c00 + N, when N is large enough so that the image wouldn't overwrite any necessary function in startup.S. After transition to real mode with prot_to_real, copy a trunk funtion to somewhere below 0x7C00, and jump to that function. Then, copy image from 0x7c00+N back to 0x7c00, and finally jump to 0x7c00. -- Bean