[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/hvm: move MAX_INST_LEN into x86_emulate.h
commit a7d6ba754d39d3e71963b2224f91541dd5289946 Author: Don Slutz <dslutz@xxxxxxxxxxx> AuthorDate: Wed Feb 18 17:00:47 2015 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Feb 18 17:00:47 2015 +0100 x86/hvm: move MAX_INST_LEN into x86_emulate.h Change some hard coded 15 into MAX_INST_LEN. Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/arch/x86/hvm/svm/emulate.c | 2 -- xen/arch/x86/hvm/svm/svm.c | 4 ++-- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/x86_emulate/x86_emulate.c | 3 ++- xen/arch/x86/x86_emulate/x86_emulate.h | 2 ++ 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/hvm/svm/emulate.c b/xen/arch/x86/hvm/svm/emulate.c index 37a1ece..6f5c8d3 100644 --- a/xen/arch/x86/hvm/svm/emulate.c +++ b/xen/arch/x86/hvm/svm/emulate.c @@ -27,8 +27,6 @@ #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 ) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 018dd70..d82b434 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -106,7 +106,7 @@ void __update_guest_eip(struct cpu_user_regs *regs, unsigned int inst_len) 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); @@ -859,7 +859,7 @@ static unsigned int svm_get_insn_bytes(struct vcpu *v, uint8_t *buf) 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; } diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 357ef6c..e1c55ce 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -1854,7 +1854,7 @@ static int get_instruction_length(void) 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; } diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index f13f07d..5e9e040 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -579,7 +579,8 @@ do{ asm volatile ( \ ({ 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; \ diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h index bdce861..593b31e 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.h +++ b/xen/arch/x86/x86_emulate/x86_emulate.h @@ -24,6 +24,8 @@ #ifndef __X86_EMULATE_H__ #define __X86_EMULATE_H__ +#define MAX_INST_LEN 15 + struct x86_emulate_ctxt; /* Comprehensive enumeration of x86 segment registers. */ -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |