]>
Commit | Line | Data |
---|---|---|
80167a8a WC |
1 | /* |
2 | * QEMU memory mapping | |
3 | * | |
4 | * Copyright Fujitsu, Corp. 2011, 2012 | |
5 | * | |
6 | * Authors: | |
7 | * Wen Congyang <wency@cn.fujitsu.com> | |
8 | * | |
fc0608ac SW |
9 | * This work is licensed under the terms of the GNU GPL, version 2 or later. |
10 | * See the COPYING file in the top-level directory. | |
80167a8a WC |
11 | * |
12 | */ | |
13 | ||
14 | #ifndef MEMORY_MAPPING_H | |
15 | #define MEMORY_MAPPING_H | |
16 | ||
1de7afc9 | 17 | #include "qemu/queue.h" |
6d4d3ae7 | 18 | #include "qemu/typedefs.h" |
80167a8a WC |
19 | |
20 | /* The physical and virtual address in the memory mapping are contiguous. */ | |
21 | typedef struct MemoryMapping { | |
a8170e5e | 22 | hwaddr phys_addr; |
80167a8a WC |
23 | target_ulong virt_addr; |
24 | ram_addr_t length; | |
25 | QTAILQ_ENTRY(MemoryMapping) next; | |
26 | } MemoryMapping; | |
27 | ||
6d4d3ae7 | 28 | struct MemoryMappingList { |
80167a8a WC |
29 | unsigned int num; |
30 | MemoryMapping *last_mapping; | |
31 | QTAILQ_HEAD(, MemoryMapping) head; | |
6d4d3ae7 | 32 | }; |
80167a8a WC |
33 | |
34 | /* | |
35 | * add or merge the memory region [phys_addr, phys_addr + length) into the | |
36 | * memory mapping's list. The region's virtual address starts with virt_addr, | |
37 | * and is contiguous. The list is sorted by phys_addr. | |
38 | */ | |
39 | void memory_mapping_list_add_merge_sorted(MemoryMappingList *list, | |
a8170e5e AK |
40 | hwaddr phys_addr, |
41 | hwaddr virt_addr, | |
80167a8a WC |
42 | ram_addr_t length); |
43 | ||
44 | void memory_mapping_list_free(MemoryMappingList *list); | |
45 | ||
46 | void memory_mapping_list_init(MemoryMappingList *list); | |
47 | ||
11ed09cf | 48 | void qemu_get_guest_memory_mapping(MemoryMappingList *list, Error **errp); |
c517076d | 49 | |
2b05ab52 WC |
50 | /* get guest's memory mapping without do paging(virtual address is 0). */ |
51 | void qemu_get_guest_simple_memory_mapping(MemoryMappingList *list); | |
52 | ||
783e9b48 WC |
53 | void memory_mapping_filter(MemoryMappingList *list, int64_t begin, |
54 | int64_t length); | |
55 | ||
80167a8a | 56 | #endif |