On 14/11/10 16:10, Graeme Russ wrote:
> On 13/11/10 22:18, Graeme Russ wrote:
>> On 13/11/10 19:20, Albert ARIBAUD wrote:
>>> Le 13/11/2010 05:16, Graeme Russ a écrit :
>>>

> static inline void *get_gd_ptr(void)
> {
>       void *gd_ptr;
> 
>       asm volatile("gs mov 0, %0\n" : "=r" (gd_ptr));
>       return gd_ptr;
> }
> 

static inline gd_t *get_gd_ptr(void)
{
        gd_t *gd_ptr;

        asm volatile("fs mov 0, %0\n" : "=r" (gd_ptr));
        return gd_ptr;
}

works a treat :)

Is there any reason the other arches could not implement an inline function
as well? ARM for example:

-#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r8")

+static inline gd_t *gd(void)
+{
+       gd_t *gd_ptr;
+
+       asm volatile("mov r8, %0\n" : "=r" (gd_ptr));
+       return gd_ptr;
+}

Is the compiler smart enough to optimise out and not increase code size?

If so, all the arches can have identical implementations for using global data

Regards,

Graeme
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to