]>
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" |
80167a8a WC |
18 | |
19 | /* The physical and virtual address in the memory mapping are contiguous. */ | |
20 | typedef struct MemoryMapping { | |
a8170e5e | 21 | hwaddr phys_addr; |
80167a8a WC |
22 | target_ulong virt_addr; |
23 | ram_addr_t length; | |
24 | QTAILQ_ENTRY(MemoryMapping) next; | |
25 | } MemoryMapping; | |
26 | ||
27 | typedef struct MemoryMappingList { | |
28 | unsigned int num; | |
29 | MemoryMapping *last_mapping; | |
30 | QTAILQ_HEAD(, MemoryMapping) head; | |
31 | } MemoryMappingList; | |
32 | ||
5f86146f | 33 | int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env); |
5f86146f | 34 | |
80167a8a WC |
35 | /* |
36 | * add or merge the memory region [phys_addr, phys_addr + length) into the | |
37 | * memory mapping's list. The region's virtual address starts with virt_addr, | |
38 | * and is contiguous. The list is sorted by phys_addr. | |
39 | */ | |
40 | void memory_mapping_list_add_merge_sorted(MemoryMappingList *list, | |
a8170e5e AK |
41 | hwaddr phys_addr, |
42 | hwaddr virt_addr, | |
80167a8a WC |
43 | ram_addr_t length); |
44 | ||
45 | void memory_mapping_list_free(MemoryMappingList *list); | |
46 | ||
47 | void memory_mapping_list_init(MemoryMappingList *list); | |
48 | ||
c517076d WC |
49 | /* |
50 | * Return value: | |
51 | * 0: success | |
52 | * -1: failed | |
53 | * -2: unsupported | |
54 | */ | |
c517076d | 55 | int qemu_get_guest_memory_mapping(MemoryMappingList *list); |
c517076d | 56 | |
2b05ab52 WC |
57 | /* get guest's memory mapping without do paging(virtual address is 0). */ |
58 | void qemu_get_guest_simple_memory_mapping(MemoryMappingList *list); | |
59 | ||
783e9b48 WC |
60 | void memory_mapping_filter(MemoryMappingList *list, int64_t begin, |
61 | int64_t length); | |
62 | ||
80167a8a | 63 | #endif |