summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas@sandberg.pp.se>2014-03-03 14:34:33 +0100
committerAndreas Sandberg <andreas@sandberg.pp.se>2014-03-03 14:34:33 +0100
commite7d230ede0deb239271a25d227a792ae615daee2 (patch)
treec769d45dad82108ffd2b744e8912dee524ea3b8b
parent739cc0128b666694274b018f303aba452107f8f6 (diff)
downloadgem5-e7d230ede0deb239271a25d227a792ae615daee2.tar.xz
kvm: x86: Always assume segments to be usable
When transferring segment registers into kvm, we need to find the value of the unusable bit. We used to assume that this could be inferred from the selector since segments are generally unusable if their selector is 0. This assumption breaks in some weird corner cases. Instead, we just assume that segments are always usable. This is what qemu does so it should work.
-rw-r--r--src/cpu/kvm/x86_cpu.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cpu/kvm/x86_cpu.cc b/src/cpu/kvm/x86_cpu.cc
index 8f7ca19e4..b79207fab 100644
--- a/src/cpu/kvm/x86_cpu.cc
+++ b/src/cpu/kvm/x86_cpu.cc
@@ -721,11 +721,11 @@ setKvmSegmentReg(ThreadContext *tc, struct kvm_segment &kvm_seg,
kvm_seg.g = attr.granularity;
kvm_seg.avl = attr.avl;
- // A segment is unusable when the selector is zero. There is a
- // attr.unusable flag in gem5, but it seems unused.
- //
- // TODO: Are there corner cases where this doesn't work?
- kvm_seg.unusable = (kvm_seg.selector == 0);
+ // A segment is normally unusable when the selector is zero. There
+ // is a attr.unusable flag in gem5, but it seems unused. qemu
+ // seems to set this to 0 all the time, so we just do the same and
+ // hope for the best.
+ kvm_seg.unusable = 0;
}
static inline void