xref: /qemu/target/i386/hvf/x86_mmu.h (revision 9277d81f)
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 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 #ifndef __X86_MMU_H__
19 #define __X86_MMU_H__
20 
21 #define PT_PRESENT      (1 << 0)
22 #define PT_WRITE        (1 << 1)
23 #define PT_USER         (1 << 2)
24 #define PT_WT           (1 << 3)
25 #define PT_CD           (1 << 4)
26 #define PT_ACCESSED     (1 << 5)
27 #define PT_DIRTY        (1 << 6)
28 #define PT_PS           (1 << 7)
29 #define PT_GLOBAL       (1 << 8)
30 #define PT_NX           (1llu << 63)
31 
32 /* error codes */
33 #define MMU_PAGE_PT             (1 << 0)
34 #define MMU_PAGE_WT             (1 << 1)
35 #define MMU_PAGE_US             (1 << 2)
36 #define MMU_PAGE_NX             (1 << 3)
37 
38 bool mmu_gva_to_gpa(struct CPUState *cpu, target_ulong gva, uint64_t *gpa);
39 
40 void vmx_write_mem(struct CPUState *cpu, target_ulong gva, void *data, int bytes);
41 void vmx_read_mem(struct CPUState *cpu, void *data, target_ulong gva, int bytes);
42 
43 #endif /* __X86_MMU_H__ */
44