On 1/10/26 03:50, Philippe Mathieu-Daudé wrote:
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é <[email protected]>
---
include/system/memory.h | 8 +++++---
system/memory-internal.h | 2 ++
2 files changed, 7 insertions(+), 3 deletions(-)
Reviewed-by: Richard Henderson <[email protected]>
r~
diff --git a/include/system/memory.h b/include/system/memory.h
index 92028dc7a4e..8f8725ea2d5 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 46f758fa7e4..5f0524756eb 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;
}