dgibson / dtc

Device Tree Compiler
218 stars 130 forks source link

Endianness clarification: misleading types for load/store #44

Closed fozog closed 3 years ago

fozog commented 3 years ago

fdt32_ld() fdt64_ld() fdt32_st() and fdt64_st() were using host endian types while they should indicate they load or store fdt32_t or fdt64_t values.

dgibson commented 3 years ago

This change is not correct. The uint32_t (etc.) return values correctly indicate that the return value has been changed from the big-endian value in the dtb to host native endian. Thats the whole point of these functions.

fozog commented 3 years ago

This change is not correct. The uint32_t (etc.) return values correctly indicate that the return value has been changed from the big-endian value in the dtb to host native endian. Thats the whole point of these functions.

Actually, it translates to little-endian, not host native endian. That's what confused me. On a big endian system you have to call cpu_to_fdt64 on the returned value to use it.

Sorry for the invalid pull request that I made way to quick.... I commit to react more slowly next time ;-)

dgibson commented 3 years ago

Uh, no, it translates to host native. Look again.