1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef MEMORY_MAPPING_H
15#define MEMORY_MAPPING_H
16
17#include "qemu/queue.h"
18#include "exec/cpu-common.h"
19
20typedef struct GuestPhysBlock {
21
22 hwaddr target_start;
23
24
25 hwaddr target_end;
26
27
28 uint8_t *host_addr;
29
30
31 MemoryRegion *mr;
32
33 QTAILQ_ENTRY(GuestPhysBlock) next;
34} GuestPhysBlock;
35
36
37typedef struct GuestPhysBlockList {
38 unsigned num;
39 QTAILQ_HEAD(, GuestPhysBlock) head;
40} GuestPhysBlockList;
41
42
43typedef struct MemoryMapping {
44 hwaddr phys_addr;
45 vaddr virt_addr;
46 ram_addr_t length;
47 QTAILQ_ENTRY(MemoryMapping) next;
48} MemoryMapping;
49
50struct MemoryMappingList {
51 unsigned int num;
52 MemoryMapping *last_mapping;
53 QTAILQ_HEAD(, MemoryMapping) head;
54};
55
56
57
58
59
60
61void memory_mapping_list_add_merge_sorted(MemoryMappingList *list,
62 hwaddr phys_addr,
63 hwaddr virt_addr,
64 ram_addr_t length);
65
66void memory_mapping_list_free(MemoryMappingList *list);
67
68void memory_mapping_list_init(MemoryMappingList *list);
69
70void guest_phys_blocks_free(GuestPhysBlockList *list);
71void guest_phys_blocks_init(GuestPhysBlockList *list);
72void guest_phys_blocks_append(GuestPhysBlockList *list);
73
74void qemu_get_guest_memory_mapping(MemoryMappingList *list,
75 const GuestPhysBlockList *guest_phys_blocks,
76 Error **errp);
77
78
79void qemu_get_guest_simple_memory_mapping(MemoryMappingList *list,
80 const GuestPhysBlockList *guest_phys_blocks);
81
82void memory_mapping_filter(MemoryMappingList *list, int64_t begin,
83 int64_t length);
84
85#endif
86