Change some hard coded 15 into MAX_INST_LEN.
Signed-off-by: Don Slutz <dslutz@verizon.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
#include <asm/hvm/svm/vmcb.h>
#include <asm/hvm/svm/emulate.h>
-#define MAX_INST_LEN 15
-
static unsigned int is_prefix(u8 opc)
{
switch ( opc )
if ( unlikely(inst_len == 0) )
return;
- if ( unlikely(inst_len > 15) )
+ if ( unlikely(inst_len > MAX_INST_LEN) )
{
gdprintk(XENLOG_ERR, "Bad instruction length %u\n", inst_len);
svm_crash_or_fault(curr);
if ( len != 0 )
{
/* Latch and clear the cached instruction. */
- memcpy(buf, vmcb->guest_ins, 15);
+ memcpy(buf, vmcb->guest_ins, MAX_INST_LEN);
v->arch.hvm_svm.cached_insn_len = 0;
}
unsigned long len;
__vmread(VM_EXIT_INSTRUCTION_LEN, &len); /* Safe: callers audited */
- BUG_ON((len < 1) || (len > 15));
+ BUG_ON((len < 1) || (len > MAX_INST_LEN));
return len;
}
({ unsigned long _x = 0, _eip = _regs.eip; \
if ( !mode_64bit() ) _eip = (uint32_t)_eip; /* ignore upper dword */ \
_regs.eip += (_size); /* real hardware doesn't truncate */ \
- generate_exception_if((uint8_t)(_regs.eip - ctxt->regs->eip) > 15, \
+ generate_exception_if((uint8_t)(_regs.eip - \
+ ctxt->regs->eip) > MAX_INST_LEN, \
EXC_GP, 0); \
rc = ops->insn_fetch(x86_seg_cs, _eip, &_x, (_size), ctxt); \
if ( rc ) goto done; \
#ifndef __X86_EMULATE_H__
#define __X86_EMULATE_H__
+#define MAX_INST_LEN 15
+
struct x86_emulate_ctxt;
/* Comprehensive enumeration of x86 segment registers. */