From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OT9YL-0000Av-7r for mharc-grub-devel@gnu.org; Mon, 28 Jun 2010 04:18:53 -0400 Received: from [140.186.70.92] (port=34205 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OT9YI-00009M-1w for grub-devel@gnu.org; Mon, 28 Jun 2010 04:18:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OT9YG-0004p4-IL for grub-devel@gnu.org; Mon, 28 Jun 2010 04:18:49 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:34398) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OT9YG-0004ow-AN for grub-devel@gnu.org; Mon, 28 Jun 2010 04:18:48 -0400 Received: by wyb39 with SMTP id 39so3217010wyb.0 for ; Mon, 28 Jun 2010 01:18:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type; bh=mvWNu22LUBQjXBZpVJ8kd/9djnycr8lH2hfsKu71I5I=; b=YZzf5oJz5eCb7NctH/DZnwXraJ1Ydlroq5eSglJ4NXbqNcxK7b7RN+wCON6+JJfKWV zd2nEadPN5x/ScSZXbMfETvuc1dlQG1yiNIhGjPtaY+1bcFleD1OucDnu+NC6z9bzDMk ZWVREXBYtn1oZ+mEhevq9RougRI42iL84JsOo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type; b=ZbcOp0yk+xJtpE02P3NZT66jtZ0Ib7RKEvtLCz+n8v0QNWTrGFxKTEFVVp4SCkpDV0 FyWWUOPKs3ZA6pHg8TrYHitccY6QDwBDH/eQBNl3EzrCyifHT3F5xWiucsA23spWKAJs UEDR/gmH5uIbwzZmgV1mFdF19v9acTXA8ilwM= Received: by 10.216.90.204 with SMTP id e54mr7798941wef.107.1277713127173; Mon, 28 Jun 2010 01:18:47 -0700 (PDT) Received: from debian.bg45.phnet (gprs55.swisscom-mobile.ch [193.247.250.55]) by mx.google.com with ESMTPS id o3sm2060824wee.14.2010.06.28.01.18.44 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 28 Jun 2010 01:18:45 -0700 (PDT) Message-ID: <4C285AE2.3020907@gmail.com> Date: Mon, 28 Jun 2010 10:18:42 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100515 Icedove/3.0.4 MIME-Version: 1.0 To: grub-devel@gnu.org References: <20100625212757.GA25312@feather> <20100625222049.GA29600@feather> In-Reply-To: <20100625222049.GA29600@feather> X-Enigmail-Version: 1.0.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigD62021CAEABCFD2DF73E8848" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [PATCHv2] grub2 int15 hook for e820/e801 does not return CF correctly; makes recent Linux detect only 64MB (via BIOS-88) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2010 08:18:51 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigD62021CAEABCFD2DF73E8848 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/26/2010 12:20 AM, Josh Triplett wrote: > On Fri, Jun 25, 2010 at 02:28:01PM -0700, Josh Triplett wrote: > =20 >> As I originally reported in http://bugs.debian.org/584846 , and later >> tracked down, grub2's int15 hook, used to augment functions e820/e801/= 88 >> for additional reserved memory (such as for drivemap), fails to return= >> its error status correctly, causing recent Linux (and possibly other >> OSes) to detect only 64MB via BIOS-88, ignoring e820 and e801. >> >> This occurs because the interrupt must return a status in CF, but afte= r >> using clc or stc to clear or set CF, it calls iret, which restores the= >> flags from the stack. Since recent Linux has CF set when it calls >> int15, CF remains set when the interrupt returns, indicating an error.= >> Linux's detect_memory_e820 and detect_memory_e801 functions thus canno= t >> retrieve any memory map, and Linux must fall back to function 88, whic= h >> cannot return more than 64MB. >> >> To reproduce this problem, just use the "drivemap" command and then bo= ot >> a recent Linux kernel (git commit >> c549e71d073a6e9a4847497344db28a784061455 or newer, meaning v2.6.30-rc1= >> or newer). In my case, I booted a USB drive with grub2 on it, used >> "drivemap -s (hd1) (hd0)", then chainloaded the hard drive. >> >> The following patch against latest bzr fixes this problem. (Thanks to= >> H. Peter Anvin for noticing a bug in my original patch and suggesting = a >> fix.) With this patch, Linux's memory detection can use e820 again, a= nd >> detect all memory. >> =20 > Revised patch, incorporating suggestion from phcoder to eliminate the > unnecessary jmp right before the iret_cf label: > > =20 Comitted. Thanks > =3D=3D=3D modified file 'mmap/i386/pc/mmap_helper.S' > --- mmap/i386/pc/mmap_helper.S 2010-03-26 23:04:14 +0000 > +++ mmap/i386/pc/mmap_helper.S 2010-06-25 22:16:53 +0000 > @@ -59,7 +59,7 @@ > movw %bx, %dx > pop %ds > clc > - iret > + jmp LOCAL (iret_cf) > =20 > LOCAL (h88): > popf > @@ -69,7 +69,7 @@ > movw DS (LOCAL (kbin16mb)), %ax > pop %ds > clc > - iret > + jmp LOCAL (iret_cf) > =20 > LOCAL (e820): > popf > @@ -101,12 +101,18 @@ > mov $0x534d4150, %eax > pop %ds > clc > - iret > + jmp LOCAL (iret_cf) > LOCAL (errexit): > mov $0x534d4150, %eax > pop %ds > + xor %bx, %bx > stc > - xor %bx, %bx > + > +LOCAL (iret_cf): > + push %bp > + mov %sp, %bp > + setc 6(%bp) > + pop %bp > iret > =20 > VARIABLE(grub_machine_mmaphook_mmap_num) > > > ChangeLog entry for this patch: > > > 2010-06-25 Josh Triplett > > * mmap/i386/pc/mmap_helper.S: Preserve CF by propagating it into the > flags on the stack before popping them with iret. Add a new iret_cf > label implementing this logic, and make the e820, e801, and 88 > handlers jump to it after setting or clearing CF. This fixes memory > detection with recent Linux (git commit > c549e71d073a6e9a4847497344db28a784061455 or newer, meaning v2.6.30-rc1= > or newer), which sets CF on entry to int15, and treats the preserved > CF on exit as an error in e820 and e801; without this change, it can > only successfully use BIOS-88 and detect only up to 64MB of RAM. > Originally reported as Debian bug #584846. > > > - Josh Triplett > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel > > =20 --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------enigD62021CAEABCFD2DF73E8848 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAkwoWuIACgkQNak7dOguQgnWAgD+Kuuuw/2/yOOB3JvDnk1Qiml6 mpo8tLQs252NFB9WhiYBAK3B4gglT2PbY8Fk3eKyljkILGhiG8trYaWlOW6jCuVr =zUxE -----END PGP SIGNATURE----- --------------enigD62021CAEABCFD2DF73E8848--