Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gsplhtlxg
clone-Linux
提交
270fd9b9
C
clone-Linux
项目概览
gsplhtlxg
/
clone-Linux
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
clone-Linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
270fd9b9
编写于
2月 19, 2007
作者:
A
Avi Kivity
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
KVM: Wire up hypercall handlers to a central arch-independent location
Signed-off-by:
N
Avi Kivity
<
avi@qumranet.com
>
上级
02e235bc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
40 addition
and
18 deletion
+40
-18
drivers/kvm/kvm.h
drivers/kvm/kvm.h
+2
-0
drivers/kvm/kvm_main.c
drivers/kvm/kvm_main.c
+36
-0
drivers/kvm/svm.c
drivers/kvm/svm.c
+1
-9
drivers/kvm/vmx.c
drivers/kvm/vmx.c
+1
-9
未找到文件。
drivers/kvm/kvm.h
浏览文件 @
270fd9b9
...
...
@@ -482,6 +482,8 @@ void kvm_mmu_post_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes);
int
kvm_mmu_unprotect_page_virt
(
struct
kvm_vcpu
*
vcpu
,
gva_t
gva
);
void
kvm_mmu_free_some_pages
(
struct
kvm_vcpu
*
vcpu
);
int
kvm_hypercall
(
struct
kvm_vcpu
*
vcpu
,
struct
kvm_run
*
run
);
static
inline
int
kvm_mmu_page_fault
(
struct
kvm_vcpu
*
vcpu
,
gva_t
gva
,
u32
error_code
)
{
...
...
drivers/kvm/kvm_main.c
浏览文件 @
270fd9b9
...
...
@@ -1138,6 +1138,42 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
}
EXPORT_SYMBOL_GPL
(
emulate_instruction
);
int
kvm_hypercall
(
struct
kvm_vcpu
*
vcpu
,
struct
kvm_run
*
run
)
{
unsigned
long
nr
,
a0
,
a1
,
a2
,
a3
,
a4
,
a5
,
ret
;
kvm_arch_ops
->
decache_regs
(
vcpu
);
ret
=
-
KVM_EINVAL
;
#ifdef CONFIG_X86_64
if
(
is_long_mode
(
vcpu
))
{
nr
=
vcpu
->
regs
[
VCPU_REGS_RAX
];
a0
=
vcpu
->
regs
[
VCPU_REGS_RDI
];
a1
=
vcpu
->
regs
[
VCPU_REGS_RSI
];
a2
=
vcpu
->
regs
[
VCPU_REGS_RDX
];
a3
=
vcpu
->
regs
[
VCPU_REGS_RCX
];
a4
=
vcpu
->
regs
[
VCPU_REGS_R8
];
a5
=
vcpu
->
regs
[
VCPU_REGS_R9
];
}
else
#endif
{
nr
=
vcpu
->
regs
[
VCPU_REGS_RBX
]
&
-
1u
;
a0
=
vcpu
->
regs
[
VCPU_REGS_RAX
]
&
-
1u
;
a1
=
vcpu
->
regs
[
VCPU_REGS_RCX
]
&
-
1u
;
a2
=
vcpu
->
regs
[
VCPU_REGS_RDX
]
&
-
1u
;
a3
=
vcpu
->
regs
[
VCPU_REGS_RSI
]
&
-
1u
;
a4
=
vcpu
->
regs
[
VCPU_REGS_RDI
]
&
-
1u
;
a5
=
vcpu
->
regs
[
VCPU_REGS_RBP
]
&
-
1u
;
}
switch
(
nr
)
{
default:
;
}
vcpu
->
regs
[
VCPU_REGS_RAX
]
=
ret
;
kvm_arch_ops
->
cache_regs
(
vcpu
);
return
1
;
}
EXPORT_SYMBOL_GPL
(
kvm_hypercall
);
static
u64
mk_cr_64
(
u64
curr_cr
,
u32
new_val
)
{
return
(
curr_cr
&
~
((
1ULL
<<
32
)
-
1
))
|
new_val
;
...
...
drivers/kvm/svm.c
浏览文件 @
270fd9b9
...
...
@@ -1078,16 +1078,8 @@ static int halt_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
static
int
vmmcall_interception
(
struct
kvm_vcpu
*
vcpu
,
struct
kvm_run
*
kvm_run
)
{
printk
(
KERN_DEBUG
"got vmmcall at RIP %08llx
\n
"
,
vcpu
->
svm
->
vmcb
->
save
.
rip
);
printk
(
KERN_DEBUG
"vmmcall params: %08llx, %08lx, %08lx, %08lx
\n
"
,
vcpu
->
svm
->
vmcb
->
save
.
rax
,
vcpu
->
regs
[
VCPU_REGS_RCX
],
vcpu
->
regs
[
VCPU_REGS_RDX
],
vcpu
->
regs
[
VCPU_REGS_RBP
]);
vcpu
->
svm
->
vmcb
->
save
.
rax
=
0
;
vcpu
->
svm
->
vmcb
->
save
.
rip
+=
3
;
return
1
;
return
kvm_hypercall
(
vcpu
,
kvm_run
)
;
}
static
int
invalid_op_interception
(
struct
kvm_vcpu
*
vcpu
,
struct
kvm_run
*
kvm_run
)
...
...
drivers/kvm/vmx.c
浏览文件 @
270fd9b9
...
...
@@ -1659,16 +1659,8 @@ static int handle_halt(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
static
int
handle_vmcall
(
struct
kvm_vcpu
*
vcpu
,
struct
kvm_run
*
kvm_run
)
{
kvm_run
->
exit_reason
=
KVM_EXIT_DEBUG
;
printk
(
KERN_DEBUG
"got vmcall at RIP %08lx
\n
"
,
vmcs_readl
(
GUEST_RIP
));
printk
(
KERN_DEBUG
"vmcall params: %08lx, %08lx, %08lx, %08lx
\n
"
,
vcpu
->
regs
[
VCPU_REGS_RAX
],
vcpu
->
regs
[
VCPU_REGS_RCX
],
vcpu
->
regs
[
VCPU_REGS_RDX
],
vcpu
->
regs
[
VCPU_REGS_RBP
]);
vcpu
->
regs
[
VCPU_REGS_RAX
]
=
0
;
vmcs_writel
(
GUEST_RIP
,
vmcs_readl
(
GUEST_RIP
)
+
3
);
return
1
;
return
kvm_hypercall
(
vcpu
,
kvm_run
)
;
}
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录