summaryrefslogtreecommitdiff
path: root/src/arch/x86/process.cc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-01-29 17:49:07 -0800
committerGabe Black <gabeblack@google.com>2018-03-15 00:54:42 +0000
commit8b66b56b12664211e76fc1bc880f1a13cb88bc06 (patch)
tree268a90b07c4dd25ff8406a89fe0d6a5c06fc7417 /src/arch/x86/process.cc
parent497ebfe98578b71d22f979b848c4b873f05ec6ee (diff)
downloadgem5-8b66b56b12664211e76fc1bc880f1a13cb88bc06.tar.xz
x86: Add bitfields which can gather/scatter bases and limits.
Add bitfields which can gather/scatter base and limit fields within "normal" segment descriptors, and in TSS descriptors which have the same bitfields in the same positions for those two values. This centralizes the code which manages those bitfields and makes it less likely that a local implementation will be buggy. Change-Id: I9809aa626fc31388595c3d3b225c25a0ec6a1275 Reviewed-on: https://gem5-review.googlesource.com/7661 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/arch/x86/process.cc')
-rw-r--r--src/arch/x86/process.cc20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/arch/x86/process.cc b/src/arch/x86/process.cc
index cfec21f39..7c979c016 100644
--- a/src/arch/x86/process.cc
+++ b/src/arch/x86/process.cc
@@ -244,12 +244,9 @@ X86_64Process::initState()
initDesc.p = 1; // present
initDesc.l = 1; // longmode - 64 bit
initDesc.d = 0; // operand size
- initDesc.g = 1; // granularity
initDesc.s = 1; // system segment
- initDesc.limitHigh = 0xFFFF;
- initDesc.limitLow = 0xF;
- initDesc.baseHigh = 0x0;
- initDesc.baseLow = 0x0;
+ initDesc.limit = 0xFFFFFFFF;
+ initDesc.base = 0;
//64 bit code segment
SegDescriptor csLowPLDesc = initDesc;
@@ -320,11 +317,8 @@ X86_64Process::initState()
TSSDescLow.type = 0xB;
TSSDescLow.dpl = 0; // Privelege level 0
TSSDescLow.p = 1; // Present
- TSSDescLow.g = 1; // Page granularity
- TSSDescLow.limitHigh = 0xF;
- TSSDescLow.limitLow = 0xFFFF;
- TSSDescLow.baseLow = bits(TSSVirtAddr, 23, 0);
- TSSDescLow.baseHigh = bits(TSSVirtAddr, 31, 24);
+ TSSDescLow.limit = 0xFFFFFFFF;
+ TSSDescLow.base = bits(TSSVirtAddr, 31, 0);
TSShigh TSSDescHigh = 0;
TSSDescHigh.base = bits(TSSVirtAddr, 63, 32);
@@ -342,10 +336,8 @@ X86_64Process::initState()
SegSelector tssSel = 0;
tssSel.si = numGDTEntries - 1;
- uint64_t tss_base_addr = (TSSDescHigh.base << 32) |
- (TSSDescLow.baseHigh << 24) |
- TSSDescLow.baseLow;
- uint64_t tss_limit = TSSDescLow.limitLow | (TSSDescLow.limitHigh << 16);
+ uint64_t tss_base_addr = (TSSDescHigh.base << 32) | TSSDescLow.base;
+ uint64_t tss_limit = TSSDescLow.limit;
SegAttr tss_attr = 0;