[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150920081340.GA8571@gmail.com>
Date: Sun, 20 Sep 2015 10:13:40 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Denys Vlasenko <dvlasenk@...hat.com>
Cc: Borislav Petkov <bp@...en8.de>, "H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...capital.net>,
Kees Cook <keescook@...omium.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] x86/math-emu: Add support for FCMOVcc and
F[U]COMI[P] insns
* Denys Vlasenko <dvlasenk@...hat.com> wrote:
> >> arch/x86/math-emu/fpu_aux.c | 70 ++++++++++++++++++++++
> >> arch/x86/math-emu/fpu_entry.c | 49 +++++++++------
> >> arch/x86/math-emu/fpu_proto.h | 12 ++++
> >> arch/x86/math-emu/reg_compare.c | 128 ++++++++++++++++++++++++++++++++++++++++
> >> 4 files changed, 241 insertions(+), 18 deletions(-)
> >
> > I wanted to apply this patch, but noticed the following problem: why are two
> > instruction families added in a single patch?
>
> They were introduced at the same time in the CPU evolution
> (when CMOV feature was added).
>
> The idea is that there may be programs which assume that "cmov"
> in /proc/cpuinfo means both these insns are safe to use,
> which is true for all real CPUs.
I see, that makes sense - and this makes bisection of any bugs in the emulator
implementation harder.
Still, it cannot hurt I suppose.
Btw., has anyone explored the possibility to have an emulator 'runtime test' on
FPU-capable CPUs: to run in FPU emulation and to run the emulation code, but to
also run the real hardware instruction(s) against that context and double check
that the two FPU register sets match up, bit for bit?
If the emulator is perfect then the two would always match: the hardware
instruction generates the exact same result as software emulation.
This would slows down emulation a bit (but emulation is slow anyway due to trap
overhead), but makes it a lot more obvious that the emulator is correct.
It's not a trivial feature though I suspect, exceptions would have to be taken
care of, etc.
The motivation would be to make it much easier to extend the emulator, which would
be useful to run modern Linux distros on future low-power x86 designs that have no
FPU circuitry altogether.
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists