[OpenBIOS] [RFC] libopenbios: Adapt CIF handling for ppc64
Andreas Färber
andreas.faerber at web.de
Sat Dec 18 23:00:26 CET 2010
Am 18.12.2010 um 18:02 schrieb Andreas Färber:
> Am 18.12.2010 um 17:09 schrieb Blue Swirl:
>
>> On Sat, Dec 18, 2010 at 1:09 AM, Andreas Färber <andreas.faerber at web.de
>> > wrote:
>>> #define PROM_MAX_ARGS 10
>>> typedef struct prom_args {
>>> - const char *service;
>>> - long nargs;
>>> - long nret;
>>> - unsigned long args[PROM_MAX_ARGS];
>>> -} prom_args_t;
>>> +#ifdef CONFIG_PPC64
>>> + prom_uarg_t service;
>>> +#else
>>> + const char *service;
>>> +#endif
>>> + prom_arg_t nargs;
>>> + prom_arg_t nret;
>>> + prom_uarg_t args[PROM_MAX_ARGS];
>>> +} __attribute__((packed)) prom_args_t;
>>> +
>>> +static inline void* arg2pointer(prom_uarg_t value)
>>> +{
>>> + return (void*)(uintptr_t)value;
>>> +}
>>
>> Perhaps the the type of the return value should be const char *
>> instead, that may reduce the number of casts.
>
> Will try. I followed the cell2pointer() model.
>
>>> +
>>> +static inline const char* get_service(prom_args_t *pb)
>>> +{
>>> +#ifdef CONFIG_PPC64
>>> + return arg2pointer(pb->service);
>>> +#else
>>> + return pb->service;
>>> +#endif
>>
>> I don't think arg2pointer() has any effect for non-PPC64 hosts, so
>> you
>> could also unconditionally use arg2pointer().
CC target/libopenbios/client.o
cc1: warnings being treated as errors
../libopenbios/client.c: In function 'get_service':
../libopenbios/client.c:72:5: error: passing argument 1 of
'arg2pointer' makes integer from pointer without a cast
../libopenbios/client.c:65:21: note: expected 'prom_uarg_t' but
argument is of type 'const char *'
make[1]: *** [target/libopenbios/client.o] Error 1
A possible solution would be to always declare the service field as
prom_uarg_t but then it cannot easily be inspected in gdb.
Andreas
More information about the OpenBIOS
mailing list