[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Detect endian in cpio fs
From: |
Bean |
Subject: |
Re: [PATCH] Detect endian in cpio fs |
Date: |
Fri, 28 Aug 2009 20:20:03 +0800 |
On Fri, Aug 28, 2009 at 8:03 PM, Vladimir 'phcoder'
Serbinenko<address@hidden> wrote:
> On Thu, Aug 27, 2009 at 10:27 AM, Bean<address@hidden> wrote:
>> Hi,
>>
>> This patch allows to access big/little endian cpio archive from
>> big/little endian machine.
> Quick glance showed that you use swap_bytes. Could you use
> grub_*_to_cpu* instead? This would simplify the future maintainability
> if someone decides to port to a very special platform (e.g.
> mixed-endian) since code would be uniform
Hi,
Actually it's not correct to use grub_*_to_cpu*. The code works by
first assuming cpio uses the same endian of host cpu, if not, swap it
and try the other endian. This method works for big/little endian cpio
on big/little endian machine. It's possible to achieve the same result
with a combination of #ifdef and grub_*_to_cpu*'s, but it's not as
simple as this and generate more code than necessary.
--
Bean
gitgrub home: http://github.com/grub/grub/
my fork page: http://github.com/bean123/grub/