> On 04/23/2018 11:04 AM, Peter Maydell wrote:
>> On 23 April 2018 at 14:57, Philippe Mathieu-Daudé <[email protected]> wrote:
>>> On 04/23/2018 12:16 AM, David Gibson wrote:
>>>> On Sun, Apr 22, 2018 at 11:41:20AM +0100, Peter Maydell wrote:
>>>>> If we need to do an unaligned load, then ldl_p() is the
>>>>> right way to do it. (We could also just do
>>>>> *addr = ldl_be_p(prop) but we maybe don't want to
>>>>> bake in knowledge that FDT is big-endian).
>>>
>>> Since it is, ldl_be_p() seems the clever/cleaner way indeed, but then we
>>> assume we know the underlying type of fdt32_t; while using memcpy we
>>> respect the FDT API.
>>
>> *addr = fdt32_to_cpu(ldl_p(prop));
>>
>> is better than a raw memcpy still.
ldl_p() is target-specific, I'd prefer loader code to be target agnostic.
Since FDT is big-endian, are you OK I use, as you suggested,
*addr = ldq_be_p(prop);
(with a comment about FDT being BE)?