Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MAnSS-0000MS-EC for mharc-grub-devel@gnu.org; Sun, 31 May 2009 12:00:24 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MAnSQ-0000MF-5X for grub-devel@gnu.org; Sun, 31 May 2009 12:00:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MAnSL-0000Lj-NG for grub-devel@gnu.org; Sun, 31 May 2009 12:00:21 -0400 Received: from [199.232.76.173] (port=39910 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MAnSL-0000Lf-CD for grub-devel@gnu.org; Sun, 31 May 2009 12:00:17 -0400 Received: from mail-bw0-f161.google.com ([209.85.218.161]:52019) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MAnSK-0001un-Jh for grub-devel@gnu.org; Sun, 31 May 2009 12:00:16 -0400 Received: by bwz5 with SMTP id 5so7773336bwz.42 for ; Sun, 31 May 2009 09:00:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=c0KuGJfczG8DpHwrZimBANJGr4ZcGKUHBUx9wdjnvyo=; b=HP8RtVNWek1K25tjIkTnJAIvm737d8+egLDpCmyEyH5gXZZCd+HPWobiBgRO0N7+Lh u15oQmPbLiUNGFYwXjVREpIlz85TBDWNA166YSa/yTV2/+P5fcx/PAiktY8WdGKdBTR5 FN+DGALORN6PN8VKBL80cg+Fe4Z++Wt+Wdr6c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=ZRpg+rV1uhVFbAA77DgJ1z35dUBrV+eZu/Lom/GXGwXKv+hh855Cunxyqmg7kI3DT6 F5/2iHG0Z5QKjCHnfpcYD7VOn1JPPYYUPavB65zBxj1Khi8W8/C1NBW+EKPlo9ZJUFk5 kqkkWuaxlbW2+uM7PCBd/9DYfj5vku92yvO/8= MIME-Version: 1.0 Received: by 10.204.59.14 with SMTP id j14mr4750716bkh.39.1243785614786; Sun, 31 May 2009 09:00:14 -0700 (PDT) In-Reply-To: <1243774114.8044.2.camel@accesodirecto.casa> References: <49E3E0FB.1070907@verizon.net> <1242265918.21129.27.camel@mj> <1242309828.12546.15.camel@mj> <1242325022.6056.7.camel@mj> <1243764078.22342.10.camel@accesodirecto.casa> <1243774114.8044.2.camel@accesodirecto.casa> Date: Sun, 31 May 2009 18:00:14 +0200 Message-ID: From: "Vladimir 'phcoder' Serbinenko" To: The development of GRUB 2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: status grub2 port of grub-legasy map command 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, 31 May 2009 16:00:22 -0000 2009/5/31 Javier Mart=EDn : > El dom, 31-05-2009 a las 13:36 +0200, Vladimir 'phcoder' Serbinenko > escribi=F3: >> 2009/5/31 Javier Mart=EDn : >> > El s=E1b, 30-05-2009 a las 17:28 +0200, Vladimir 'phcoder' Serbinenko >> > escribi=F3: >> > Put it that way, I agree with your change. To the scrapper with >> > parse_biosdisk then! >> Sorry, I didn't mean to upset you. Here is a patch to do it > You did not upset me at all! I'm sorry if I seemed rude or hostile. I > truly meant to give you a go-ahead at scrapping that code. Ok, thanks >> >> Doing some tests I discovered that freedos MBR (but not the >> bootsector) relies on %dl being preserved across int 0x13. In the >> patch you can see additional hassle to preserve %dx. > Do not do this. Some BIOS functions (like ah=3D08h) return data in dl. > Clients should not expect data in registers to be preserved across > interrupt calls. I don't know if there is something like a 8086/PC-BIOS > ABI document that we can find to confirm the non-preservation of dl, but > the FreeDOS MBR should be fixed then. Thank you for pointing ah=3D8 function AFAIK there is no normative reference. The source which was mainly used for long years is helppc and it states following: - registers DS, BX, CX and DX are preserved (http://heim.ifi.uio.no/~stanisls/helppc/int_13.html) But now this reference is terribly outdated. SeaBIOS preserves %dl too According to wikipedia ah=3D8 is the only function which returns in %dl. I will write an updated version which restores %dx only if ah!=3D8 > I managed to get the right %dl passed with the following procedure: > let's say I want to boot FreeDOS on hd1, but I will drivemap it so that > it will become hd0. Instead of doing this: > root=3D(hd1,1) > drivemap -s (hd0) (hd1) > chainloader +1 > I do the following: > root=3D(hd0) > drivemap -s (hd0) (hd1) > chainloader (hd1,1)+1 > This gets the right number into %dl (I have not checked multiboot), but > I acknowledge that it's nothing more than a hack. And it sets es:di (pointer to partition table entry) to incorrect value > I cannot see a way for > drivemap to access that data and modify it according to the mappings > without breaking modularity with multiboot and chainloader I think of something like having a function pointer in kernel int (*grub_get_biosdisk) (grub_device_t dev) =3D grub_get_biosdisk_basic; static int grub_get_biosdisk_basic (grub_device_t dev) { if (! dev) return 0xff; if (! dev->disk) return 0xff; if (! dev->disk->dev) return 0xff; if (dev->disk->dev->id !=3D GRUB_DISK_DEVICE_BIOSDISK_ID) return 0xff; return (int) dev->disk->id; } Which can be easily overridden by drivemap But I don't really like this approach > (and what > about other loaders?). AFAIR only multiboot and chainloader pass bios drive number to payload. Other payloads are designed to use their own drivers (multiboot is designed for both possibilities). > > Regarding grub2 using its own drivers, we have no reliable way of > conclusively saying that (ata2)=3D=3D(hd1), so we'd better say nothing at > all and keep dl=3Dffh as we do currently. I thought of introducing a variable "biosdrive" and doing something like root=3Data1 biosdrive=3D0x81 chainloader +1 boot Setting %dl to 0xff if drive can't be determined reliably and isn't supplied by user is a good possibility. I'll do so. > > -- > -- Lazy, Oblivious, Recurrent Disaster -- Habbit > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel > > --=20 Regards Vladimir 'phcoder' Serbinenko