Merge tag 'migration-next-pull-request' of https://gitlab.com/peterx/qemu into staging
[qemu/armbru.git] / contrib / elf2dmp / addrspace.h
blob039c70c5b079c96a0a55084c941324b48fc1d42b
1 /*
2 * Copyright (c) 2018 Virtuozzo International GmbH
4 * This work is licensed under the terms of the GNU GPL, version 2 or later.
6 */
8 #ifndef ADDRSPACE_H
9 #define ADDRSPACE_H
11 #include "qemu_elf.h"
13 #define ELF2DMP_PAGE_BITS 12
14 #define ELF2DMP_PAGE_SIZE (1ULL << ELF2DMP_PAGE_BITS)
15 #define ELF2DMP_PAGE_MASK (ELF2DMP_PAGE_SIZE - 1)
16 #define ELF2DMP_PFN_MASK (~(ELF2DMP_PAGE_SIZE - 1))
18 #define INVALID_PA UINT64_MAX
20 struct pa_block {
21 uint8_t *addr;
22 uint64_t paddr;
23 uint64_t size;
26 struct pa_space {
27 size_t block_nr;
28 struct pa_block *block;
31 struct va_space {
32 uint64_t dtb;
33 struct pa_space *ps;
36 int pa_space_create(struct pa_space *ps, QEMU_Elf *qemu_elf);
37 void pa_space_destroy(struct pa_space *ps);
39 void va_space_create(struct va_space *vs, struct pa_space *ps, uint64_t dtb);
40 void va_space_set_dtb(struct va_space *vs, uint64_t dtb);
41 void *va_space_resolve(struct va_space *vs, uint64_t va);
42 int va_space_rw(struct va_space *vs, uint64_t addr,
43 void *buf, size_t size, int is_write);
45 #endif /* ADDRSPACE_H */