On Mon, Sep 1, 2008 at 6:48 PM, Viswesh S <[EMAIL PROTECTED]> wrote: > > > ----- Original Message ---- > From: Bean <[EMAIL PROTECTED]> > To: The development of GRUB 2 <grub-devel@gnu.org> > Sent: Monday, 1 September, 2008 3:46:32 PM > Subject: Re: Windows,grub and grub2 > > On Mon, Sep 1, 2008 at 5:08 PM, Viswesh S <[EMAIL PROTECTED]> wrote: >> >> > > Hi, > > Do you mean the result is still the same after you apply my patch ? I > check the source code of grub legacy, the handling should be exactly > the same. Are you using the official branch grub 0.96, or some package > with modification ? > > You can also check memory at 0x7be, this should be the partition table > in mbr, %esi would point to the boot partition. > > -- > Bean > > Hi, > > The result is still the same after the patch. > > I am using the official grub2 released package 1.96. > > In that the chainloader patch wasnt there.Hence applied that according to > your inputs as in the mail. > > I checked the memory at 0x7be, which is the same as 0x1be in the mbr. > > The first partition was already active also. > > Also as I mentioned,what about the code for the int 13 extension and and > their functionalities for 2,41,42. > > Is there any change there. > > Otherwise I am not really sure, why grub is able to boot,but grub2 not.
Hi, I doubt that this is caused by int 13, as grub2 doesn't change it. Besides, the boot sector is read properly in grub2, so int 13 should be working. I have thought of another possible reason for this. In grub2, %dh is 0, perhaps it should be set to the partition number. Please test if the new patch works. -- Bean
diff --git a/loader/i386/pc/chainloader.c b/loader/i386/pc/chainloader.c index 825dbb3..5dcc08a 100644 --- a/loader/i386/pc/chainloader.c +++ b/loader/i386/pc/chainloader.c @@ -101,12 +101,25 @@ grub_chainloader_cmd (const char *filename, grub_chainloader_flags_t flags) /* In i386-pc, the id is equal to the BIOS drive number. */ drive = (int) disk->id; - if (p) + if ((p) && (p->index < 4)) { - grub_disk_read (disk, p->offset, 446, 64, - (char *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR); + int i; + + disk->dev->read (disk, 0, 1, + (char *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR); + + grub_memcpy ((char *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR, + (char *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR + 0x1be, + 64); + part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR + (p->index << 4)); + + for (i = 0; i < 4; i++) + *((char *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR + i * 16) = 0; + + *((unsigned char *) part_addr) = 0x80; + drive |= (p->index << 8); } } @@ -119,6 +132,8 @@ grub_chainloader_cmd (const char *filename, grub_chainloader_flags_t flags) boot_drive = drive; boot_part_addr = part_addr; + grub_printf ("edx = %x, %esi = %p\n", drive, part_addr); + grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 1); return;
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel