diff options
author | Laurent Vivier <Laurent.Vivier@bull.net> | 2007-09-18 05:52:50 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:52:47 -0500 |
commit | e4e03deda83b1f2fc37ccbfc1eef27e86e8ed4e9 (patch) | |
tree | 5306b8f262bddcc4e5a59520f8628d85a5b4eaf7 /drivers/kvm/x86_emulate.h | |
parent | a7ddce3afc8326870b9e5e02fa41e028bffb10a5 (diff) |
KVM: x86 emulator: move all x86_emulate_memop() to a structure
Move all x86_emulate_memop() common variables between decode and execute to a
structure decode_cache. This will help in later separating decode and
emulate.
struct decode_cache {
u8 twobyte;
u8 b;
u8 lock_prefix;
u8 rep_prefix;
u8 op_bytes;
u8 ad_bytes;
struct operand src;
struct operand dst;
unsigned long *override_base;
unsigned int d;
unsigned long regs[NR_VCPU_REGS];
unsigned long eip;
/* modrm */
u8 modrm;
u8 modrm_mod;
u8 modrm_reg;
u8 modrm_rm;
u8 use_modrm_ea;
unsigned long modrm_ea;
unsigned long modrm_val;
};
Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/x86_emulate.h')
-rw-r--r-- | drivers/kvm/x86_emulate.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/kvm/x86_emulate.h b/drivers/kvm/x86_emulate.h index 92c73aa7f9ac..c354200d5834 100644 --- a/drivers/kvm/x86_emulate.h +++ b/drivers/kvm/x86_emulate.h | |||
@@ -112,6 +112,36 @@ struct x86_emulate_ops { | |||
112 | 112 | ||
113 | }; | 113 | }; |
114 | 114 | ||
115 | /* Type, address-of, and value of an instruction's operand. */ | ||
116 | struct operand { | ||
117 | enum { OP_REG, OP_MEM, OP_IMM } type; | ||
118 | unsigned int bytes; | ||
119 | unsigned long val, orig_val, *ptr; | ||
120 | }; | ||
121 | |||
122 | struct decode_cache { | ||
123 | u8 twobyte; | ||
124 | u8 b; | ||
125 | u8 lock_prefix; | ||
126 | u8 rep_prefix; | ||
127 | u8 op_bytes; | ||
128 | u8 ad_bytes; | ||
129 | struct operand src; | ||
130 | struct operand dst; | ||
131 | unsigned long *override_base; | ||
132 | unsigned int d; | ||
133 | unsigned long regs[NR_VCPU_REGS]; | ||
134 | unsigned long eip; | ||
135 | /* modrm */ | ||
136 | u8 modrm; | ||
137 | u8 modrm_mod; | ||
138 | u8 modrm_reg; | ||
139 | u8 modrm_rm; | ||
140 | u8 use_modrm_ea; | ||
141 | unsigned long modrm_ea; | ||
142 | unsigned long modrm_val; | ||
143 | }; | ||
144 | |||
115 | struct x86_emulate_ctxt { | 145 | struct x86_emulate_ctxt { |
116 | /* Register state before/after emulation. */ | 146 | /* Register state before/after emulation. */ |
117 | struct kvm_vcpu *vcpu; | 147 | struct kvm_vcpu *vcpu; |
@@ -129,6 +159,10 @@ struct x86_emulate_ctxt { | |||
129 | unsigned long ss_base; | 159 | unsigned long ss_base; |
130 | unsigned long gs_base; | 160 | unsigned long gs_base; |
131 | unsigned long fs_base; | 161 | unsigned long fs_base; |
162 | |||
163 | /* decode cache */ | ||
164 | |||
165 | struct decode_cache decode; | ||
132 | }; | 166 | }; |
133 | 167 | ||
134 | /* Execution mode, passed to the emulator. */ | 168 | /* Execution mode, passed to the emulator. */ |