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