From: Philippe Mathieu-Daudé Date: Tue, 9 Dec 2025 18:24:05 +0000 (+0100) Subject: system: Allow restricting the legacy DEVICE_NATIVE_ENDIAN definition X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b2f8590632204dc61d6973442ea815e9dad5ba8;p=thirdparty%2Fqemu.git system: Allow restricting the legacy DEVICE_NATIVE_ENDIAN definition Guard the native endian definition we want to remove by surrounding it with TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API #ifdef'ry. Assign values to the enumerators so they stay unchanged. Once a target gets cleaned we'll set the definition in the target config, then the target won't be able to use the legacy API anymore. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-ID: <20260109165058.59144-21-philmd@linaro.org> --- diff --git a/include/system/memory.h b/include/system/memory.h index 92028dc7a4..8f8725ea2d 100644 --- a/include/system/memory.h +++ b/include/system/memory.h @@ -27,9 +27,11 @@ #include "qemu/rcu.h" enum device_endian { - DEVICE_NATIVE_ENDIAN, - DEVICE_BIG_ENDIAN, - DEVICE_LITTLE_ENDIAN, +#ifndef TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API + DEVICE_NATIVE_ENDIAN = 0, +#endif + DEVICE_BIG_ENDIAN = 1, + DEVICE_LITTLE_ENDIAN = 2, }; #define RAM_ADDR_INVALID (~(ram_addr_t)0) diff --git a/system/memory-internal.h b/system/memory-internal.h index 46f758fa7e..5f0524756e 100644 --- a/system/memory-internal.h +++ b/system/memory-internal.h @@ -41,9 +41,11 @@ void mtree_print_dispatch(struct AddressSpaceDispatch *d, /* returns true if end is big endian. */ static inline bool devend_big_endian(enum device_endian end) { +#ifndef TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API if (end == DEVICE_NATIVE_ENDIAN) { return target_big_endian(); } +#endif return end == DEVICE_BIG_ENDIAN; }