]>
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 <avi@redhat.com> | |
8 | * | |
9 | * This work is licensed under the terms of the GNU GPL, version 2. See | |
10 | * the COPYING file in the top-level directory. | |
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 | ||
34 | int cpu_register_io_memory(CPUReadMemoryFunc * const *mem_read, | |
35 | CPUWriteMemoryFunc * const *mem_write, | |
be675c97 | 36 | void *opaque); |
67d95c15 AK |
37 | void cpu_unregister_io_memory(int table_address); |
38 | ||
dd81124b AK |
39 | struct MemoryRegionSection; |
40 | void cpu_register_physical_memory_log(struct MemoryRegionSection *section, | |
41 | bool readable, bool readonly); | |
67d95c15 AK |
42 | |
43 | void qemu_register_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size); | |
44 | void qemu_unregister_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size); | |
45 | ||
8f77558f AK |
46 | int cpu_physical_memory_set_dirty_tracking(int enable); |
47 | ||
7638e0d2 AK |
48 | #define VGA_DIRTY_FLAG 0x01 |
49 | #define CODE_DIRTY_FLAG 0x02 | |
50 | #define MIGRATION_DIRTY_FLAG 0x08 | |
51 | ||
52 | /* read dirty bit (return 0 or 1) */ | |
53 | static inline int cpu_physical_memory_is_dirty(ram_addr_t addr) | |
54 | { | |
55 | return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] == 0xff; | |
56 | } | |
57 | ||
58 | static inline int cpu_physical_memory_get_dirty_flags(ram_addr_t addr) | |
59 | { | |
60 | return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS]; | |
61 | } | |
62 | ||
63 | static inline int cpu_physical_memory_get_dirty(ram_addr_t addr, | |
64 | int dirty_flags) | |
65 | { | |
66 | return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] & dirty_flags; | |
67 | } | |
68 | ||
69 | static inline void cpu_physical_memory_set_dirty(ram_addr_t addr) | |
70 | { | |
71 | ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] = 0xff; | |
72 | } | |
73 | ||
74 | static inline int cpu_physical_memory_set_dirty_flags(ram_addr_t addr, | |
75 | int dirty_flags) | |
76 | { | |
77 | return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] |= dirty_flags; | |
78 | } | |
79 | ||
80 | static inline void cpu_physical_memory_mask_dirty_range(ram_addr_t start, | |
81 | int length, | |
82 | int dirty_flags) | |
83 | { | |
84 | int i, mask, len; | |
85 | uint8_t *p; | |
86 | ||
87 | len = length >> TARGET_PAGE_BITS; | |
88 | mask = ~dirty_flags; | |
89 | p = ram_list.phys_dirty + (start >> TARGET_PAGE_BITS); | |
90 | for (i = 0; i < len; i++) { | |
91 | p[i] &= mask; | |
92 | } | |
93 | } | |
94 | ||
95 | void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end, | |
96 | int dirty_flags); | |
67d95c15 AK |
97 | #endif |
98 | ||
99 | #endif |