xref: /qemu/target/i386/hvf/x86_mmu.h (revision 727385c4)
1 /*
2  * Copyright (C) 2016 Veertu Inc,
3  * Copyright (C) 2017 Google Inc,
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef X86_MMU_H
20 #define X86_MMU_H
21 
22 #define PT_PRESENT      (1 << 0)
23 #define PT_WRITE        (1 << 1)
24 #define PT_USER         (1 << 2)
25 #define PT_WT           (1 << 3)
26 #define PT_CD           (1 << 4)
27 #define PT_ACCESSED     (1 << 5)
28 #define PT_DIRTY        (1 << 6)
29 #define PT_PS           (1 << 7)
30 #define PT_GLOBAL       (1 << 8)
31 #define PT_NX           (1llu << 63)
32 
33 /* error codes */
34 #define MMU_PAGE_PT             (1 << 0)
35 #define MMU_PAGE_WT             (1 << 1)
36 #define MMU_PAGE_US             (1 << 2)
37 #define MMU_PAGE_NX             (1 << 3)
38 
39 bool mmu_gva_to_gpa(struct CPUState *cpu, target_ulong gva, uint64_t *gpa);
40 
41 void vmx_write_mem(struct CPUState *cpu, target_ulong gva, void *data, int bytes);
42 void vmx_read_mem(struct CPUState *cpu, void *data, target_ulong gva, int bytes);
43 
44 #endif /* X86_MMU_H */
45