qemu-devel
[Top][All Lists]
Advanced

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

Re: Access target TranslatorOps


From: Peter Maydell
Subject: Re: Access target TranslatorOps
Date: Mon, 25 Jul 2022 10:07:38 +0100

On Fri, 22 Jul 2022 at 06:09, Kenneth Adam Miller
<kennethadammiller@gmail.com> wrote:
>
> I need to determine the set of instruction encodings that the TCG can support 
> for a given platform. I am not bothered whether the target runs at all, and 
> in fact it is better if it doesn't, so runtime or translate time doesn't 
> bother me.

So, something like "does the emulated CPU support guest architecture
feature X" ? Look at how eg arm handles setting the Linux hwcap bits,
for instance.

> Imagine I were adding support for more instructions for a given platform.
> I would like to check that I'm using the API right. It's amazing that
> it's been so far and there's no way to check that the correct behavior
> occurs when a given encoding is encountered regarding the TCG.

The way to test "is the emulation correct" is to have test programs.
For Arm we use 'risu' to generate random instruction sequences and
check their behaviour against some golden reference, which can catch
things like "is this insn supposed to undef in this configuration".

> A boolean result from a can_translate called just when the target
> encounters the instruction would be good. Additionally, the ability
> to force the translation of arbitrary encodings would be good.

I am completely confused about what you want to do here, because
these requests just sound completely bizarre to me. The translator
is its own self-contained, and linux-user should have no requirement at
all to be told whether an instruction happens to translate to
"raise an exception" or "generate code to do something".

> Additionally, the ability
> to force the translation of arbitrary encodings would be good.

This is easy -- just put the right bytes into the test binary.

-- PMM



reply via email to

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