Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
63b1ad24
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
63b1ad24
编写于
5月 31, 2007
作者:
A
Avi Kivity
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
KVM: MMU: Fold fix_read_pf() into set_pte_common()
Signed-off-by:
N
Avi Kivity
<
avi@qumranet.com
>
上级
6598c8b2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
23 addition
and
28 deletion
+23
-28
drivers/kvm/mmu.c
drivers/kvm/mmu.c
+0
-17
drivers/kvm/paging_tmpl.h
drivers/kvm/paging_tmpl.h
+23
-11
未找到文件。
drivers/kvm/mmu.c
浏览文件 @
63b1ad24
...
...
@@ -972,23 +972,6 @@ static void inject_page_fault(struct kvm_vcpu *vcpu,
kvm_arch_ops
->
inject_page_fault
(
vcpu
,
addr
,
err_code
);
}
static
inline
int
fix_read_pf
(
u64
*
shadow_ent
)
{
if
((
*
shadow_ent
&
PT_SHADOW_USER_MASK
)
&&
!
(
*
shadow_ent
&
PT_USER_MASK
))
{
/*
* If supervisor write protect is disabled, we shadow kernel
* pages as user pages so we can trap the write access.
*/
*
shadow_ent
|=
PT_USER_MASK
;
*
shadow_ent
&=
~
PT_WRITABLE_MASK
;
return
1
;
}
return
0
;
}
static
void
paging_free
(
struct
kvm_vcpu
*
vcpu
)
{
nonpaging_free
(
vcpu
);
...
...
drivers/kvm/paging_tmpl.h
浏览文件 @
63b1ad24
...
...
@@ -197,6 +197,7 @@ static void FNAME(set_pte_common)(struct kvm_vcpu *vcpu,
gpa_t
gaddr
,
pt_element_t
*
gpte
,
u64
access_bits
,
int
write_fault
,
gfn_t
gfn
)
{
hpa_t
paddr
;
...
...
@@ -219,6 +220,17 @@ static void FNAME(set_pte_common)(struct kvm_vcpu *vcpu,
*
shadow_pte
|=
paddr
;
if
(
!
write_fault
&&
(
*
shadow_pte
&
PT_SHADOW_USER_MASK
)
&&
!
(
*
shadow_pte
&
PT_USER_MASK
))
{
/*
* If supervisor write protect is disabled, we shadow kernel
* pages as user pages so we can trap the write access.
*/
*
shadow_pte
|=
PT_USER_MASK
;
*
shadow_pte
&=
~
PT_WRITABLE_MASK
;
access_bits
&=
~
PT_WRITABLE_MASK
;
}
if
(
access_bits
&
PT_WRITABLE_MASK
)
{
struct
kvm_mmu_page
*
shadow
;
...
...
@@ -242,13 +254,14 @@ static void FNAME(set_pte_common)(struct kvm_vcpu *vcpu,
}
static
void
FNAME
(
set_pte
)(
struct
kvm_vcpu
*
vcpu
,
pt_element_t
*
gpte
,
u64
*
shadow_pte
,
u64
access_bits
,
gfn_t
gfn
)
u64
*
shadow_pte
,
u64
access_bits
,
int
write_fault
,
gfn_t
gfn
)
{
ASSERT
(
*
shadow_pte
==
0
);
access_bits
&=
*
gpte
;
*
shadow_pte
=
(
*
gpte
&
PT_PTE_COPY_MASK
);
FNAME
(
set_pte_common
)(
vcpu
,
shadow_pte
,
*
gpte
&
PT_BASE_ADDR_MASK
,
gpte
,
access_bits
,
gfn
);
gpte
,
access_bits
,
write_fault
,
gfn
);
}
static
void
FNAME
(
update_pte
)(
struct
kvm_vcpu
*
vcpu
,
struct
kvm_mmu_page
*
page
,
...
...
@@ -262,12 +275,13 @@ static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *page,
if
(
~
gpte
&
(
PT_PRESENT_MASK
|
PT_ACCESSED_MASK
))
return
;
pgprintk
(
"%s: gpte %llx spte %p
\n
"
,
__FUNCTION__
,
(
u64
)
gpte
,
spte
);
FNAME
(
set_pte
)(
vcpu
,
&
gpte
,
spte
,
PT_USER_MASK
|
PT_WRITABLE_MASK
,
FNAME
(
set_pte
)(
vcpu
,
&
gpte
,
spte
,
PT_USER_MASK
|
PT_WRITABLE_MASK
,
0
,
(
gpte
&
PT_BASE_ADDR_MASK
)
>>
PAGE_SHIFT
);
}
static
void
FNAME
(
set_pde
)(
struct
kvm_vcpu
*
vcpu
,
pt_element_t
*
gpde
,
u64
*
shadow_pte
,
u64
access_bits
,
gfn_t
gfn
)
u64
*
shadow_pte
,
u64
access_bits
,
int
write_fault
,
gfn_t
gfn
)
{
gpa_t
gaddr
;
...
...
@@ -279,14 +293,14 @@ static void FNAME(set_pde)(struct kvm_vcpu *vcpu, pt_element_t *gpde,
(
32
-
PT32_DIR_PSE36_SHIFT
);
*
shadow_pte
=
*
gpde
&
PT_PTE_COPY_MASK
;
FNAME
(
set_pte_common
)(
vcpu
,
shadow_pte
,
gaddr
,
gpde
,
access_bits
,
gfn
);
gpde
,
access_bits
,
write_fault
,
gfn
);
}
/*
* Fetch a shadow pte for a specific level in the paging hierarchy.
*/
static
u64
*
FNAME
(
fetch
)(
struct
kvm_vcpu
*
vcpu
,
gva_t
addr
,
struct
guest_walker
*
walker
)
struct
guest_walker
*
walker
,
int
write_fault
)
{
hpa_t
shadow_addr
;
int
level
;
...
...
@@ -351,12 +365,12 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
if
(
prev_shadow_ent
)
*
prev_shadow_ent
|=
PT_SHADOW_PS_MARK
;
FNAME
(
set_pde
)(
vcpu
,
guest_ent
,
shadow_ent
,
walker
->
inherited_ar
,
walker
->
gfn
);
walker
->
inherited_ar
,
w
rite_fault
,
w
alker
->
gfn
);
}
else
{
ASSERT
(
walker
->
level
==
PT_PAGE_TABLE_LEVEL
);
FNAME
(
set_pte
)(
vcpu
,
guest_ent
,
shadow_ent
,
walker
->
inherited_ar
,
walker
->
gfn
);
w
rite_fault
,
w
alker
->
gfn
);
}
return
shadow_ent
;
}
...
...
@@ -489,7 +503,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
return
0
;
}
shadow_pte
=
FNAME
(
fetch
)(
vcpu
,
addr
,
&
walker
);
shadow_pte
=
FNAME
(
fetch
)(
vcpu
,
addr
,
&
walker
,
write_fault
);
pgprintk
(
"%s: shadow pte %p %llx
\n
"
,
__FUNCTION__
,
shadow_pte
,
*
shadow_pte
);
...
...
@@ -499,8 +513,6 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
if
(
write_fault
)
fixed
=
FNAME
(
fix_write_pf
)(
vcpu
,
shadow_pte
,
&
walker
,
addr
,
user_fault
,
&
write_pt
);
else
fixed
=
fix_read_pf
(
shadow_pte
);
pgprintk
(
"%s: updated shadow pte %p %llx
\n
"
,
__FUNCTION__
,
shadow_pte
,
*
shadow_pte
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录