Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MTbxa-0007HV-HQ for mharc-grub-devel@gnu.org; Wed, 22 Jul 2009 09:34:18 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MTbxX-0007Bv-Ej for grub-devel@gnu.org; Wed, 22 Jul 2009 09:34:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MTbxS-00071e-Mj for grub-devel@gnu.org; Wed, 22 Jul 2009 09:34:14 -0400 Received: from [199.232.76.173] (port=40638 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTbxS-00071W-J1 for grub-devel@gnu.org; Wed, 22 Jul 2009 09:34:10 -0400 Received: from mail-px0-f193.google.com ([209.85.216.193]:41206) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MTbxR-0002YI-RQ for grub-devel@gnu.org; Wed, 22 Jul 2009 09:34:10 -0400 Received: by pxi31 with SMTP id 31so132623pxi.14 for ; Wed, 22 Jul 2009 06:34:08 -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=9RqX6/RYPSnAmnQ7/R+DxSnQKGc7XXqrbR7dZ7Kx1yo=; b=spZUxInR7eDt2dAwUUudGyWpqU6j3RP5yFaYu/sZ0F1GV2M61wKpdw+SS9R2xAT1Ik U4RSqEYyPuFyJWqAq/KfCaP1/+5M6IeNtuCl+Y/1S3OpQxTp4hvav56dL/bE0U8TwPSM TvmJdLieFu+wPBYwwY9rr+cpf9AB7Z987ZEp8= 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=kUVqBdP+CAQjcRquI2WmZa8mbTAuc2FMLM25o9VTKoBMhLK9/R4hjghWhdaGMQhU7r CRR0IiYsAl9tVm11OKFsDrXgIxT1rgxFrp1rHw3HN054ibpFjewbttTEafK1HttaC15Z hibXJ49VayR814e41cLqSj5EEYXiVCxo5Wfzc= MIME-Version: 1.0 Received: by 10.115.58.9 with SMTP id l9mr510217wak.3.1248269648751; Wed, 22 Jul 2009 06:34:08 -0700 (PDT) In-Reply-To: <1248263254.10302.11.camel@accesodirecto.casa> References: <4A627C5A.5070700@isaac.cedarswampstudios.org> <1248263254.10302.11.camel@accesodirecto.casa> Date: Wed, 22 Jul 2009 21:34:08 +0800 Message-ID: From: Bean 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: [PATCH] New object format 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: Wed, 22 Jul 2009 13:34:15 -0000 2009/7/22 Javier Mart=EDn : > El mi=E9, 22-07-2009 a las 19:12 +0800, Bean escribi=F3: >> Fix some wrong assumption in types.h and efi header files. For >> example, grub_efi_uint_t is defined as unsigned long, but it should be >> grub_uint64_t in 64-bit EFI, this problem won't show previously as >> unsigned long is 64-bit in elf64 gcc, but it's 32-bit in mingw-w64 >> gcc. > I think you haven't corrected _all_ such assumptions. For example, in > your grub/types.h: > > #if GRUB_CPU_SIZEOF_VOID_P =3D=3D 8 > # define GRUB_ULONG_MAX 18446744073709551615UL > # define GRUB_LONG_MAX 9223372036854775807L > # define GRUB_LONG_MIN (-9223372036854775807L - 1) > #else > # define GRUB_ULONG_MAX 4294967295UL > # define GRUB_LONG_MAX 2147483647L > # define GRUB_LONG_MIN (-2147483647L - 1) > #endif > > In mingw64, sizeof(void*) =3D 8, but ULONG_MAX =3D 2^32-1. > grub/machine/types.h defines a GRUB_TARGET_SIZEOF_LONG that might be > suitable for this. Or am I mixing "target" with "host"? Hi, Oh, thanks for the note. In fact, we can use GRUB_CPU_SIZEOF_LONG, its value is GRUB_TARGET_SIZEOF_LONG when building target, and SIZEOF_LONG when building utilities. For example, I now define grub_uint64_t as: #if GRUB_CPU_SIZEOF_LONG =3D=3D 8 typedef unsigned long grub_uint64_t; #else typedef unsigned long long grub_uint64_t; #endif The previous definition is not correct: #if GRUB_CPU_SIZEOF_VOID_P =3D=3D 8 typedef unsigned long grub_uint64_t; #else typedef unsigned long long grub_uint64_t; #endif As GRUB_CPU_SIZEOF_LONG doesn't necessary equal to GRUB_CPU_SIZEOF_VOID_P. (It actually avoid this by generating an #errror message when GRUB_CPU_SIZEOF_VOID_P !=3D GRUB_CPU_SIZEOF_LONG). --=20 Bean