kvm: Synchronize cpu state in kvm_arch_stop_on_emulation_error()
[qemu/ar7.git] / exec-obsolete.h
blob94c23d0951bc50073a388959e050a4861af2add1
1 /*
2 * Declarations for obsolete exec.c functions
4 * Copyright 2011 Red Hat, Inc. and/or its affiliates
6 * Authors:
7 * Avi Kivity <avi@redhat.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or
10 * later. See the COPYING file in the top-level directory.
15 * This header is for use by exec.c and memory.c ONLY. Do not include it.
16 * The functions declared here will be removed soon.
19 #ifndef EXEC_OBSOLETE_H
20 #define EXEC_OBSOLETE_H
22 #ifndef WANT_EXEC_OBSOLETE
23 #error Do not include exec-obsolete.h
24 #endif
26 #ifndef CONFIG_USER_ONLY
28 ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
29 MemoryRegion *mr);
30 ram_addr_t qemu_ram_alloc(ram_addr_t size, MemoryRegion *mr);
31 void qemu_ram_free(ram_addr_t addr);
32 void qemu_ram_free_from_ptr(ram_addr_t addr);
34 struct MemoryRegion;
35 int cpu_register_io_memory(MemoryRegion *mr);
36 void cpu_unregister_io_memory(int table_address);
38 struct MemoryRegionSection;
39 void cpu_register_physical_memory_log(struct MemoryRegionSection *section,
40 bool readable, bool readonly);
42 void qemu_register_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size);
43 void qemu_unregister_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size);
45 int cpu_physical_memory_set_dirty_tracking(int enable);
47 #define VGA_DIRTY_FLAG 0x01
48 #define CODE_DIRTY_FLAG 0x02
49 #define MIGRATION_DIRTY_FLAG 0x08
51 /* read dirty bit (return 0 or 1) */
52 static inline int cpu_physical_memory_is_dirty(ram_addr_t addr)
54 return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] == 0xff;
57 static inline int cpu_physical_memory_get_dirty_flags(ram_addr_t addr)
59 return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS];
62 static inline int cpu_physical_memory_get_dirty(ram_addr_t start,
63 ram_addr_t length,
64 int dirty_flags)
66 int ret = 0;
67 uint8_t *p;
68 ram_addr_t addr, end;
70 end = TARGET_PAGE_ALIGN(start + length);
71 start &= TARGET_PAGE_MASK;
72 p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS);
73 for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
74 ret |= *p++ & dirty_flags;
76 return ret;
79 static inline void cpu_physical_memory_set_dirty(ram_addr_t addr)
81 ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] = 0xff;
84 static inline int cpu_physical_memory_set_dirty_flags(ram_addr_t addr,
85 int dirty_flags)
87 return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] |= dirty_flags;
90 static inline void cpu_physical_memory_set_dirty_range(ram_addr_t start,
91 ram_addr_t length,
92 int dirty_flags)
94 uint8_t *p;
95 ram_addr_t addr, end;
97 end = TARGET_PAGE_ALIGN(start + length);
98 start &= TARGET_PAGE_MASK;
99 p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS);
100 for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
101 *p++ |= dirty_flags;
105 static inline void cpu_physical_memory_mask_dirty_range(ram_addr_t start,
106 ram_addr_t length,
107 int dirty_flags)
109 int mask;
110 uint8_t *p;
111 ram_addr_t addr, end;
113 end = TARGET_PAGE_ALIGN(start + length);
114 start &= TARGET_PAGE_MASK;
115 mask = ~dirty_flags;
116 p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS);
117 for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
118 *p++ &= mask;
122 void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end,
123 int dirty_flags);
124 #endif
126 #endif