2
* svm.h: SVM Architecture related definitions
3
* Copyright (c) 2005, AMD Corporation.
4
* Copyright (c) 2004, Intel Corporation.
6
* This program is free software; you can redistribute it and/or modify it
7
* under the terms and conditions of the GNU General Public License,
8
* version 2, as published by the Free Software Foundation.
10
* This program is distributed in the hope it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15
* You should have received a copy of the GNU General Public License along with
16
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17
* Place - Suite 330, Boston, MA 02111-1307 USA.
21
#ifndef __ASM_X86_HVM_SVM_H__
22
#define __ASM_X86_HVM_SVM_H__
24
#include <xen/sched.h>
25
#include <asm/types.h>
27
#include <asm/processor.h>
28
#include <asm/hvm/svm/vmcb.h>
31
void svm_dump_vmcb(const char *from, struct vmcb_struct *vmcb);
33
#define SVM_REG_EAX (0)
34
#define SVM_REG_ECX (1)
35
#define SVM_REG_EDX (2)
36
#define SVM_REG_EBX (3)
37
#define SVM_REG_ESP (4)
38
#define SVM_REG_EBP (5)
39
#define SVM_REG_ESI (6)
40
#define SVM_REG_EDI (7)
41
#define SVM_REG_R8 (8)
42
#define SVM_REG_R9 (9)
43
#define SVM_REG_R10 (10)
44
#define SVM_REG_R11 (11)
45
#define SVM_REG_R12 (12)
46
#define SVM_REG_R13 (13)
47
#define SVM_REG_R14 (14)
48
#define SVM_REG_R15 (15)
50
static inline void svm_vmload(void *vmcb)
53
".byte 0x0f,0x01,0xda" /* vmload */
54
: : "a" (__pa(vmcb)) : "memory" );
57
static inline void svm_vmsave(void *vmcb)
60
".byte 0x0f,0x01,0xdb" /* vmsave */
61
: : "a" (__pa(vmcb)) : "memory" );
64
extern u32 svm_feature_flags;
66
#define SVM_FEATURE_NPT 0
67
#define SVM_FEATURE_LBRV 1
68
#define SVM_FEATURE_SVML 2
69
#define SVM_FEATURE_NRIPS 3
70
#define SVM_FEATURE_PAUSEF 10
72
#define cpu_has_svm_npt test_bit(SVM_FEATURE_NPT, &svm_feature_flags)
73
#define cpu_has_svm_lbrv test_bit(SVM_FEATURE_LBRV, &svm_feature_flags)
74
#define cpu_has_svm_svml test_bit(SVM_FEATURE_SVML, &svm_feature_flags)
75
#define cpu_has_svm_nrips test_bit(SVM_FEATURE_NRIPS, &svm_feature_flags)
76
#define cpu_has_pause_filter test_bit(SVM_FEATURE_PAUSEF, &svm_feature_flags)
78
#endif /* __ASM_X86_HVM_SVM_H__ */