qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Re: backdoor


From: Lluís
Subject: Re: [Qemu-devel] Re: backdoor
Date: Tue, 26 Oct 2010 22:03:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Anthony Liguori writes:

> On 10/25/2010 05:48 PM, Lluís wrote:
>>> For instance, a CPUID leaf could be used in the 0x40001xxx range.
>>> 
>> Right, I commented this in a previous mail as a much nicer way to do it,
>> but I was just too lazy to look up how CPUID works and instead ported
>> the implementation I already had in bochs :)
>> 
>> Although I can port it to CPUID if people find it useful to have
>> upstream. I just need a way to provide an immediate and a register-based
>> argument (at the same time), which does not require executing more than
>> a couple of extra instructions (right now everything fits on a single
>> instruction).
>> 
>> Being able te receive back information would be a plus, which I think
>> CPUID already does to return its results; although I think the ISA says
>> that _all_ registers are "used" after executing it.
>> 

> I think just the base 6 GP registers.  I don't think any of the extended
> registers in 64-bit mode are affected but I would have to look it up.

Right, only the 6 GPRs are defined after a CPUID call.

I'll port my current backdoor implementation to use an unused CPUID
command (by defining EAX), and use the remaining 5 GPRs to provide up to
5 inputs to the backdoor backend.

The plus of this is that it won't crash applications when not running
under QEMU emulation.

The down side is that although both SVM and VMX support intercepting
CPUID calls, KVM does not export this (because it's not a portable form
of hypercall), so I'll still need PIO or MMIO to switch to/from KVM
(vmcall/vmmcall are neither an option as I understand they are
deprecated [1]).

[1] http://lxr.linux.no/linux+v2.6.36/Documentation/kvm/api.txt#L1152

What I thought is that as I'll probably need MMIO to switch between KVM
and emulation, providing also a "-device mon" might come in handy, so
that the guest can issue QMP commands to itself using MMIO, including
trace/instrumentation control commands.

Is anyone already implementing this?


Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth



reply via email to

[Prev in Thread] Current Thread [Next in Thread]