qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/2] pvpanic: fix fwcfg for big endian hosts


From: Michael S. Tsirkin
Subject: [Qemu-devel] [PATCH 2/2] pvpanic: fix fwcfg for big endian hosts
Date: Sun, 16 Jun 2013 23:59:49 +0300

Convert port number to little endian when
exposing it in fw cfg.

Signed-off-by: Michael S. Tsirkin <address@hidden>
---
 hw/misc/pvpanic.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c
index 9ed9897..151eefe 100644
--- a/hw/misc/pvpanic.c
+++ b/hw/misc/pvpanic.c
@@ -106,12 +106,13 @@ int pvpanic_init(ISABus *bus)
     ISADevice *dev = isa_create_simple(bus, TYPE_ISA_PVPANIC_DEVICE);
     PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
     FWCfgState *fw_cfg = fw_cfg_find();
+    uint16_t *pvpanic_port = g_malloc(sizeof(*pvpanic_port));
+    *pvpanic_port = cpu_to_le16(s->ioport);
 
     assert(fw_cfg);
 
-    fw_cfg_add_file(fw_cfg, "etc/pvpanic-port",
-                    g_memdup(&s->ioport, sizeof(s->ioport)),
-                    sizeof(s->ioport));
+    fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port,
+                    sizeof(*pvpanic_port));
 
     return 0;
 }
-- 
MST



reply via email to

[Prev in Thread] Current Thread [Next in Thread]