Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
ef0197e8
Commit
ef0197e8
authored
May 30, 2007
by
Avi Kivity
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
KVM: MMU: Simplify fetch() a little bit
Signed-off-by:
Avi Kivity
<
avi@qumranet.com
>
parent
d3d25b04
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
drivers/kvm/paging_tmpl.h
drivers/kvm/paging_tmpl.h
+17
-17
No files found.
drivers/kvm/paging_tmpl.h
View file @
ef0197e8
...
@@ -241,6 +241,7 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
...
@@ -241,6 +241,7 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
{
{
hpa_t
shadow_addr
;
hpa_t
shadow_addr
;
int
level
;
int
level
;
u64
*
shadow_ent
;
u64
*
prev_shadow_ent
=
NULL
;
u64
*
prev_shadow_ent
=
NULL
;
pt_element_t
*
guest_ent
=
walker
->
ptep
;
pt_element_t
*
guest_ent
=
walker
->
ptep
;
...
@@ -257,13 +258,13 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
...
@@ -257,13 +258,13 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
for
(;
;
level
--
)
{
for
(;
;
level
--
)
{
u32
index
=
SHADOW_PT_INDEX
(
addr
,
level
);
u32
index
=
SHADOW_PT_INDEX
(
addr
,
level
);
u64
*
shadow_ent
=
((
u64
*
)
__va
(
shadow_addr
))
+
index
;
struct
kvm_mmu_page
*
shadow_page
;
struct
kvm_mmu_page
*
shadow_page
;
u64
shadow_pte
;
u64
shadow_pte
;
int
metaphysical
;
int
metaphysical
;
gfn_t
table_gfn
;
gfn_t
table_gfn
;
unsigned
hugepage_access
=
0
;
unsigned
hugepage_access
=
0
;
shadow_ent
=
((
u64
*
)
__va
(
shadow_addr
))
+
index
;
if
(
is_present_pte
(
*
shadow_ent
)
||
is_io_pte
(
*
shadow_ent
))
{
if
(
is_present_pte
(
*
shadow_ent
)
||
is_io_pte
(
*
shadow_ent
))
{
if
(
level
==
PT_PAGE_TABLE_LEVEL
)
if
(
level
==
PT_PAGE_TABLE_LEVEL
)
return
shadow_ent
;
return
shadow_ent
;
...
@@ -272,22 +273,8 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
...
@@ -272,22 +273,8 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
continue
;
continue
;
}
}
if
(
level
==
PT_PAGE_TABLE_LEVEL
)
{
if
(
level
==
PT_PAGE_TABLE_LEVEL
)
break
;
if
(
walker
->
level
==
PT_DIRECTORY_LEVEL
)
{
if
(
prev_shadow_ent
)
*
prev_shadow_ent
|=
PT_SHADOW_PS_MARK
;
FNAME
(
set_pde
)(
vcpu
,
*
guest_ent
,
shadow_ent
,
walker
->
inherited_ar
,
walker
->
gfn
);
}
else
{
ASSERT
(
walker
->
level
==
PT_PAGE_TABLE_LEVEL
);
FNAME
(
set_pte
)(
vcpu
,
*
guest_ent
,
shadow_ent
,
walker
->
inherited_ar
,
walker
->
gfn
);
}
return
shadow_ent
;
}
if
(
level
-
1
==
PT_PAGE_TABLE_LEVEL
if
(
level
-
1
==
PT_PAGE_TABLE_LEVEL
&&
walker
->
level
==
PT_DIRECTORY_LEVEL
)
{
&&
walker
->
level
==
PT_DIRECTORY_LEVEL
)
{
...
@@ -310,6 +297,19 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
...
@@ -310,6 +297,19 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
*
shadow_ent
=
shadow_pte
;
*
shadow_ent
=
shadow_pte
;
prev_shadow_ent
=
shadow_ent
;
prev_shadow_ent
=
shadow_ent
;
}
}
if
(
walker
->
level
==
PT_DIRECTORY_LEVEL
)
{
if
(
prev_shadow_ent
)
*
prev_shadow_ent
|=
PT_SHADOW_PS_MARK
;
FNAME
(
set_pde
)(
vcpu
,
*
guest_ent
,
shadow_ent
,
walker
->
inherited_ar
,
walker
->
gfn
);
}
else
{
ASSERT
(
walker
->
level
==
PT_PAGE_TABLE_LEVEL
);
FNAME
(
set_pte
)(
vcpu
,
*
guest_ent
,
shadow_ent
,
walker
->
inherited_ar
,
walker
->
gfn
);
}
return
shadow_ent
;
}
}
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment