summaryrefslogtreecommitdiff
path: root/cpu-all.h
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2010-06-11 11:11:42 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2010-06-14 11:12:53 -0500
commitf471a17e9d869df3c6573f7ec02c4725676d6f3a (patch)
tree447a8cd3fde73cc5415a6635d40c7ef42164bac0 /cpu-all.h
parent2ffcb18de0bc02ad8a836ec955584c02b70e0e24 (diff)
ram_blocks: Convert to a QLIST
This makes the RAM block list easier to manipulate. Also incorporate relevant variables into the RAMList struct. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Acked-by: Chris Wright <chrisw@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'cpu-all.h')
-rw-r--r--cpu-all.h28
1 files changed, 20 insertions, 8 deletions
diff --git a/cpu-all.h b/cpu-all.h
index 77eaf85735..e31c2de7bf 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -859,9 +859,21 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr);
/* memory API */
extern int phys_ram_fd;
-extern uint8_t *phys_ram_dirty;
extern ram_addr_t ram_size;
-extern ram_addr_t last_ram_offset;
+
+typedef struct RAMBlock {
+ uint8_t *host;
+ ram_addr_t offset;
+ ram_addr_t length;
+ QLIST_ENTRY(RAMBlock) next;
+} RAMBlock;
+
+typedef struct RAMList {
+ uint8_t *phys_dirty;
+ ram_addr_t last_offset;
+ QLIST_HEAD(ram, RAMBlock) blocks;
+} RAMList;
+extern RAMList ram_list;
extern const char *mem_path;
extern int mem_prealloc;
@@ -891,29 +903,29 @@ extern int mem_prealloc;
/* read dirty bit (return 0 or 1) */
static inline int cpu_physical_memory_is_dirty(ram_addr_t addr)
{
- return phys_ram_dirty[addr >> TARGET_PAGE_BITS] == 0xff;
+ return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] == 0xff;
}
static inline int cpu_physical_memory_get_dirty_flags(ram_addr_t addr)
{
- return phys_ram_dirty[addr >> TARGET_PAGE_BITS];
+ return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS];
}
static inline int cpu_physical_memory_get_dirty(ram_addr_t addr,
int dirty_flags)
{
- return phys_ram_dirty[addr >> TARGET_PAGE_BITS] & dirty_flags;
+ return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] & dirty_flags;
}
static inline void cpu_physical_memory_set_dirty(ram_addr_t addr)
{
- phys_ram_dirty[addr >> TARGET_PAGE_BITS] = 0xff;
+ ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] = 0xff;
}
static inline int cpu_physical_memory_set_dirty_flags(ram_addr_t addr,
int dirty_flags)
{
- return phys_ram_dirty[addr >> TARGET_PAGE_BITS] |= dirty_flags;
+ return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] |= dirty_flags;
}
static inline void cpu_physical_memory_mask_dirty_range(ram_addr_t start,
@@ -925,7 +937,7 @@ static inline void cpu_physical_memory_mask_dirty_range(ram_addr_t start,
len = length >> TARGET_PAGE_BITS;
mask = ~dirty_flags;
- p = phys_ram_dirty + (start >> TARGET_PAGE_BITS);
+ p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS);
for (i = 0; i < len; i++) {
p[i] &= mask;
}