2017-08-08 2:45 GMT+08:00 Anatol Pomozov <anatol.pomozov@xxxxxxxxx>: > Hi David > > On Mon, Aug 7, 2017 at 9:59 AM, David Matlack <dmatlack@xxxxxxxxxx> wrote: >> Likely this instruction is accessing an MMIO region (probably a VGA >> buffer, given "mov $0xb8f0e,%ecx"). This will cause a trap to KVM >> and KVM will try to emulate the instruction. The instruction doing the >> MMIO access is an SSE instruction, > > It is correct. The emulation error happens in printf() kernel function > that formats a string and then prints it VGA area. Compilers (both > clang and gcc) think that SSE instructions are more efficient in > dealing with strings and that's why I have SSE instructions here. > >> which KVM does not have support to >> emulate, thus the internal error. If you didn't hand write this >> assembly I would try compiling your kernel with compilation flags to >> disable SSE code generation and see if that fixes your issue. > > Adding "-mno-sse" and removing some floating point functionality in my > kernel make the emulation error go away. So it confirms your thesis. > > Though I need floating point/SSE in my kernel and I can't disable SSE > completely. Instead I would love to understand why KVM can't use SSE > with VGA memory? I tested my kernel binary with bare hardware, KVM, > VMWare, QEMU and only KVM fails. Actually the KVM supports SSE emulation in some degree, please post your testcase here. Regards, Wanpeng Li