Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
c801949d
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c801949d
编写于
7月 14, 2008
作者:
A
Avi Kivity
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
KVM: VMX: Unify register save/restore across 32 and 64 bit hosts
Signed-off-by:
N
Avi Kivity
<
avi@qumranet.com
>
上级
77ab6db0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
36 addition
and
54 deletion
+36
-54
arch/x86/kvm/vmx.c
arch/x86/kvm/vmx.c
+36
-54
未找到文件。
arch/x86/kvm/vmx.c
浏览文件 @
c801949d
...
...
@@ -2955,6 +2955,14 @@ static void fixup_rmode_irq(struct vcpu_vmx *vmx)
|
vmx
->
rmode
.
irq
.
vector
;
}
#ifdef CONFIG_X86_64
#define R "r"
#define Q "q"
#else
#define R "e"
#define Q "l"
#endif
static
void
vmx_vcpu_run
(
struct
kvm_vcpu
*
vcpu
,
struct
kvm_run
*
kvm_run
)
{
struct
vcpu_vmx
*
vmx
=
to_vmx
(
vcpu
);
...
...
@@ -2972,26 +2980,21 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
asm
(
/* Store host registers */
#ifdef CONFIG_X86_64
"push %%rdx; push %%rbp;"
"push %%rcx
\n\t
"
#else
"push %%edx; push %%ebp;"
"push %%ecx
\n\t
"
#endif
"push %%"
R
"dx; push %%"
R
"bp;"
"push %%"
R
"cx
\n\t
"
__ex
(
ASM_VMX_VMWRITE_RSP_RDX
)
"
\n\t
"
/* Check if vmlaunch of vmresume is needed */
"cmpl $0, %c[launched](%0)
\n\t
"
/* Load guest registers. Don't clobber flags. */
"mov %c[cr2](%0), %%"
R
"ax
\n\t
"
"mov %%"
R
"ax, %%cr2
\n\t
"
"mov %c[rax](%0), %%"
R
"ax
\n\t
"
"mov %c[rbx](%0), %%"
R
"bx
\n\t
"
"mov %c[rdx](%0), %%"
R
"dx
\n\t
"
"mov %c[rsi](%0), %%"
R
"si
\n\t
"
"mov %c[rdi](%0), %%"
R
"di
\n\t
"
"mov %c[rbp](%0), %%"
R
"bp
\n\t
"
#ifdef CONFIG_X86_64
"mov %c[cr2](%0), %%rax
\n\t
"
"mov %%rax, %%cr2
\n\t
"
"mov %c[rax](%0), %%rax
\n\t
"
"mov %c[rbx](%0), %%rbx
\n\t
"
"mov %c[rdx](%0), %%rdx
\n\t
"
"mov %c[rsi](%0), %%rsi
\n\t
"
"mov %c[rdi](%0), %%rdi
\n\t
"
"mov %c[rbp](%0), %%rbp
\n\t
"
"mov %c[r8](%0), %%r8
\n\t
"
"mov %c[r9](%0), %%r9
\n\t
"
"mov %c[r10](%0), %%r10
\n\t
"
...
...
@@ -3000,18 +3003,9 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
"mov %c[r13](%0), %%r13
\n\t
"
"mov %c[r14](%0), %%r14
\n\t
"
"mov %c[r15](%0), %%r15
\n\t
"
"mov %c[rcx](%0), %%rcx
\n\t
"
/* kills %0 (rcx) */
#else
"mov %c[cr2](%0), %%eax
\n\t
"
"mov %%eax, %%cr2
\n\t
"
"mov %c[rax](%0), %%eax
\n\t
"
"mov %c[rbx](%0), %%ebx
\n\t
"
"mov %c[rdx](%0), %%edx
\n\t
"
"mov %c[rsi](%0), %%esi
\n\t
"
"mov %c[rdi](%0), %%edi
\n\t
"
"mov %c[rbp](%0), %%ebp
\n\t
"
"mov %c[rcx](%0), %%ecx
\n\t
"
/* kills %0 (ecx) */
#endif
"mov %c[rcx](%0), %%"
R
"cx
\n\t
"
/* kills %0 (ecx) */
/* Enter guest mode */
"jne .Llaunched
\n\t
"
__ex
(
ASM_VMX_VMLAUNCH
)
"
\n\t
"
...
...
@@ -3019,15 +3013,15 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
".Llaunched: "
__ex
(
ASM_VMX_VMRESUME
)
"
\n\t
"
".Lkvm_vmx_return: "
/* Save guest registers, load host registers, keep flags */
"xchg %0, (%%"
R
"sp)
\n\t
"
"mov %%"
R
"ax, %c[rax](%0)
\n\t
"
"mov %%"
R
"bx, %c[rbx](%0)
\n\t
"
"push"
Q
" (%%"
R
"sp); pop"
Q
" %c[rcx](%0)
\n\t
"
"mov %%"
R
"dx, %c[rdx](%0)
\n\t
"
"mov %%"
R
"si, %c[rsi](%0)
\n\t
"
"mov %%"
R
"di, %c[rdi](%0)
\n\t
"
"mov %%"
R
"bp, %c[rbp](%0)
\n\t
"
#ifdef CONFIG_X86_64
"xchg %0, (%%rsp)
\n\t
"
"mov %%rax, %c[rax](%0)
\n\t
"
"mov %%rbx, %c[rbx](%0)
\n\t
"
"pushq (%%rsp); popq %c[rcx](%0)
\n\t
"
"mov %%rdx, %c[rdx](%0)
\n\t
"
"mov %%rsi, %c[rsi](%0)
\n\t
"
"mov %%rdi, %c[rdi](%0)
\n\t
"
"mov %%rbp, %c[rbp](%0)
\n\t
"
"mov %%r8, %c[r8](%0)
\n\t
"
"mov %%r9, %c[r9](%0)
\n\t
"
"mov %%r10, %c[r10](%0)
\n\t
"
...
...
@@ -3036,24 +3030,11 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
"mov %%r13, %c[r13](%0)
\n\t
"
"mov %%r14, %c[r14](%0)
\n\t
"
"mov %%r15, %c[r15](%0)
\n\t
"
"mov %%cr2, %%rax
\n\t
"
"mov %%rax, %c[cr2](%0)
\n\t
"
"pop %%rbp; pop %%rbp; pop %%rdx
\n\t
"
#else
"xchg %0, (%%esp)
\n\t
"
"mov %%eax, %c[rax](%0)
\n\t
"
"mov %%ebx, %c[rbx](%0)
\n\t
"
"pushl (%%esp); popl %c[rcx](%0)
\n\t
"
"mov %%edx, %c[rdx](%0)
\n\t
"
"mov %%esi, %c[rsi](%0)
\n\t
"
"mov %%edi, %c[rdi](%0)
\n\t
"
"mov %%ebp, %c[rbp](%0)
\n\t
"
"mov %%cr2, %%eax
\n\t
"
"mov %%eax, %c[cr2](%0)
\n\t
"
"pop %%ebp; pop %%ebp; pop %%edx
\n\t
"
#endif
"mov %%cr2, %%"
R
"ax
\n\t
"
"mov %%"
R
"ax, %c[cr2](%0)
\n\t
"
"pop %%"
R
"bp; pop %%"
R
"bp; pop %%"
R
"dx
\n\t
"
"setbe %c[fail](%0)
\n\t
"
:
:
"c"
(
vmx
),
"d"
((
unsigned
long
)
HOST_RSP
),
[
launched
]
"i"
(
offsetof
(
struct
vcpu_vmx
,
launched
)),
...
...
@@ -3077,11 +3058,9 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
#endif
[
cr2
]
"i"
(
offsetof
(
struct
vcpu_vmx
,
vcpu
.
arch
.
cr2
))
:
"cc"
,
"memory"
,
R
"bx"
,
R
"di"
,
R
"si"
#ifdef CONFIG_X86_64
,
"rbx"
,
"rdi"
,
"rsi"
,
"r8"
,
"r9"
,
"r10"
,
"r11"
,
"r12"
,
"r13"
,
"r14"
,
"r15"
#else
,
"ebx"
,
"edi"
,
"rsi"
#endif
);
...
...
@@ -3111,6 +3090,9 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
vmx_complete_interrupts
(
vmx
);
}
#undef R
#undef Q
static
void
vmx_free_vmcs
(
struct
kvm_vcpu
*
vcpu
)
{
struct
vcpu_vmx
*
vmx
=
to_vmx
(
vcpu
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录