aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@redhat.com>2020-02-24 19:23:40 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2020-03-17 15:18:46 +0100
commitd3ec684d70d98a9fbc56fda1b611d039c90d0c5f (patch)
treeef11879bc8fde6efeb14900fca4e0c0212f40a3c /scripts
parent044e2af9f5f55d81be754a0e2ba1d206ad2b3bc6 (diff)
downloadqemu-d3ec684d70d98a9fbc56fda1b611d039c90d0c5f.zip
qemu-d3ec684d70d98a9fbc56fda1b611d039c90d0c5f.tar.gz
qemu-d3ec684d70d98a9fbc56fda1b611d039c90d0c5f.tar.bz2
scripts/cocci: Patch to replace memory_region_init_{ram,readonly -> rom}
Add a semantic patch to replace memory_region_init_ram(readonly) by memory_region_init_rom(). Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/coccinelle/memory-region-housekeeping.cocci18
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/coccinelle/memory-region-housekeeping.cocci b/scripts/coccinelle/memory-region-housekeeping.cocci
index 3699c10..ee3923d 100644
--- a/scripts/coccinelle/memory-region-housekeeping.cocci
+++ b/scripts/coccinelle/memory-region-housekeeping.cocci
@@ -11,6 +11,24 @@
*/
+// Replace memory_region_init_ram(readonly) by memory_region_init_rom()
+@@
+expression E1, E2, E3, E4, E5;
+symbol true;
+@@
+(
+- memory_region_init_ram(E1, E2, E3, E4, E5);
++ memory_region_init_rom(E1, E2, E3, E4, E5);
+ ... WHEN != E1
+- memory_region_set_readonly(E1, true);
+|
+- memory_region_init_ram_nomigrate(E1, E2, E3, E4, E5);
++ memory_region_init_rom_nomigrate(E1, E2, E3, E4, E5);
+ ... WHEN != E1
+- memory_region_set_readonly(E1, true);
+)
+
+
// Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram
// code sequences with use of the new memory_region_init_ram function.
// Similarly for the _rom and _rom_device functions.