[OpenBIOS] [PATCH] Introduce FMT_plx for phys_addr_t

Andreas Färber andreas.faerber at web.de
Mon Nov 8 20:27:13 CET 2010


Am 08.11.2010 um 19:20 schrieb Blue Swirl:

> On Sun, Nov 7, 2010 at 5:39 PM, Andreas Färber  
> <andreas.faerber at web.de> wrote:
>> Define a zero-padded format string to be used for phys_addr_t  
>> arguments.
>> Introduce PRIx{32,64} macros as needed.
>>
>> Cc: Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>
>> Cc: Blue Swirl <blauwirbel at gmail.com>
>> Signed-off-by: Andreas Färber <andreas.faerber at web.de>
>> ---
>
> Looks OK, except I'd always define PRIx64 etc. for consistency.

Will do.

>> diff --git a/include/arch/sparc64/types.h b/include/arch/sparc64/ 
>> types.h
>> index 8baa5ee..3a235d9 100644
>> --- a/include/arch/sparc64/types.h
>> +++ b/include/arch/sparc64/types.h
>> @@ -25,6 +25,8 @@ typedef short           int16_t;
>>  typedef int             int32_t;
>>  typedef long long       int64_t;
>>  typedef long            intptr_t;
>> +
>> +#define PRIx64 "llx"
>
> glibc uses just "lx" on 64 bit hosts.

Possibly, I was surprised too. But the format should match our type  
definition above.

When introducing phys_addr_t I ran into some long long assumptions so  
that I turned to uint64_t rather than unsigned long.
For intptr_t I believe the use of long was a convenient shortcut to  
avoid #ifdef'ed definitions, which happened to work since there was no  
prior art.
I therefore consider a long long -> long conversion material for a  
follow-on patch, if desired.

Andreas


More information about the OpenBIOS mailing list