vmm: Handle mov with zero-extend
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 22 Dec 2017 17:06:24 +0000 (12:06 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 22 Dec 2017 17:06:24 +0000 (12:06 -0500)
commit78022a95d1b27e3225ab48d97d50cb90cb2fe47d
treeba1a4ca2bbc6d6ada1cae51239cec1cb952699df
parent861f20cafb82431379ddde0aed3488fdfabfef80
vmm: Handle mov with zero-extend

I noticed that if you dropped the apic=debug command line argument to the
guest, then they would crash.

The root cause was our EPT handler, which emulates access to the low 4K of
physical memory, wasn't handling movzwl correctly.  We were not
zero-extending.  That led to junk in registers that the compiler didn't
expect.  And that led Linux to get a false positive for get_bios_ebda(),
which lead to dereferencing garbage.

The apic=debug turned on a printk, which was enough to change the registers
so that the junk was not present.  Similarly, some basic tracing that moved
registers or changed "don't care" values before the call to get_bios_ebda()
was enough to make the code work.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/vmm/decode.c