Review Board 2.0.15


kvm: x86: Adjust PC to remove the CS segment base address

Review Request #2180 - Created March 3, 2014 and submitted - Latest diff uploaded

Information
Andreas Sandberg
gem5
default
Reviewers
Default
Changeset 10102:cf2e3a521dfb
---------------------------
kvm: x86: Adjust PC to remove the CS segment base address

gem5 seems to store the PC as RIP+CS_BASE. This is not what KVM
expects, so we need to subtract CS_BASE prior to transferring the PC
into KVM. This changeset adds the necessary PC manipulation and
refactors thread context updates slightly to avoid reading registers
multiple times from KVM.

*** Note to reviewers ***
I'm unsure about the specifics surrounding gem5's handling of segments. Judging from how the PC is handled in src/arch/x86/fault.cc, it seems like the base of the CS segment is included in the PCState. I'd appreciate a second opinion on this. (There are very few cases nowadays, except for during boot, when the base is non-zero.)
Tested as a part of a series of patches that enables multicore simulation in kvm. This patch is required to get the APs to boot. Linux boots in multiprocessor mode when the whole series is applied.