Open 4.2 development tree
[qemu/ar7.git] / contrib / elf2dmp / qemu_elf.h
blobb2f0d9cbc9b7adb91ba77d4bf19530cf36243b72
1 /*
2 * Copyright (c) 2018 Virtuozzo International GmbH
4 * This work is licensed under the terms of the GNU GPL, version 2 or later.
5 */
7 #ifndef ELF2DMP_QEMU_ELF_H
8 #define ELF2DMP_QEMU_ELF_H
10 #include "elf.h"
12 typedef struct QEMUCPUSegment {
13 uint32_t selector;
14 uint32_t limit;
15 uint32_t flags;
16 uint32_t pad;
17 uint64_t base;
18 } QEMUCPUSegment;
20 typedef struct QEMUCPUState {
21 uint32_t version;
22 uint32_t size;
23 uint64_t rax, rbx, rcx, rdx, rsi, rdi, rsp, rbp;
24 uint64_t r8, r9, r10, r11, r12, r13, r14, r15;
25 uint64_t rip, rflags;
26 QEMUCPUSegment cs, ds, es, fs, gs, ss;
27 QEMUCPUSegment ldt, tr, gdt, idt;
28 uint64_t cr[5];
29 uint64_t kernel_gs_base;
30 } QEMUCPUState;
32 int is_system(QEMUCPUState *s);
34 typedef struct QEMU_Elf {
35 GMappedFile *gmf;
36 size_t size;
37 void *map;
38 QEMUCPUState **state;
39 size_t state_nr;
40 int has_kernel_gs_base;
41 } QEMU_Elf;
43 int QEMU_Elf_init(QEMU_Elf *qe, const char *filename);
44 void QEMU_Elf_exit(QEMU_Elf *qe);
46 Elf64_Phdr *elf64_getphdr(void *map);
47 Elf64_Half elf_getphdrnum(void *map);
49 #endif /* ELF2DMP_QEMU_ELF_H */