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
48bb5d3c
Commit
48bb5d3c
authored
Aug 18, 2010
by
Avi Kivity
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
KVM: x86 emulator: implement RDTSC (opcode 0F 31)
Signed-off-by:
Avi Kivity
<
avi@redhat.com
>
parent
7077aec0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
arch/x86/kvm/emulate.c
arch/x86/kvm/emulate.c
+18
-1
No files found.
arch/x86/kvm/emulate.c
View file @
48bb5d3c
...
...
@@ -2279,6 +2279,22 @@ static int em_imul_3op(struct x86_emulate_ctxt *ctxt)
return
em_imul
(
ctxt
);
}
static
int
em_rdtsc
(
struct
x86_emulate_ctxt
*
ctxt
)
{
unsigned
cpl
=
ctxt
->
ops
->
cpl
(
ctxt
->
vcpu
);
struct
decode_cache
*
c
=
&
ctxt
->
decode
;
u64
tsc
=
0
;
if
(
cpl
>
0
&&
(
ctxt
->
ops
->
get_cr
(
4
,
ctxt
->
vcpu
)
&
X86_CR4_TSD
))
{
emulate_gp
(
ctxt
,
0
);
return
X86EMUL_PROPAGATE_FAULT
;
}
ctxt
->
ops
->
get_msr
(
ctxt
->
vcpu
,
MSR_IA32_TSC
,
&
tsc
);
c
->
regs
[
VCPU_REGS_RAX
]
=
(
u32
)
tsc
;
c
->
regs
[
VCPU_REGS_RDX
]
=
tsc
>>
32
;
return
X86EMUL_CONTINUE
;
}
#define D(_y) { .flags = (_y) }
#define N D(0)
#define G(_f, _g) { .flags = ((_f) | Group), .u.group = (_g) }
...
...
@@ -2469,7 +2485,8 @@ static struct opcode twobyte_table[256] = {
N
,
N
,
N
,
N
,
N
,
N
,
N
,
N
,
N
,
N
,
N
,
N
,
/* 0x30 - 0x3F */
D
(
ImplicitOps
|
Priv
),
N
,
D
(
ImplicitOps
|
Priv
),
N
,
D
(
ImplicitOps
|
Priv
),
I
(
ImplicitOps
,
em_rdtsc
),
D
(
ImplicitOps
|
Priv
),
N
,
D
(
ImplicitOps
),
D
(
ImplicitOps
|
Priv
),
N
,
N
,
N
,
N
,
N
,
N
,
N
,
N
,
N
,
N
,
/* 0x40 - 0x4F */
...
...
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