]> git.proxmox.com Git - mirror_qemu.git/commitdiff
memory: move functions is_romd and section_addr to memory API
authorBlue Swirl <blauwirbel@gmail.com>
Mon, 9 Apr 2012 17:38:52 +0000 (17:38 +0000)
committerBlue Swirl <blauwirbel@gmail.com>
Tue, 1 May 2012 10:45:07 +0000 (10:45 +0000)
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
cputlb.h
exec.c
memory.h

index 80f9b66262b72a565c1ff84418234b23c0695baa..2dc2c96cd80bf8a3270bca44b852a3c9c0c39fcb 100644 (file)
--- a/cputlb.h
+++ b/cputlb.h
@@ -32,8 +32,6 @@ void tlb_set_dirty(CPUArchState *env, target_ulong vaddr);
 extern int tlb_flush_count;
 
 /* exec.c */
-target_phys_addr_t memory_region_section_addr(MemoryRegionSection *section,
-                                              target_phys_addr_t addr);
 void tb_flush_jmp_cache(CPUArchState *env, target_ulong addr);
 target_phys_addr_t memory_region_section_get_iotlb(CPUArchState *env,
                                                    MemoryRegionSection *section,
@@ -43,9 +41,5 @@ target_phys_addr_t memory_region_section_get_iotlb(CPUArchState *env,
                                                    target_ulong *address);
 bool memory_region_is_unassigned(MemoryRegion *mr);
 
-static inline bool memory_region_is_romd(MemoryRegion *mr)
-{
-    return mr->rom_device && mr->readable;
-}
 #endif
 #endif
diff --git a/exec.c b/exec.c
index 62d4140f12828757699e8e381a418a60e0d16787..0607c9b6aa9a4b72c32eadbcc2e9e5646dc455ae 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -503,14 +503,6 @@ bool memory_region_is_unassigned(MemoryRegion *mr)
         && mr != &io_mem_watch;
 }
 
-target_phys_addr_t memory_region_section_addr(MemoryRegionSection *section,
-                                              target_phys_addr_t addr)
-{
-    addr -= section->offset_within_address_space;
-    addr += section->offset_within_region;
-    return addr;
-}
-
 #define mmap_lock() do { } while(0)
 #define mmap_unlock() do { } while(0)
 #endif
index 53ff62b6c0061637e4f1f71bbb7bdcee9805a462..740c48e8e56767342ab3e47e05614c67e8495b02 100644 (file)
--- a/memory.h
+++ b/memory.h
@@ -338,6 +338,19 @@ uint64_t memory_region_size(MemoryRegion *mr);
  */
 bool memory_region_is_ram(MemoryRegion *mr);
 
+/**
+ * memory_region_is_romd: check whether a memory region is ROMD
+ *
+ * Returns %true is a memory region is ROMD and currently set to allow
+ * direct reads.
+ *
+ * @mr: the memory region being queried
+ */
+static inline bool memory_region_is_romd(MemoryRegion *mr)
+{
+    return mr->rom_device && mr->readable;
+}
+
 /**
  * memory_region_name: get a memory region's name
  *
@@ -666,6 +679,22 @@ void memory_region_set_alias_offset(MemoryRegion *mr,
 MemoryRegionSection memory_region_find(MemoryRegion *address_space,
                                        target_phys_addr_t addr, uint64_t size);
 
+/**
+ * memory_region_section_addr: get offset within MemoryRegionSection
+ *
+ * Returns offset within MemoryRegionSection
+ *
+ * @section: the memory region section being queried
+ * @addr: address in address space
+ */
+static inline target_phys_addr_t
+memory_region_section_addr(MemoryRegionSection *section,
+                           target_phys_addr_t addr)
+{
+    addr -= section->offset_within_address_space;
+    addr += section->offset_within_region;
+    return addr;
+}
 
 /**
  * memory_global_sync_dirty_bitmap: synchronize the dirty log for all memory