[PATCH v2 07/10] hw/virtio: Replace TARGET_BIG_ENDIAN -> target_big_endian()

Philippe Mathieu-Daudé posted 10 patches 1 week ago
There is a newer version of this series
[PATCH v2 07/10] hw/virtio: Replace TARGET_BIG_ENDIAN -> target_big_endian()
Posted by Philippe Mathieu-Daudé 1 week ago
Check endianness at runtime to remove the target-specific
TARGET_BIG_ENDIAN definition.

Inspired-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/virtio/virtio.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index d64ecc29a89..9c5563f9bec 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3243,15 +3243,14 @@ static bool virtio_access_is_big_endian(const VirtIODevice *vdev)
     if (target_is_legacy_virtio_biendian()) {
         return virtio_is_big_endian(vdev);
     }
-#if TARGET_BIG_ENDIAN
+    if (!target_big_endian()) {
+        return false;
+    }
     if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
         /* Devices conforming to VIRTIO 1.0 or later are always LE. */
         return false;
     }
     return true;
-#else
-    return false;
-#endif
 }
 
 void virtio_reset(VirtIODevice *vdev)
-- 
2.52.0