On Mon, 24 Jun 2019, Jason Tubnor wrote:
> Following daily snapshots, I have hit a bug that was introduced between
> 6.5-current #61 and 6.5-current #66 (not sure if it was related to the LLVM
> upgrade).
> 
> Reference system is bhyve on FreeBSD 11.2 with an OpenBSD guest.  #61 boots
> fine and runs as expected.  However, #66 get to the following point and the
> guest terminates:
...
> Below is output from bhyve.log:
> 
> rdmsr to register 0xc80 on vcpu 0
> Failed to emulate instruction [0xf7 0x04 0x25 0x00 0xd3 0xd1 0x81 0x00 0x10
> 0x00 0x00 0x74 0x08 0xf3 0x90] at 0xffffffff817648f0

According to objdump -d, that's:
 f7 04 25 00 d3 d1 81    testl  $0x1000,0xffffffff81d1d300
 00 10 00 00
 74 08                   je     <forward some>
 f3 90                   pause

That's testing the LAPIC ICRLO, a memory-mapped register.  Previously, the 
compiler generated code like this:

 8b 0c 25 00 63 cf 81    mov    0xffffffff81cf6300,%ecx
 f7 c1 00 10 00 00       test   $0x1000,%ecx
 74 09                   je     <forward some>
 f3 90                   pause  

where it loaded the LAPIC register into %ecx and then tested that value; 
now it combines them and does a direct test.  Congrats, that's legal 
according to Intel (reportedly, Windows will use SSE(!) instructions to 
read LAPIC registers), so this seems like a bug in Bhyve.


Philip Guenther

Reply via email to