|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 9/9] x86/vvmx: Use hvm_copy_{to, from}_guest_virt() to read operands
>>> On 26.10.17 at 19:03, <euan.harris@xxxxxxxxxx> wrote:
In the title please use "read/write" or "access".
> @@ -380,17 +383,7 @@ static int operand_read(void *buf, struct vmx_inst_op
> *op,
> return X86EMUL_OKAY;
> }
> else
> - {
> - pagefault_info_t pfinfo;
> - int rc = hvm_copy_from_guest_linear(buf, op->mem, bytes, 0, &pfinfo);
> -
> - if ( rc == HVMTRANS_bad_linear_to_gfn )
> - hvm_inject_page_fault(pfinfo.ec, pfinfo.linear);
> - if ( rc != HVMTRANS_okay )
> - return X86EMUL_EXCEPTION;
> -
> - return X86EMUL_OKAY;
> - }
> + return hvm_copy_from_guest_virt(buf, op->seg, op->offset, bytes, 0);
> }
Please also drop the now pointless "else".
> @@ -458,9 +451,8 @@ static int decode_vmx_inst(struct cpu_user_regs *regs,
> {
> struct vcpu *v = current;
> union vmx_inst_info info;
> - struct segment_register seg;
> - unsigned long base, index, seg_base, disp, offset;
> - int scale, size;
> + unsigned long base, index, disp, offset;
> + int scale;
unsigned int please, if you touch it anyway.
> @@ -496,19 +485,12 @@ static int decode_vmx_inst(struct cpu_user_regs *regs,
>
> __vmread(EXIT_QUALIFICATION, &disp);
>
> - size = 1 << (info.fields.addr_size + 1);
> -
> - offset = base + index * scale + disp;
> - base = !mode_64bit || info.fields.segment >= x86_seg_fs ?
> - seg_base + offset : offset;
> - if ( offset + size - 1 < offset ||
> - (mode_64bit ?
> - !is_canonical_address((long)base < 0 ? base :
> - base + size - 1) :
> - offset + size - 1 > seg.limit) )
> - goto gp_fault;
> + decode->op[0].type = VMX_INST_MEMREG_TYPE_MEMORY;
> + decode->op[0].seg = info.fields.segment;
> + decode->op[0].offset = base + index * scale + disp;
> + if ( info.fields.addr_size < 2 )
> + decode->op[0].offset = (uint32_t)decode->op[0].offset;
For 16-bit addressing you need to truncate to 16 bits.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |