diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2010-06-11 11:11:42 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-06-14 11:12:53 -0500 |
commit | f471a17e9d869df3c6573f7ec02c4725676d6f3a (patch) | |
tree | 447a8cd3fde73cc5415a6635d40c7ef42164bac0 /cpu-all.h | |
parent | 2ffcb18de0bc02ad8a836ec955584c02b70e0e24 (diff) | |
download | qemu-f471a17e9d869df3c6573f7ec02c4725676d6f3a.zip qemu-f471a17e9d869df3c6573f7ec02c4725676d6f3a.tar.gz qemu-f471a17e9d869df3c6573f7ec02c4725676d6f3a.tar.bz2 |
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.h | 28 |
1 files changed, 20 insertions, 8 deletions
@@ -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; } |