[U-Boot] register polling from HUSH parser?

Wolfgang Denk wd at denx.de
Thu Apr 28 22:33:50 CEST 2016


Dear Masahiro,

In message <CAK7LNATU2gnN2D2fXDVhpaoOeqOYDsOTRVcfW6uGTT8zQid4Kw at mail.gmail.com> you wrote:
> 
> Yes, it really helped me.
> Thank you!

You are welcome.

> I think itest.l works as expected on 32bit architecture,
> but the problem is that sizeof(unsigned long) is 8
> on 64bit architecture.

Oh, yes, you are right, of course. Well, U-Boot has been too long
written for 32 bit only...

> So, "case 4" in the following gets 8-byte data.
> This is probably not what we expect...
> 
>       switch (w) {
>       case 1:
>              l = (long)(*(unsigned char *)buf);
>              break;
>       case 2:
>              l = (long)(*(unsigned short *)buf);
>              break;
>       case 4:
>              l = (long)(*(unsigned long *)buf);
>              break;
>       }

You are right.  We should replace char/short/long by something more
descriptive like u8/u16/u32 - and for 64 bit systems, we should a
branch for 64 bit entities, too.

Do you think you can prepare such a patch?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Machines take me by surprise with great frequency.      - Alan Turing


More information about the U-Boot mailing list