]> xenbits.xensource.com Git - qemu-xen-4.6-testing.git/commitdiff
Provide ldl_phys et al.
authorIan Jackson <iwj@mariner.uk.xensource.com>
Fri, 6 Jun 2008 15:28:00 +0000 (16:28 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 6 Jun 2008 15:28:00 +0000 (16:28 +0100)
We implement these in the Xen DM case as simple unoptimised wrappers
around cpu_physical_memory_write.

Several were copied directly from this qemu upstream commit:

    commit aab33094073678d459ccaac5c60ea7533e8d1d8e
    Author: bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
    Date:   Sun Oct 30 20:48:42 2005 +0000

more physical memory access functions

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1587 c046a42c-6fe2-441c-8c8c-71466251a162

I handwrote the others in the same pattern.

i386-dm/exec-dm.c

index 7796ba54b1c945491d308dc923e886fb139d0a0d..85e6579704f8d7d6330267bc50fc8c04e45e6e65 100644 (file)
@@ -617,3 +617,57 @@ void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end,
 
        return;
 }
+
+
+/* Unoptimised in Xen DM, nicked from git
+ *  aab33094073678d459ccaac5c60ea7533e8d1d8e */
+uint32_t ldub_phys(target_phys_addr_t addr)
+{
+    uint8_t val;
+    cpu_physical_memory_read(addr, &val, 1);
+    return val;
+}
+uint32_t lduw_phys(target_phys_addr_t addr)
+{
+    uint16_t val;
+    cpu_physical_memory_read(addr, (uint8_t *)&val, 2);
+    return tswap16(val);
+}
+uint64_t ldq_phys(target_phys_addr_t addr)
+{
+    uint64_t val;
+    cpu_physical_memory_read(addr, (uint8_t *)&val, 8);
+    return tswap64(val);
+}
+void stb_phys(target_phys_addr_t addr, uint32_t val)
+{
+    uint8_t v = val;
+    cpu_physical_memory_write(addr, &v, 1);
+}
+void stw_phys(target_phys_addr_t addr, uint32_t val)
+{
+    uint16_t v = tswap16(val);
+    cpu_physical_memory_write(addr, (const uint8_t *)&v, 2);
+}
+void stq_phys(target_phys_addr_t addr, uint64_t val)
+{
+    val = tswap64(val);
+    cpu_physical_memory_write(addr, (const uint8_t *)&val, 8);
+}
+
+/* stubs which we hope (think!) are OK for Xen DM */
+void stl_phys(target_phys_addr_t addr, uint32_t val)
+{
+    val = tswap32(val);
+    cpu_physical_memory_write(addr, (const uint8_t *)&val, 4);
+}
+void stl_phys_notdirty(target_phys_addr_t addr, uint32_t val)
+{
+    stl_phys(addr, val);
+}
+uint32_t ldl_phys(target_phys_addr_t addr)
+{
+    uint32_t val;
+    cpu_physical_memory_read(addr, (uint8_t *)&val, 4);
+    return tswap32(val);
+}