Stackdb
Stackdb is a stackable, multi-target and -level source debugger and memory forensics library.
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
target
target_arch_x86.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2014 The University of Utah
3
*
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation; either version 2 of
7
* the License, or (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17
*/
18
19
#ifndef __TARGET_ARCH_X86_H__
20
#define __TARGET_ARCH_X86_H__
21
22
#include "config.h"
23
#include "
arch.h
"
24
#include "
arch_x86.h
"
25
#include "
arch_x86_64.h
"
26
#include "
target_api.h
"
27
28
typedef
enum
{
29
ARCH_X86_V2P_NOTPAGING
= 1 << 0,
/* Paging disabled */
30
ARCH_X86_V2P_PAE
= 1 << 1,
/* PAE */
31
/*
32
* target_arch_x86_v2p trusts the PS bit in the PTEs and just
33
* does PSE for it. Moreover, it does PSE-36 by default, because
34
* PSE-36 just uses reserved bits (16-13) in the normal PTE, and
35
* those bits *must* be zero in a normal PSE entry. Moreover, it
36
* just does PSE-40 because I assume PSE-40 uses the other 4 bits
37
* (20-17) in the PTE that were otherwise reserved (those bits also
38
* are reserved and must be zero for PSE or PSE-36). Bit 21 stays
39
* reserved and stays 0. Probably no CPU really supports PSE-40
40
* (well, it seems like AMD64 CPUs running in legacy mode *do*
41
* support this!).
42
*
43
* Anyway, to sum up, target_arch_x86_v2p trusts the PTEs *unless*
44
* NOPSE, NOPSE36, NOPSE40 are set. If you pass a 0-value cpuid_edx
45
* regval to target_arch_x86_get_flags(), it will set the NOPSE*
46
* flags! Usually this is not going to be what you want on any sane
47
* modern CPU. Better to pass a REGVALMAX value as cpuid_edx to
48
* obtain "auto-PSE" support!
49
*/
50
ARCH_X86_V2P_NOPSE
= 1 << 2,
/* No PSE */
51
ARCH_X86_V2P_NOPSE36
= 1 << 3,
/* No PSE-36 */
52
ARCH_X86_V2P_NOPSE40
= 1 << 4,
/* No PSE-40 */
53
ARCH_X86_V2P_LMA
= 1 << 5,
/* 4-level PTs */
54
ARCH_X86_V2P_PV
= 1 << 6,
/* Translating for a PV Xen VM */
55
}
arch_x86_v2p_flags_t
;
56
57
int
target_arch_x86_v2p_get_flags
(
struct
target
*
target
,
REGVAL
cr0,
REGVAL
cr4,
58
REGVAL
msr_efer,
REGVAL
cpuid_edx,
59
arch_x86_v2p_flags_t
*flags);
60
int
target_arch_x86_v2p
(
struct
target
*
target
,
ADDR
pgd,
ADDR
virt,
61
arch_x86_v2p_flags_t
flags,
ADDR
*phys);
62
int
target_arch_x86_v2p_flags_snprintf
(
struct
target
*
target
,
63
arch_x86_v2p_flags_t
flags,
64
char
*
buf
,
unsigned
int
bufsiz
);
65
66
#endif
/* __TARGET_ARCH_X86_H__ */
arch_x86_64.h
ARCH_X86_V2P_NOPSE36
Definition:
target_arch_x86.h:51
target_arch_x86_v2p_get_flags
int target_arch_x86_v2p_get_flags(struct target *target, REGVAL cr0, REGVAL cr4, REGVAL msr_efer, REGVAL cpuid_edx, arch_x86_v2p_flags_t *flags)
Definition:
target_arch_x86.c:42
ARCH_X86_V2P_NOPSE40
Definition:
target_arch_x86.h:52
value::bufsiz
int bufsiz
Definition:
target_api.h:3297
arch_x86_v2p_flags_t
arch_x86_v2p_flags_t
Definition:
target_arch_x86.h:28
ARCH_X86_V2P_NOTPAGING
Definition:
target_arch_x86.h:29
arch_x86.h
value::buf
char * buf
Definition:
target_api.h:3298
ARCH_X86_V2P_PV
Definition:
target_arch_x86.h:54
ARCH_X86_V2P_PAE
Definition:
target_arch_x86.h:30
target_arch_x86_v2p
int target_arch_x86_v2p(struct target *target, ADDR pgd, ADDR virt, arch_x86_v2p_flags_t flags, ADDR *phys)
Definition:
target_arch_x86.c:87
target_arch_x86_v2p_flags_snprintf
int target_arch_x86_v2p_flags_snprintf(struct target *target, arch_x86_v2p_flags_t flags, char *buf, unsigned int bufsiz)
Definition:
target_arch_x86.c:350
REGVAL
uint32_t REGVAL
Definition:
common.h:66
ARCH_X86_V2P_LMA
Definition:
target_arch_x86.h:53
ARCH_X86_V2P_NOPSE
Definition:
target_arch_x86.h:50
ADDR
uint32_t ADDR
Definition:
common.h:64
arch.h
target
Definition:
target_api.h:2460
target_api.h
Generated on Thu Jul 27 2017 20:47:31 for Stackdb by
1.8.8