diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-02-06 19:46:14 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-02-06 19:46:14 +0000 |
commit | 1ccde1cb942f77958776578939bbcfc4c9bdf362 (patch) | |
tree | 9a7ff8a5b2779d220b28517ec3b8fa56e17362e5 /cpu-all.h | |
parent | ad08132319713918a58b1ffa35a57431ed294888 (diff) |
added generic physical memory dirty bit support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@601 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cpu-all.h')
-rw-r--r-- | cpu-all.h | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -500,6 +500,7 @@ int cpu_inl(CPUState *env, int addr); extern int phys_ram_size; extern int phys_ram_fd; extern uint8_t *phys_ram_base; +extern uint8_t *phys_ram_dirty; /* physical memory access */ #define IO_MEM_NB_ENTRIES 256 @@ -509,9 +510,11 @@ extern uint8_t *phys_ram_base; #define IO_MEM_RAM (0 << IO_MEM_SHIFT) /* hardcoded offset */ #define IO_MEM_ROM (1 << IO_MEM_SHIFT) /* hardcoded offset */ #define IO_MEM_UNASSIGNED (2 << IO_MEM_SHIFT) -#define IO_MEM_CODE (3 << IO_MEM_SHIFT) +#define IO_MEM_CODE (3 << IO_MEM_SHIFT) /* used internally, never use directly */ +#define IO_MEM_NOTDIRTY (4 << IO_MEM_SHIFT) /* used internally, never use directly */ -typedef void CPUWriteMemoryFunc(uint32_t addr, uint32_t value); +/* NOTE: vaddr is only used internally. Never use it except if you know what you do */ +typedef void CPUWriteMemoryFunc(uint32_t addr, uint32_t value, uint32_t vaddr); typedef uint32_t CPUReadMemoryFunc(uint32_t addr); void cpu_register_physical_memory(unsigned long start_addr, unsigned long size, @@ -525,6 +528,19 @@ void cpu_physical_memory_rw(CPUState *env, uint8_t *buf, target_ulong addr, int cpu_memory_rw_debug(CPUState *env, uint8_t *buf, target_ulong addr, int len, int is_write); +/* read dirty bit (return 0 or 1) */ +static inline int cpu_physical_memory_is_dirty(target_ulong addr) +{ + return phys_ram_dirty[addr >> TARGET_PAGE_BITS]; +} + +static inline void cpu_physical_memory_set_dirty(target_ulong addr) +{ + phys_ram_dirty[addr >> TARGET_PAGE_BITS] = 1; +} + +void cpu_physical_memory_reset_dirty(target_ulong start, target_ulong end); + /* gdb stub API */ extern int gdbstub_fd; CPUState *cpu_gdbstub_get_env(void *opaque); |