root / exec-obsolete.h @ 94befa45
History | View | Annotate | Download (4.2 kB)
1 | 67d95c15 | Avi Kivity | /*
|
---|---|---|---|
2 | 67d95c15 | Avi Kivity | * Declarations for obsolete exec.c functions
|
3 | 67d95c15 | Avi Kivity | *
|
4 | 67d95c15 | Avi Kivity | * Copyright 2011 Red Hat, Inc. and/or its affiliates
|
5 | 67d95c15 | Avi Kivity | *
|
6 | 67d95c15 | Avi Kivity | * Authors:
|
7 | 67d95c15 | Avi Kivity | * Avi Kivity <avi@redhat.com>
|
8 | 67d95c15 | Avi Kivity | *
|
9 | 6b620ca3 | Paolo Bonzini | * This work is licensed under the terms of the GNU GPL, version 2 or
|
10 | 6b620ca3 | Paolo Bonzini | * later. See the COPYING file in the top-level directory.
|
11 | 67d95c15 | Avi Kivity | *
|
12 | 67d95c15 | Avi Kivity | */
|
13 | 67d95c15 | Avi Kivity | |
14 | 67d95c15 | Avi Kivity | /*
|
15 | 67d95c15 | Avi Kivity | * This header is for use by exec.c and memory.c ONLY. Do not include it.
|
16 | 67d95c15 | Avi Kivity | * The functions declared here will be removed soon.
|
17 | 67d95c15 | Avi Kivity | */
|
18 | 67d95c15 | Avi Kivity | |
19 | 67d95c15 | Avi Kivity | #ifndef EXEC_OBSOLETE_H
|
20 | 67d95c15 | Avi Kivity | #define EXEC_OBSOLETE_H
|
21 | 67d95c15 | Avi Kivity | |
22 | 67d95c15 | Avi Kivity | #ifndef WANT_EXEC_OBSOLETE
|
23 | 67d95c15 | Avi Kivity | #error Do not include exec-obsolete.h
|
24 | 67d95c15 | Avi Kivity | #endif
|
25 | 67d95c15 | Avi Kivity | |
26 | 67d95c15 | Avi Kivity | #ifndef CONFIG_USER_ONLY
|
27 | e226939d | Anthony PERARD | #include "hw/xen.h" |
28 | 67d95c15 | Avi Kivity | |
29 | c5705a77 | Avi Kivity | ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
|
30 | 67d95c15 | Avi Kivity | MemoryRegion *mr); |
31 | c5705a77 | Avi Kivity | ram_addr_t qemu_ram_alloc(ram_addr_t size, MemoryRegion *mr); |
32 | 67d95c15 | Avi Kivity | void qemu_ram_free(ram_addr_t addr);
|
33 | 67d95c15 | Avi Kivity | void qemu_ram_free_from_ptr(ram_addr_t addr);
|
34 | 67d95c15 | Avi Kivity | |
35 | a621f38d | Avi Kivity | struct MemoryRegion;
|
36 | dd81124b | Avi Kivity | struct MemoryRegionSection;
|
37 | dd81124b | Avi Kivity | void cpu_register_physical_memory_log(struct MemoryRegionSection *section, |
38 | d7ec83e6 | Avi Kivity | bool readonly);
|
39 | 67d95c15 | Avi Kivity | |
40 | 67d95c15 | Avi Kivity | void qemu_register_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size);
|
41 | 67d95c15 | Avi Kivity | void qemu_unregister_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size);
|
42 | 67d95c15 | Avi Kivity | |
43 | 8f77558f | Avi Kivity | int cpu_physical_memory_set_dirty_tracking(int enable); |
44 | 8f77558f | Avi Kivity | |
45 | 7638e0d2 | Avi Kivity | #define VGA_DIRTY_FLAG 0x01 |
46 | 7638e0d2 | Avi Kivity | #define CODE_DIRTY_FLAG 0x02 |
47 | 7638e0d2 | Avi Kivity | #define MIGRATION_DIRTY_FLAG 0x08 |
48 | 7638e0d2 | Avi Kivity | |
49 | 1720aeee | Juan Quintela | static inline int cpu_physical_memory_get_dirty_flags(ram_addr_t addr) |
50 | 7638e0d2 | Avi Kivity | { |
51 | 1720aeee | Juan Quintela | return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS];
|
52 | 7638e0d2 | Avi Kivity | } |
53 | 7638e0d2 | Avi Kivity | |
54 | 1720aeee | Juan Quintela | /* read dirty bit (return 0 or 1) */
|
55 | 1720aeee | Juan Quintela | static inline int cpu_physical_memory_is_dirty(ram_addr_t addr) |
56 | 7638e0d2 | Avi Kivity | { |
57 | 1720aeee | Juan Quintela | return cpu_physical_memory_get_dirty_flags(addr) == 0xff; |
58 | 7638e0d2 | Avi Kivity | } |
59 | 7638e0d2 | Avi Kivity | |
60 | cd7a45c9 | Blue Swirl | static inline int cpu_physical_memory_get_dirty(ram_addr_t start, |
61 | cd7a45c9 | Blue Swirl | ram_addr_t length, |
62 | 7638e0d2 | Avi Kivity | int dirty_flags)
|
63 | 7638e0d2 | Avi Kivity | { |
64 | cd7a45c9 | Blue Swirl | int ret = 0; |
65 | cd7a45c9 | Blue Swirl | ram_addr_t addr, end; |
66 | cd7a45c9 | Blue Swirl | |
67 | cd7a45c9 | Blue Swirl | end = TARGET_PAGE_ALIGN(start + length); |
68 | cd7a45c9 | Blue Swirl | start &= TARGET_PAGE_MASK; |
69 | cd7a45c9 | Blue Swirl | for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
|
70 | 1720aeee | Juan Quintela | ret |= cpu_physical_memory_get_dirty_flags(addr) & dirty_flags; |
71 | cd7a45c9 | Blue Swirl | } |
72 | cd7a45c9 | Blue Swirl | return ret;
|
73 | 7638e0d2 | Avi Kivity | } |
74 | 7638e0d2 | Avi Kivity | |
75 | 1720aeee | Juan Quintela | static inline int cpu_physical_memory_set_dirty_flags(ram_addr_t addr, |
76 | 1720aeee | Juan Quintela | int dirty_flags)
|
77 | 1720aeee | Juan Quintela | { |
78 | 45f33f01 | Juan Quintela | if ((dirty_flags & MIGRATION_DIRTY_FLAG) &&
|
79 | 45f33f01 | Juan Quintela | !cpu_physical_memory_get_dirty(addr, TARGET_PAGE_SIZE, |
80 | 45f33f01 | Juan Quintela | MIGRATION_DIRTY_FLAG)) { |
81 | 45f33f01 | Juan Quintela | ram_list.dirty_pages++; |
82 | 45f33f01 | Juan Quintela | } |
83 | 1720aeee | Juan Quintela | return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] |= dirty_flags;
|
84 | 1720aeee | Juan Quintela | } |
85 | 1720aeee | Juan Quintela | |
86 | 7638e0d2 | Avi Kivity | static inline void cpu_physical_memory_set_dirty(ram_addr_t addr) |
87 | 7638e0d2 | Avi Kivity | { |
88 | 1720aeee | Juan Quintela | cpu_physical_memory_set_dirty_flags(addr, 0xff);
|
89 | 7638e0d2 | Avi Kivity | } |
90 | 7638e0d2 | Avi Kivity | |
91 | 1720aeee | Juan Quintela | static inline int cpu_physical_memory_clear_dirty_flags(ram_addr_t addr, |
92 | 1720aeee | Juan Quintela | int dirty_flags)
|
93 | 7638e0d2 | Avi Kivity | { |
94 | 1720aeee | Juan Quintela | int mask = ~dirty_flags;
|
95 | 1720aeee | Juan Quintela | |
96 | 45f33f01 | Juan Quintela | if ((dirty_flags & MIGRATION_DIRTY_FLAG) &&
|
97 | 45f33f01 | Juan Quintela | cpu_physical_memory_get_dirty(addr, TARGET_PAGE_SIZE, |
98 | 45f33f01 | Juan Quintela | MIGRATION_DIRTY_FLAG)) { |
99 | 45f33f01 | Juan Quintela | ram_list.dirty_pages--; |
100 | 45f33f01 | Juan Quintela | } |
101 | 1720aeee | Juan Quintela | return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] &= mask;
|
102 | 7638e0d2 | Avi Kivity | } |
103 | 7638e0d2 | Avi Kivity | |
104 | fd4aa979 | Blue Swirl | static inline void cpu_physical_memory_set_dirty_range(ram_addr_t start, |
105 | fd4aa979 | Blue Swirl | ram_addr_t length, |
106 | fd4aa979 | Blue Swirl | int dirty_flags)
|
107 | fd4aa979 | Blue Swirl | { |
108 | fd4aa979 | Blue Swirl | ram_addr_t addr, end; |
109 | fd4aa979 | Blue Swirl | |
110 | fd39941a | Avi Kivity | end = TARGET_PAGE_ALIGN(start + length); |
111 | fd39941a | Avi Kivity | start &= TARGET_PAGE_MASK; |
112 | fd39941a | Avi Kivity | for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
|
113 | 1720aeee | Juan Quintela | cpu_physical_memory_set_dirty_flags(addr, dirty_flags); |
114 | fd4aa979 | Blue Swirl | } |
115 | e226939d | Anthony PERARD | xen_modified_memory(addr, length); |
116 | fd4aa979 | Blue Swirl | } |
117 | fd4aa979 | Blue Swirl | |
118 | 7638e0d2 | Avi Kivity | static inline void cpu_physical_memory_mask_dirty_range(ram_addr_t start, |
119 | 59abb061 | Blue Swirl | ram_addr_t length, |
120 | 7638e0d2 | Avi Kivity | int dirty_flags)
|
121 | 7638e0d2 | Avi Kivity | { |
122 | 59abb061 | Blue Swirl | ram_addr_t addr, end; |
123 | 7638e0d2 | Avi Kivity | |
124 | fd39941a | Avi Kivity | end = TARGET_PAGE_ALIGN(start + length); |
125 | fd39941a | Avi Kivity | start &= TARGET_PAGE_MASK; |
126 | fd39941a | Avi Kivity | for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
|
127 | 1720aeee | Juan Quintela | cpu_physical_memory_clear_dirty_flags(addr, dirty_flags); |
128 | 7638e0d2 | Avi Kivity | } |
129 | 7638e0d2 | Avi Kivity | } |
130 | 7638e0d2 | Avi Kivity | |
131 | 7638e0d2 | Avi Kivity | void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end,
|
132 | 7638e0d2 | Avi Kivity | int dirty_flags);
|
133 | 93632747 | Avi Kivity | |
134 | 93632747 | Avi Kivity | extern const IORangeOps memory_region_iorange_ops; |
135 | 93632747 | Avi Kivity | |
136 | 67d95c15 | Avi Kivity | #endif
|
137 | 67d95c15 | Avi Kivity | |
138 | 67d95c15 | Avi Kivity | #endif |