Il sab 27 dic 2025, 21:34 Philippe Mathieu-Daudé <[email protected]> ha scritto:
> 1/ we can not have "guest native" endianness in single binary > 2/ host endianness is only useful with "guest native" one, > otherwise if you know the guest endianness, you can just > use an explicit cpu_to_$endian method. > Host endianness is useful when not talking to the guest at all—e.g. for sockets or kernel APIs. *_he_* functions are basically just memcpy in that they support unaligned accesses; plus stn_he_p has the advantage of taking a value unlike memcpy which takes a pointer. Perhaps the source of the confusion is that they are in bswap.h but they (quite obviously since it's host endianness) never swap? I felt confident it was coherent because, except the ATI single > one-line case [*] which I believe is not the best implementation, > the rest of my series proved this API is easily removable, the > resulting code ending easier to understand IMHO. > It's easily removable because most of the time accesses are in guest endianness, or aligned, but the replacement for *_he_* functions is not picking a specific endianness; it's a normal pointer store. These are not super common but especially in hw/display/ you can find them. stn_he_p is the right choice for ATI. Paolo
