]>
Commit | Line | Data |
---|---|---|
67d95c15 AK |
1 | /* |
2 | * Declarations for obsolete exec.c functions | |
3 | * | |
4 | * Copyright 2011 Red Hat, Inc. and/or its affiliates | |
5 | * | |
6 | * Authors: | |
7 | * Avi Kivity <[email protected]> | |
8 | * | |
6b620ca3 PB |
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. | |
67d95c15 AK |
11 | * |
12 | */ | |
13 | ||
14 | /* | |
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. | |
17 | */ | |
18 | ||
19 | #ifndef EXEC_OBSOLETE_H | |
20 | #define EXEC_OBSOLETE_H | |
21 | ||
22 | #ifndef WANT_EXEC_OBSOLETE | |
23 | #error Do not include exec-obsolete.h | |
24 | #endif | |
25 | ||
26 | #ifndef CONFIG_USER_ONLY | |
27 | ||
c5705a77 | 28 | ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, |
67d95c15 | 29 | MemoryRegion *mr); |
c5705a77 | 30 | ram_addr_t qemu_ram_alloc(ram_addr_t size, MemoryRegion *mr); |
67d95c15 AK |
31 | void qemu_ram_free(ram_addr_t addr); |
32 | void qemu_ram_free_from_ptr(ram_addr_t addr); | |
33 | ||
a621f38d | 34 | struct MemoryRegion; |
dd81124b AK |
35 | struct MemoryRegionSection; |
36 | void cpu_register_physical_memory_log(struct MemoryRegionSection *section, | |
d7ec83e6 | 37 | bool readonly); |
67d95c15 AK |
38 | |
39 | void qemu_register_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size); | |
40 | void qemu_unregister_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size); | |
41 | ||
8f77558f AK |
42 | int cpu_physical_memory_set_dirty_tracking(int enable); |
43 | ||
7638e0d2 AK |
44 | #define VGA_DIRTY_FLAG 0x01 |
45 | #define CODE_DIRTY_FLAG 0x02 | |
46 | #define MIGRATION_DIRTY_FLAG 0x08 | |
47 | ||
48 | /* read dirty bit (return 0 or 1) */ | |
49 | static inline int cpu_physical_memory_is_dirty(ram_addr_t addr) | |
50 | { | |
51 | return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] == 0xff; | |
52 | } | |
53 | ||
54 | static inline int cpu_physical_memory_get_dirty_flags(ram_addr_t addr) | |
55 | { | |
56 | return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS]; | |
57 | } | |
58 | ||
cd7a45c9 BS |
59 | static inline int cpu_physical_memory_get_dirty(ram_addr_t start, |
60 | ram_addr_t length, | |
7638e0d2 AK |
61 | int dirty_flags) |
62 | { | |
cd7a45c9 BS |
63 | int ret = 0; |
64 | uint8_t *p; | |
65 | ram_addr_t addr, end; | |
66 | ||
67 | end = TARGET_PAGE_ALIGN(start + length); | |
68 | start &= TARGET_PAGE_MASK; | |
69 | p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS); | |
70 | for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) { | |
71 | ret |= *p++ & dirty_flags; | |
72 | } | |
73 | return ret; | |
7638e0d2 AK |
74 | } |
75 | ||
76 | static inline void cpu_physical_memory_set_dirty(ram_addr_t addr) | |
77 | { | |
78 | ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] = 0xff; | |
79 | } | |
80 | ||
81 | static inline int cpu_physical_memory_set_dirty_flags(ram_addr_t addr, | |
82 | int dirty_flags) | |
83 | { | |
84 | return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] |= dirty_flags; | |
85 | } | |
86 | ||
fd4aa979 BS |
87 | static inline void cpu_physical_memory_set_dirty_range(ram_addr_t start, |
88 | ram_addr_t length, | |
89 | int dirty_flags) | |
90 | { | |
91 | uint8_t *p; | |
92 | ram_addr_t addr, end; | |
93 | ||
fd39941a AK |
94 | end = TARGET_PAGE_ALIGN(start + length); |
95 | start &= TARGET_PAGE_MASK; | |
fd4aa979 | 96 | p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS); |
fd39941a | 97 | for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) { |
fd4aa979 BS |
98 | *p++ |= dirty_flags; |
99 | } | |
100 | } | |
101 | ||
7638e0d2 | 102 | static inline void cpu_physical_memory_mask_dirty_range(ram_addr_t start, |
59abb061 | 103 | ram_addr_t length, |
7638e0d2 AK |
104 | int dirty_flags) |
105 | { | |
59abb061 | 106 | int mask; |
7638e0d2 | 107 | uint8_t *p; |
59abb061 | 108 | ram_addr_t addr, end; |
7638e0d2 | 109 | |
fd39941a AK |
110 | end = TARGET_PAGE_ALIGN(start + length); |
111 | start &= TARGET_PAGE_MASK; | |
7638e0d2 AK |
112 | mask = ~dirty_flags; |
113 | p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS); | |
fd39941a | 114 | for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) { |
59abb061 | 115 | *p++ &= mask; |
7638e0d2 AK |
116 | } |
117 | } | |
118 | ||
119 | void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end, | |
120 | int dirty_flags); | |
93632747 AK |
121 | |
122 | extern const IORangeOps memory_region_iorange_ops; | |
123 | ||
67d95c15 AK |
124 | #endif |
125 | ||
126 | #endif |