From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KpiB3-0007il-DL for mharc-grub-devel@gnu.org; Tue, 14 Oct 2008 07:35:01 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KpiB1-0007hX-TQ for grub-devel@gnu.org; Tue, 14 Oct 2008 07:35:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KpiAy-0007fp-4w for grub-devel@gnu.org; Tue, 14 Oct 2008 07:34:59 -0400 Received: from [199.232.76.173] (port=34727 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KpiAx-0007fj-UX for grub-devel@gnu.org; Tue, 14 Oct 2008 07:34:56 -0400 Received: from web31605.mail.mud.yahoo.com ([68.142.198.151]:47223) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1KpiAx-0001Za-Dz for grub-devel@gnu.org; Tue, 14 Oct 2008 07:34:55 -0400 Received: (qmail 73574 invoked by uid 60001); 14 Oct 2008 11:34:53 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=HE/Dewm1A1HLd26MipYDlHj78zWbnQu7RyiPTZG1j4Z60oxEtJXhGReNFIkzHgT4BzrWlqYTYt7YDGmsPIaBKpdqvlw/Zx8o7JTy1uj6T8Fvqwa4E6herSdY3KpDie/oj4kyAiDwYRvXLr0t+cNgD7seQPCphHG7hLhLWkGlNK0=; X-YMail-OSG: VYIRR5IVM1lb4ErIEekx0ojqwxcTAVz9jkoMEggnjo3J.iEemiKR7RRJqeJlrW9oLNvj8FCsn8zqRTxFBfNYmhyj3FethDNADSeyrlSwTFX7h6QAID8MlevvAGkuxp8mz8FOa7AqwjQbY7SyCxDNgz0TqzGsYIuudrVAUMWHnF2S0vwDeyewwVa63bc- Received: from [202.62.94.130] by web31605.mail.mud.yahoo.com via HTTP; Tue, 14 Oct 2008 04:34:53 PDT X-Mailer: YahooMailRC/1096.40 YahooMailWebService/0.7.218.2 Date: Tue, 14 Oct 2008 04:34:53 -0700 (PDT) From: Viswesh S To: The development of GRUB 2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID: <83465.72271.qm@web31605.mail.mud.yahoo.com> X-detected-operating-system: by monty-python.gnu.org: FreeBSD 6.x (1) Subject: Re: Windows,grub and grub2 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: Tue, 14 Oct 2008 11:35:00 -0000 Hi,=0A=0A=0A=0A----- Original Message ----=0A> From: Bean =0A> To: The development of GRUB 2 =0A> Sent: Monda= y, 29 September, 2008 4:20:57 PM=0A> Subject: Re: Windows,grub and grub2=0A= > =0A> On Mon, Sep 29, 2008 at 1:18 PM, Viswesh S wrote:=0A> > Hi,=0A> >=0A= > >=0A> >=0A> > ----- Original Message ----=0A> >> From: Bean =0A> >> To: T= he development of GRUB 2 =0A> >> Sent: Tuesday, 23 September, 2008 7:20:49 = PM=0A> >> Subject: Re: Windows,grub and grub2=0A> >>=0A> >> On Tue, Sep 23,= 2008 at 4:23 PM, Viswesh S wrote:=0A> >> >=0A> >> >=0A> >> >=0A> >> >=0A> = >> > ----- Original Message ----=0A> >> >> From: Bean=0A> >> >> To: The dev= elopment of GRUB 2=0A> >> >> Sent: Monday, 22 September, 2008 9:10:26 AM=0A= > >> >> Subject: Re: Windows,grub and grub2=0A> >> >>=0A> >> >> On Tue, Sep= 9, 2008 at 2:00 PM, Viswesh S wrote:=0A> >> >> > Below is the dump of scre= en output while chainloading the ntfsnew file.=0A> >> >> > ****************= ***********************=0A> >> >> > DI=3DCFF0 SI=3D07EE BP=3D1FF0 SP=3D1FE8= BX=3D0000 DX=3D0000 CX=3D0000 AX=3D0000=0A> >> >> > CS=3D0000 SS=3D0000 DS= =3D0000 ES=3D0000 FG=3D0246 IP=3D7C57=0A> >> >> >=0A> >> >> > DI=3D7FF0 SI= =3D07EE BP=3D1FF0 SP=3D7BF4 BX=3D55AA DX=3D0000 CX=3D0000 AX=3D0100 CX=3D07= C0=0A> >> >> > DS=3D07C0 ES=3D0000 FG=3D0007 IP=3D0082=0A> >> >> > ********= **********************************=0A> >> >> > Could you please let me know= the way to disassemble the binary file =0A> without=0A> >> >> > any header= .The way in which you decoded the boot record.=0A> >> >> >=0A> >> >> > Also= one more thing to let you know is that,=0A> >> >> >=0A> >> >> > with the g= rub-1.96 ( without the chainloader patch of disk->dev->read() =0A> ) ,=0A> = >> >> > with windows2003 in partition 1 and linux in partition 3, when we= =0A> >> chainload,=0A> >> >> > if we look at the partition table passed to = another bootloader ie =0A> location=0A> >> >> > 0x7be - we can see that it = is junk, but the surprising point is that, in=0A> >> >> > this case as I ha= ve mentioned in my first mail, windows boots up from=0A> >> >> > grub2.So i= t is that the partition table is not required for the =0A> chainloader=0A> = >> >> > thing and just the boot record is sufficient=0A> >> >>=0A> >> >> Hi= ,=0A> >> >>=0A> >> >> Oh, sorry for another long delay. I disassemble the f= ile with ida,=0A> >> >> which is an amazing tool. I don't know if there is = open source=0A> >> >> alternative, please let me know if you find one.=0A> = >> >>=0A> >> >> The output from ida is in masm format, I modify it a bit so= that it=0A> >> >> can be compiled using nasm. Please note that nasm doesn'= t generate the=0A> >> >> same binary file as original one, but you can get = an idea what it=0A> >> >> does.=0A> >> >>=0A> >> >> From the output, the pr= ogram fails at the second int 13 call, int=0A> >> >> 13/ah =3D 48h. Althoug= h I notice that DL=3D0, which is not supposed to=0A> >> >> happen. Perhaps = you can add a grub_printf in grub_chainloader_boot to=0A> >> >> show the va= lue of boot drive:=0A> >> >>=0A> >> >> static grub_err_t=0A> >> >> grub_cha= inloader_boot (void)=0A> >> >> {=0A> >> >> grub_printf ("boot_drive=3D%d\= n", boot_drive);=0A> >> >> grub_chainloader_real_boot (boot_drive, boot_p= art_addr);=0A> >> >>=0A> >> >> /* Never reach here. */=0A> >> >> retur= n GRUB_ERR_NONE;=0A> >> >> }=0A> >> >>=0A> >> >> --=0A> >> >> Bean=0A> >> >= >=0A> >> >>=0A> >> >=0A> >> > Hi,=0A> >> >=0A> >> > The value of boot drive= is 0x80.=0A> >> >=0A> >> > This was the same value in disk->drive also.=0A= > >>=0A> >> Hi,=0A> >>=0A> >> Interesting, perhaps %dx is changed somewhere= . Please try the=0A> >> following patch, it dumps the value of %dx just bef= ore jumping to the=0A> >> boot sector.=0A> >>=0A> >> --=0A> >> Bean=0A> >= =0A> > The patch works and now Windows is booting perfectly fine from Grub2= .=0A> >=0A> > I will go through the assembly and try to understand what mod= ifications you =0A> have done.So there is a problem in Grub2 code, which ne= eds to be fixed ?=0A> >=0A> > Till this point, I was chainloading grub from= Grub2 and then chainloading =0A> Windows2008 from it.=0A> >=0A> > Thanks f= or the consistent help till this point and for the future also.=0A> =0A> Hi= ,=0A> =0A> That's strange, the patch doesn't do anything except output the = value of dx:=0A> =0A> /* set up to pass boot drive */=0A> popl %= edx=0A> + movl %edx, %edi=0A> =0A> /* ESI must point to a partiti= on table entry */=0A> popl %esi=0A> =0A> call prot_to_real=0A= > .code16=0A> +=0A> + push %dx=0A> + call hex_out=0A> + = push %di=0A> + call hex_out=0A> +=0A> ljmp $0, $GRUB_MEMORY= _MACHINE_BOOT_LOADER_ADDR=0A> +=0A> +hex_out:=0A> + pushw %bp=0A> + = movw %sp, %bp=0A> + pushaw=0A> + movb $0xE, %ah=0A> + mov= w $7, %bx=0A> + movw $4, %cx=0A> + movw 4(%bp), %dx=0A> +1:= =0A> + rol $4, %dx=0A> + movb %dl, %al=0A> + andb $0xF, %= al=0A> + cmpb $10, %al=0A> + jb 2f=0A> + subb $('0'-'A'+1= 0), %al=0A> +2:=0A> + addb $'0', %al=0A> + int $0x10=0A> + l= oop 1b=0A> + movb $' ', %al=0A> + int $0x10=0A> + popaw= =0A> + popw %bp=0A> + ret $2=0A> .code32=0A> =0A> #include = "../loader.S"=0A> =0A> Perhaps you can try:=0A> =0A> 1, %edi is used as bac= kup register in case %edx is changed by=0A> prot_to_real, you can remove "m= ovl %edx, %edi", "push %di", "call=0A> hex_out" and see if it still works.= =0A> =0A> 2, It's possible that the bug is position related, replace "push = %dx",=0A> "call hex_out" with equal number of nop and see what happens.=0A>= =0A> -- =0A> Bean=0A> =0A=0AWe can remove the patch completely, without pu= tting nop also, but just comment out the following code=0A=0A/*=0A xorl = %eax, %eax=0A call EXT_C(grub_gate_a20)=0A*/=0A=0AThis is the only= difference and when I comment out this, Windows boots up from Grub2.=0A=0A= Regards,=0AViswesh=0A=0A=0A Add more friends to your messenger and enj= oy! Go to http://messenger.yahoo.com/invite/