[Top][All Lists]

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

Re: [Qemu-discuss] Basic Question on QEMU Internals

From: Patrick
Subject: Re: [Qemu-discuss] Basic Question on QEMU Internals
Date: Thu, 26 Mar 2015 15:24:57 -0600

"That affects the fine detail of exactly how we translate the guest code..."

I see that the list of x86 cpus includes Nehalem, Westmere, Penryn, and many others. I was somewhat interested in what QEMU is doing differently when emulating, for example, a Nehalem versus a Westmere. From looking at target-i386/cpu.c, it appears that it is because the two microarchitectures have slight differences in the instructions they support (e.g. Westmere having the AES extensions), even though they are both x86.

I was curious about whether QEMU was doing anything that reflected differences between the two with respect to their hardware for executing standard x86 instructions, for example. From what you've said so far, I'm suspecting that it doesn't. That is what I had thought before, but when I saw the ability to specify different microarchitectures on the command line, I became curious.

Thanks again,

On Thu, Mar 26, 2015 at 2:58 PM, Peter Maydell <address@hidden> wrote:
On 26 March 2015 at 20:44, Patrick <address@hidden> wrote:
> Thank you for the response. This makes sense, but I am not seeing how the
> "cpu" or "machine" command-line arguments fit into the "flow." It appears
> that the "cpu" flag is changing the x86 microarchitecture that is being
> emulated. If the x86 code is getting translated to TCG ops, then how does
> changing the microarchitecture change the flow?

-cpu specifies the guest CPU type to use. That affects
the fine detail of exactly how we translate the
guest code to TCG ops (for instance, if we're emulating
a 386 then we will translate pentium-only guest instructions
to TCG code that says "take an exception, not a valid instruction"
rather than to TCG code that says "do these things to have the
effect the instruction should have"). But the flow is in
general the same in all cases:
 guest code -> TCG -> host code

(If you use, for instance, qemu-system-ppc and a -cpu
argument specifying a PPC guest CPU, then how we translate
guest code to TCG will of course change a lot, since the
instruction set is completely different. The "TCG -> host code"
part remains exactly the same, though.)

-- PMM

reply via email to

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