From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KKiNj-0002nr-TS for mharc-grub-devel@gnu.org; Sun, 20 Jul 2008 19:31:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KKiNi-0002md-0Z for grub-devel@gnu.org; Sun, 20 Jul 2008 19:31:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KKiNe-0002m2-6Z for grub-devel@gnu.org; Sun, 20 Jul 2008 19:31:57 -0400 Received: from [199.232.76.173] (port=49649 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KKiNe-0002lz-0p for grub-devel@gnu.org; Sun, 20 Jul 2008 19:31:54 -0400 Received: from c60.cesmail.net ([216.154.195.49]:6344) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1KKiNd-00026u-NT for grub-devel@gnu.org; Sun, 20 Jul 2008 19:31:53 -0400 Received: from unknown (HELO relay.cesmail.net) ([192.168.1.81]) by c60.cesmail.net with ESMTP; 20 Jul 2008 19:31:52 -0400 Received: from [192.168.0.21] (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by relay.cesmail.net (Postfix) with ESMTP id D6773618F22 for ; Sun, 20 Jul 2008 19:31:51 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: <48834166.7050906@t-online.de> References: <1215264476.26019.160.camel@localhost> <1215293427.17114.2.camel@dv> <1215298499.26019.192.camel@localhost> <20080706183042.GA22023@thorin> <1215374534.26019.194.camel@localhost> <48726DB3.9000809@t-online.de> <4873AC32.3060004@t-online.de> <1215586047.31230.27.camel@dv> <1KGZ7b-1EcJsG0@fwd32.aul.t-online.de> <48834166.7050906@t-online.de> Content-Type: text/plain Date: Sun, 20 Jul 2008 19:31:50 -0400 Message-Id: <1216596710.14762.29.camel@dv> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 (2.22.3.1-1.fc9) Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: Endianness macros capitalization 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, 20 Jul 2008 23:31:58 -0000 On Sun, 2008-07-20 at 15:45 +0200, Christian Franke wrote: > Christian Franke wrote: > > But the function call in the 32-bit case requires only 5 bytes :-) > > > > Sorry, I was wrong here. The assumption about function call size was > only true for module-local calls. If a module calls a function in > kernel, each 5 byte call requires another 8 bytes for the ELF relocation > table entry. Actually, the new versions of gcc have __builtin_bswap32 and __builtin_bswap64, which are optimized even better. There is no __builtin_bswap16 because it is said that any correct implementation will be optimized anyway: http://gcc.gnu.org/ml/gcc-patches/2006-08/msg00079.html gcc 4.3.0 from Fedora is working fine with them. I'm not sure about gcc 4.2. There is only one bug. Suppose I use this: #define grub_swap_bytes32(x) __builtin_bswap32(x) #define grub_swap_bytes64(x) __builtin_bswap64(x) Then I get this warning: partmap/apple.c: In function 'apple_partition_map_iterate': partmap/apple.c:133: warning: format '%x' expects type 'unsigned int', but argument 8 has type 'unsigned int' partmap/apple.c:133: warning: format '%x' expects type 'unsigned int', but argument 9 has type 'unsigned int' Those arguments are produced by grub_swap_bytes32(). But if I use wrapper functions, then there are no warnings, and the code side is approximately the same. We'll need wrappers to support sparse. -- Regards, Pavel Roskin