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 "qemu/typedefs.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 QTAILQ_ENTRY(GuestPhysBlock) next;
31} GuestPhysBlock;
32
33
34typedef struct GuestPhysBlockList {
35 unsigned num;
36 QTAILQ_HEAD(GuestPhysBlockHead, GuestPhysBlock) head;
37} GuestPhysBlockList;
38
39
40typedef struct MemoryMapping {
41 hwaddr phys_addr;
42 target_ulong virt_addr;
43 ram_addr_t length;
44 QTAILQ_ENTRY(MemoryMapping) next;
45} MemoryMapping;
46
47struct MemoryMappingList {
48 unsigned int num;
49 MemoryMapping *last_mapping;
50 QTAILQ_HEAD(, MemoryMapping) head;
51};
52
53
54
55
56
57
58void memory_mapping_list_add_merge_sorted(MemoryMappingList *list,
59 hwaddr phys_addr,
60 hwaddr virt_addr,
61 ram_addr_t length);
62
63void memory_mapping_list_free(MemoryMappingList *list);
64
65void memory_mapping_list_init(MemoryMappingList *list);
66
67void guest_phys_blocks_free(GuestPhysBlockList *list);
68void guest_phys_blocks_init(GuestPhysBlockList *list);
69void guest_phys_blocks_append(GuestPhysBlockList *list);
70
71void qemu_get_guest_memory_mapping(MemoryMappingList *list,
72 const GuestPhysBlockList *guest_phys_blocks,
73 Error **errp);
74
75
76void qemu_get_guest_simple_memory_mapping(MemoryMappingList *list,
77 const GuestPhysBlockList *guest_phys_blocks);
78
79void memory_mapping_filter(MemoryMappingList *list, int64_t begin,
80 int64_t length);
81
82#endif
83