Commit dee6bb70 authored by Joerg Roedel's avatar Joerg Roedel Committed by Avi Kivity

KVM: SVM: Add intercept checks for descriptor table accesses

This patch add intercept checks into the KVM instruction
emulator to check for the 8 instructions that access the
descriptor table addresses.
Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 3b88e41a
...@@ -2630,8 +2630,18 @@ static struct opcode group5[] = { ...@@ -2630,8 +2630,18 @@ static struct opcode group5[] = {
D(SrcMem | ModRM | Stack), N, D(SrcMem | ModRM | Stack), N,
}; };
static struct opcode group6[] = {
DI(ModRM | Prot, sldt),
DI(ModRM | Prot, str),
DI(ModRM | Prot | Priv, lldt),
DI(ModRM | Prot | Priv, ltr),
N, N, N, N,
};
static struct group_dual group7 = { { static struct group_dual group7 = { {
N, N, DI(ModRM | SrcMem | Priv, lgdt), DI(ModRM | SrcMem | Priv, lidt), DI(ModRM | Mov | DstMem | Priv, sgdt),
DI(ModRM | Mov | DstMem | Priv, sidt),
DI(ModRM | SrcMem | Priv, lgdt), DI(ModRM | SrcMem | Priv, lidt),
DI(SrcNone | ModRM | DstMem | Mov, smsw), N, DI(SrcNone | ModRM | DstMem | Mov, smsw), N,
DI(SrcMem16 | ModRM | Mov | Priv, lmsw), DI(SrcMem16 | ModRM | Mov | Priv, lmsw),
DI(SrcMem | ModRM | ByteOp | Priv | NoAccess, invlpg), DI(SrcMem | ModRM | ByteOp | Priv | NoAccess, invlpg),
...@@ -2766,7 +2776,7 @@ static struct opcode opcode_table[256] = { ...@@ -2766,7 +2776,7 @@ static struct opcode opcode_table[256] = {
static struct opcode twobyte_table[256] = { static struct opcode twobyte_table[256] = {
/* 0x00 - 0x0F */ /* 0x00 - 0x0F */
N, GD(0, &group7), N, N, G(0, group6), GD(0, &group7), N, N,
N, D(ImplicitOps | VendorSpecific), DI(ImplicitOps | Priv, clts), N, N, D(ImplicitOps | VendorSpecific), DI(ImplicitOps | Priv, clts), N,
DI(ImplicitOps | Priv, invd), DI(ImplicitOps | Priv, wbinvd), N, N, DI(ImplicitOps | Priv, invd), DI(ImplicitOps | Priv, wbinvd), N, N,
N, D(ImplicitOps | ModRM), N, N, N, D(ImplicitOps | ModRM), N, N,
......
...@@ -3884,6 +3884,14 @@ static struct __x86_intercept { ...@@ -3884,6 +3884,14 @@ static struct __x86_intercept {
[x86_intercept_smsw] = POST_EX(SVM_EXIT_READ_CR0), [x86_intercept_smsw] = POST_EX(SVM_EXIT_READ_CR0),
[x86_intercept_dr_read] = POST_EX(SVM_EXIT_READ_DR0), [x86_intercept_dr_read] = POST_EX(SVM_EXIT_READ_DR0),
[x86_intercept_dr_write] = POST_EX(SVM_EXIT_WRITE_DR0), [x86_intercept_dr_write] = POST_EX(SVM_EXIT_WRITE_DR0),
[x86_intercept_sldt] = POST_EX(SVM_EXIT_LDTR_READ),
[x86_intercept_str] = POST_EX(SVM_EXIT_TR_READ),
[x86_intercept_lldt] = POST_EX(SVM_EXIT_LDTR_WRITE),
[x86_intercept_ltr] = POST_EX(SVM_EXIT_TR_WRITE),
[x86_intercept_sgdt] = POST_EX(SVM_EXIT_GDTR_READ),
[x86_intercept_sidt] = POST_EX(SVM_EXIT_IDTR_READ),
[x86_intercept_lgdt] = POST_EX(SVM_EXIT_GDTR_WRITE),
[x86_intercept_lidt] = POST_EX(SVM_EXIT_IDTR_WRITE),
}; };
#undef POST_EX #undef POST_EX
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment