aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Krause <minipli@googlemail.com>2012-08-29 19:30:15 -0400
committerAvi Kivity <avi@redhat.com>2012-09-05 05:41:28 -0400
commitfd0a0d82083747301f6c8084b4141bb490625016 (patch)
tree1233ae0b425ce146652725e99c492b4bc3c80f0e
parent89a87c67791b840d815a2028b88cefe6906ed42c (diff)
KVM: x86 emulator: mark opcode tables const
The opcode tables never change at runtime, therefor mark them const. Signed-off-by: Mathias Krause <minipli@googlemail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--arch/x86/kvm/emulate.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 5a0fee1a19c9..fd06f9d65847 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -161,9 +161,9 @@ struct opcode {
161 u64 intercept : 8; 161 u64 intercept : 8;
162 union { 162 union {
163 int (*execute)(struct x86_emulate_ctxt *ctxt); 163 int (*execute)(struct x86_emulate_ctxt *ctxt);
164 struct opcode *group; 164 const struct opcode *group;
165 struct group_dual *gdual; 165 const struct group_dual *gdual;
166 struct gprefix *gprefix; 166 const struct gprefix *gprefix;
167 } u; 167 } u;
168 int (*check_perm)(struct x86_emulate_ctxt *ctxt); 168 int (*check_perm)(struct x86_emulate_ctxt *ctxt);
169}; 169};
@@ -3574,13 +3574,13 @@ static int check_perm_out(struct x86_emulate_ctxt *ctxt)
3574 I2bv(((_f) | DstReg | SrcMem | ModRM) & ~Lock, _e), \ 3574 I2bv(((_f) | DstReg | SrcMem | ModRM) & ~Lock, _e), \
3575 I2bv(((_f) & ~Lock) | DstAcc | SrcImm, _e) 3575 I2bv(((_f) & ~Lock) | DstAcc | SrcImm, _e)
3576 3576
3577static struct opcode group7_rm1[] = { 3577static const struct opcode group7_rm1[] = {
3578 DI(SrcNone | Priv, monitor), 3578 DI(SrcNone | Priv, monitor),
3579 DI(SrcNone | Priv, mwait), 3579 DI(SrcNone | Priv, mwait),
3580 N, N, N, N, N, N, 3580 N, N, N, N, N, N,
3581}; 3581};
3582 3582
3583static struct opcode group7_rm3[] = { 3583static const struct opcode group7_rm3[] = {
3584 DIP(SrcNone | Prot | Priv, vmrun, check_svme_pa), 3584 DIP(SrcNone | Prot | Priv, vmrun, check_svme_pa),
3585 II(SrcNone | Prot | VendorSpecific, em_vmmcall, vmmcall), 3585 II(SrcNone | Prot | VendorSpecific, em_vmmcall, vmmcall),
3586 DIP(SrcNone | Prot | Priv, vmload, check_svme_pa), 3586 DIP(SrcNone | Prot | Priv, vmload, check_svme_pa),
@@ -3591,13 +3591,13 @@ static struct opcode group7_rm3[] = {
3591 DIP(SrcNone | Prot | Priv, invlpga, check_svme), 3591 DIP(SrcNone | Prot | Priv, invlpga, check_svme),
3592}; 3592};
3593 3593
3594static struct opcode group7_rm7[] = { 3594static const struct opcode group7_rm7[] = {
3595 N, 3595 N,
3596 DIP(SrcNone, rdtscp, check_rdtsc), 3596 DIP(SrcNone, rdtscp, check_rdtsc),
3597 N, N, N, N, N, N, 3597 N, N, N, N, N, N,
3598}; 3598};
3599 3599
3600static struct opcode group1[] = { 3600static const struct opcode group1[] = {
3601 I(Lock, em_add), 3601 I(Lock, em_add),
3602 I(Lock | PageTable, em_or), 3602 I(Lock | PageTable, em_or),
3603 I(Lock, em_adc), 3603 I(Lock, em_adc),
@@ -3608,11 +3608,11 @@ static struct opcode group1[] = {
3608 I(0, em_cmp), 3608 I(0, em_cmp),
3609}; 3609};
3610 3610
3611static struct opcode group1A[] = { 3611static const struct opcode group1A[] = {
3612 I(DstMem | SrcNone | Mov | Stack, em_pop), N, N, N, N, N, N, N, 3612 I(DstMem | SrcNone | Mov | Stack, em_pop), N, N, N, N, N, N, N,
3613}; 3613};
3614 3614
3615static struct opcode group3[] = { 3615static const struct opcode group3[] = {
3616 I(DstMem | SrcImm, em_test), 3616 I(DstMem | SrcImm, em_test),
3617 I(DstMem | SrcImm, em_test), 3617 I(DstMem | SrcImm, em_test),
3618 I(DstMem | SrcNone | Lock, em_not), 3618 I(DstMem | SrcNone | Lock, em_not),
@@ -3623,13 +3623,13 @@ static struct opcode group3[] = {
3623 I(SrcMem, em_idiv_ex), 3623 I(SrcMem, em_idiv_ex),
3624}; 3624};
3625 3625
3626static struct opcode group4[] = { 3626static const struct opcode group4[] = {
3627 I(ByteOp | DstMem | SrcNone | Lock, em_grp45), 3627 I(ByteOp | DstMem | SrcNone | Lock, em_grp45),
3628 I(ByteOp | DstMem | SrcNone | Lock, em_grp45), 3628 I(ByteOp | DstMem | SrcNone | Lock, em_grp45),
3629 N, N, N, N, N, N, 3629 N, N, N, N, N, N,
3630}; 3630};
3631 3631
3632static struct opcode group5[] = { 3632static const struct opcode group5[] = {
3633 I(DstMem | SrcNone | Lock, em_grp45), 3633 I(DstMem | SrcNone | Lock, em_grp45),
3634 I(DstMem | SrcNone | Lock, em_grp45), 3634 I(DstMem | SrcNone | Lock, em_grp45),
3635 I(SrcMem | Stack, em_grp45), 3635 I(SrcMem | Stack, em_grp45),
@@ -3639,7 +3639,7 @@ static struct opcode group5[] = {
3639 I(SrcMem | Stack, em_grp45), N, 3639 I(SrcMem | Stack, em_grp45), N,
3640}; 3640};
3641 3641
3642static struct opcode group6[] = { 3642static const struct opcode group6[] = {
3643 DI(Prot, sldt), 3643 DI(Prot, sldt),
3644 DI(Prot, str), 3644 DI(Prot, str),
3645 II(Prot | Priv | SrcMem16, em_lldt, lldt), 3645 II(Prot | Priv | SrcMem16, em_lldt, lldt),
@@ -3647,7 +3647,7 @@ static struct opcode group6[] = {
3647 N, N, N, N, 3647 N, N, N, N,
3648}; 3648};
3649 3649
3650static struct group_dual group7 = { { 3650static const struct group_dual group7 = { {
3651 II(Mov | DstMem | Priv, em_sgdt, sgdt), 3651 II(Mov | DstMem | Priv, em_sgdt, sgdt),
3652 II(Mov | DstMem | Priv, em_sidt, sidt), 3652 II(Mov | DstMem | Priv, em_sidt, sidt),
3653 II(SrcMem | Priv, em_lgdt, lgdt), 3653 II(SrcMem | Priv, em_lgdt, lgdt),
@@ -3664,7 +3664,7 @@ static struct group_dual group7 = { {
3664 EXT(0, group7_rm7), 3664 EXT(0, group7_rm7),
3665} }; 3665} };
3666 3666
3667static struct opcode group8[] = { 3667static const struct opcode group8[] = {
3668 N, N, N, N, 3668 N, N, N, N,
3669 I(DstMem | SrcImmByte, em_bt), 3669 I(DstMem | SrcImmByte, em_bt),
3670 I(DstMem | SrcImmByte | Lock | PageTable, em_bts), 3670 I(DstMem | SrcImmByte | Lock | PageTable, em_bts),
@@ -3672,26 +3672,26 @@ static struct opcode group8[] = {
3672 I(DstMem | SrcImmByte | Lock | PageTable, em_btc), 3672 I(DstMem | SrcImmByte | Lock | PageTable, em_btc),
3673}; 3673};
3674 3674
3675static struct group_dual group9 = { { 3675static const struct group_dual group9 = { {
3676 N, I(DstMem64 | Lock | PageTable, em_cmpxchg8b), N, N, N, N, N, N, 3676 N, I(DstMem64 | Lock | PageTable, em_cmpxchg8b), N, N, N, N, N, N,
3677}, { 3677}, {
3678 N, N, N, N, N, N, N, N, 3678 N, N, N, N, N, N, N, N,
3679} }; 3679} };
3680 3680
3681static struct opcode group11[] = { 3681static const struct opcode group11[] = {
3682 I(DstMem | SrcImm | Mov | PageTable, em_mov), 3682 I(DstMem | SrcImm | Mov | PageTable, em_mov),
3683 X7(D(Undefined)), 3683 X7(D(Undefined)),
3684}; 3684};
3685 3685
3686static struct gprefix pfx_0f_6f_0f_7f = { 3686static const struct gprefix pfx_0f_6f_0f_7f = {
3687 I(Mmx, em_mov), I(Sse | Aligned, em_mov), N, I(Sse | Unaligned, em_mov), 3687 I(Mmx, em_mov), I(Sse | Aligned, em_mov), N, I(Sse | Unaligned, em_mov),
3688}; 3688};
3689 3689
3690static struct gprefix pfx_vmovntpx = { 3690static const struct gprefix pfx_vmovntpx = {
3691 I(0, em_mov), N, N, N, 3691 I(0, em_mov), N, N, N,
3692}; 3692};
3693 3693
3694static struct opcode opcode_table[256] = { 3694static const struct opcode opcode_table[256] = {
3695 /* 0x00 - 0x07 */ 3695 /* 0x00 - 0x07 */
3696 I6ALU(Lock, em_add), 3696 I6ALU(Lock, em_add),
3697 I(ImplicitOps | Stack | No64 | Src2ES, em_push_sreg), 3697 I(ImplicitOps | Stack | No64 | Src2ES, em_push_sreg),
@@ -3808,7 +3808,7 @@ static struct opcode opcode_table[256] = {
3808 D(ImplicitOps), D(ImplicitOps), G(0, group4), G(0, group5), 3808 D(ImplicitOps), D(ImplicitOps), G(0, group4), G(0, group5),
3809}; 3809};
3810 3810
3811static struct opcode twobyte_table[256] = { 3811static const struct opcode twobyte_table[256] = {
3812 /* 0x00 - 0x0F */ 3812 /* 0x00 - 0x0F */
3813 G(0, group6), GD(0, &group7), N, N, 3813 G(0, group6), GD(0, &group7), N, N,
3814 N, I(ImplicitOps | VendorSpecific, em_syscall), 3814 N, I(ImplicitOps | VendorSpecific, em_syscall),