qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/5] target/s390x: Enforce instruction features


From: David Hildenbrand
Subject: Re: [Qemu-devel] [PATCH 2/5] target/s390x: Enforce instruction features
Date: Thu, 15 Jun 2017 15:10:57 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0

>> A "sane" guest (e.g. Linux) will only use an instruction if the
>> corresponding stfl(e) bit is set. So in my opinion, this should be just
>> fine. If the bit is not set currently, the guest will not use it == dead
>> code.
> 
> Not necessarily. Depending on the distribution, gcc and hence binaries
> default to a different ISA. Over the time people have added the
> corresponding instructions to QEMU so that these binaries work. Now
> given that GCC does not necessarily use all the instructions from a
> given facility, we end up with missing instructions.

That's true, glibc sometimes assumes a certain architecture level
without checking. So you're right, maybe we should defer this "big
hammer" change until we have all facilities as part of the qemu CPU
model. Then, e.g. runnning -cpu qemu will not break such stuff, however
e.g. -cpu z900 could correctly simulate that architecture level.

One option would be:

/* for now, we don't fake absence of features for the qemu model */
if (!object_dynamic_cast(cpu, "qemu-s390x-cpu") {
        dc.features = cpu->model->features;
}


...

if (s->features && !test_bit(insn->fac, s->features)) {
    gen_program_exception(s, PGM_OPERATION);
    return EXIT_NORETURN;
}

> 
> Taking this to its logical extreme, given we don't fully implement the Z
> facility (for example the HFP instructions are missing), we should
> prevent all the programs to run until that is fixed.

I think we don't even implement the PLO, so we're not even pre-z complete ;)


-- 

Thanks,

David



reply via email to

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