]> Git Repo - qemu.git/commitdiff
Avoid cpu_physical_memory_rw() with a constant is_write argument
authorPhilippe Mathieu-Daudé <[email protected]>
Wed, 19 Feb 2020 19:34:58 +0000 (20:34 +0100)
committerPhilippe Mathieu-Daudé <[email protected]>
Thu, 20 Feb 2020 13:47:08 +0000 (14:47 +0100)
This commit was produced with the included Coccinelle script
scripts/coccinelle/exec_rw_const.

Inspired-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
hw/xen/xen_pt_graphics.c
scripts/coccinelle/exec_rw_const.cocci
target/i386/hax-all.c

index b11e4e0546d59500cdcd2cacd67599d5e16c7d4e..a3bc7e39214b3d71c32c8386758fdef6ced5c0df 100644 (file)
@@ -222,7 +222,7 @@ void xen_pt_setup_vga(XenPCIPassthroughState *s, XenHostPCIDevice *dev,
     }
 
     /* Currently we fixed this address as a primary for legacy BIOS. */
-    cpu_physical_memory_rw(0xc0000, bios, bios_size, true);
+    cpu_physical_memory_write(0xc0000, bios, bios_size);
 }
 
 uint32_t igd_read_opregion(XenPCIPassthroughState *s)
index 35ab79e6d74674d41685ce8264ea4fcee5c26d82..1a202969519b187a71614b345f1622249b3a5559 100644 (file)
@@ -62,6 +62,18 @@ symbol true, false;
 + address_space_write(E1, E2, E3, E4, E5)
 )
 
+// Avoid uses of cpu_physical_memory_rw() with a constant is_write argument.
+@@
+expression E1, E2, E3;
+@@
+(
+- cpu_physical_memory_rw(E1, E2, E3, false)
++ cpu_physical_memory_read(E1, E2, E3)
+|
+- cpu_physical_memory_rw(E1, E2, E3, true)
++ cpu_physical_memory_write(E1, E2, E3)
+)
+
 // Remove useless cast
 @@
 expression E1, E2, E3, E4, E5, E6;
index 38936d7af6caf719550bed938f807f290e9a9137..f9c83fff2547a21257c1ec3b14de977e84db54b9 100644 (file)
@@ -376,8 +376,8 @@ static int hax_handle_fastmmio(CPUArchState *env, struct hax_fastmmio *hft)
          *  hft->direction == 2: gpa ==> gpa2
          */
         uint64_t value;
-        cpu_physical_memory_rw(hft->gpa, &value, hft->size, false);
-        cpu_physical_memory_rw(hft->gpa2, &value, hft->size, true);
+        cpu_physical_memory_read(hft->gpa, &value, hft->size);
+        cpu_physical_memory_write(hft->gpa2, &value, hft->size);
     }
 
     return 0;
This page took 0.031104 seconds and 4 git commands to generate.