~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to xen/include/asm-x86/hvm/svm/svm.h

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * svm.h: SVM Architecture related definitions
 
3
 * Copyright (c) 2005, AMD Corporation.
 
4
 * Copyright (c) 2004, Intel Corporation.
 
5
 *
 
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.
 
9
 *
 
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
 
13
 * more details.
 
14
 *
 
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.
 
18
 *
 
19
 */
 
20
 
 
21
#ifndef __ASM_X86_HVM_SVM_H__
 
22
#define __ASM_X86_HVM_SVM_H__
 
23
 
 
24
#include <xen/sched.h>
 
25
#include <asm/types.h>
 
26
#include <asm/regs.h>
 
27
#include <asm/processor.h>
 
28
#include <asm/hvm/svm/vmcb.h>
 
29
#include <asm/i387.h>
 
30
 
 
31
void svm_dump_vmcb(const char *from, struct vmcb_struct *vmcb);
 
32
 
 
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)
 
49
 
 
50
static inline void svm_vmload(void *vmcb)
 
51
{
 
52
    asm volatile (
 
53
        ".byte 0x0f,0x01,0xda" /* vmload */
 
54
        : : "a" (__pa(vmcb)) : "memory" );
 
55
}
 
56
 
 
57
static inline void svm_vmsave(void *vmcb)
 
58
{
 
59
    asm volatile (
 
60
        ".byte 0x0f,0x01,0xdb" /* vmsave */
 
61
        : : "a" (__pa(vmcb)) : "memory" );
 
62
}
 
63
 
 
64
extern u32 svm_feature_flags;
 
65
 
 
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
 
71
 
 
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)
 
77
 
 
78
#endif /* __ASM_X86_HVM_SVM_H__ */