[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v9 06/13] xen: Add ring 3 vmware_port support



On 02/23/15 10:12, Jan Beulich wrote:
>>>> On 17.02.15 at 00:05, <dslutz@xxxxxxxxxxx> wrote:
>> Enable no-fault of pio in x86_emulate for VMware port
> 
> ???
> 
>> @@ -393,6 +393,11 @@ struct x86_emulate_ops
>>          enum x86_segment seg,
>>          unsigned long offset,
>>          struct x86_emulate_ctxt *ctxt);
>> +
>> +    /* vmport_check */
>> +    int (*vmport_check)(
>> +        unsigned int port,
>> +        struct x86_emulate_ctxt *ctxt);
> 
> I hope that this will no longer be needed with the adjustments
> Andrew suggested. In light of that I only skimmed the patch,
> awaiting the next version to be less involved.
> 

My understanding is that it is needed.  The code in
xen/arch/x86/x86_emulate is not to access code directly
in xen/arch/x86/hvm.

tools/tests/x86_emulator/test_x86_emulator.c would not build if
the routine was access directly.


Here is the code that passed my testing:

    case 0xe4: /* in imm8,%al */
    case 0xe5: /* in imm8,%eax */
    case 0xe6: /* out %al,imm8 */
    case 0xe7: /* out %eax,imm8 */
    case 0xec: /* in %dx,%al */
    case 0xed: /* in %dx,%eax */
    case 0xee: /* out %al,%dx */
    case 0xef: /* out %eax,%dx */ {
        unsigned int port = ((b < 0xe8)
                             ? insn_fetch_type(uint8_t)
                             : (uint16_t)_regs.edx);
        bool_t vmport = (ops->vmport_check && /* Vmware backdoor? */
                         (ops->vmport_check(port, ctxt) == 0));
        op_bytes = !(b & 1) ? 1 : (op_bytes == 8) ? 4 : op_bytes;
        if ( !vmport &&
             (rc = ioport_access_check(port, op_bytes, ctxt, ops)) != 0 )
            goto done;
        if ( b & 2 )
        {
            /* out */
            fail_if(ops->write_io == NULL);
            rc = ops->write_io(port, op_bytes, _regs.eax, ctxt);
        }
        else
        {
            /* in */
            dst.type  = OP_REG;
            dst.bytes = op_bytes;
            dst.reg   = (unsigned long *)&_regs.eax;
            fail_if(ops->read_io == NULL);
            rc = ops->read_io(port, dst.bytes, &dst.val, ctxt);
        }
        if ( rc != 0 )
            goto done;
        if ( vmport )
        {
            _regs._ebx = ctxt->regs->_ebx;
            _regs._ecx = ctxt->regs->_ecx;
            _regs._edx = ctxt->regs->_edx;
            _regs._esi = ctxt->regs->_esi;
            _regs._edi = ctxt->regs->_edi;
        }
        break;
    }


   -Don Slutz

> Jan
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.