system.cc (12484:be3fa5e27fb5) | system.cc (12588:c007da6c777a) |
---|---|
1/* 2 * Copyright (c) 2007 The Hewlett-Packard Development Company 3 * Copyright (c) 2018 TU Dresden 4 * All rights reserved. 5 * 6 * The license below extends only to copyright in the software and shall 7 * not be construed as granting a license to any other intellectual 8 * property including but not limited to intellectual property relating --- 49 unchanged lines hidden (view full) --- 58 rsdp(p->acpi_description_table_pointer) 59{ 60} 61 62void 63X86ISA::installSegDesc(ThreadContext *tc, SegmentRegIndex seg, 64 SegDescriptor desc, bool longmode) 65{ | 1/* 2 * Copyright (c) 2007 The Hewlett-Packard Development Company 3 * Copyright (c) 2018 TU Dresden 4 * All rights reserved. 5 * 6 * The license below extends only to copyright in the software and shall 7 * not be construed as granting a license to any other intellectual 8 * property including but not limited to intellectual property relating --- 49 unchanged lines hidden (view full) --- 58 rsdp(p->acpi_description_table_pointer) 59{ 60} 61 62void 63X86ISA::installSegDesc(ThreadContext *tc, SegmentRegIndex seg, 64 SegDescriptor desc, bool longmode) 65{ |
66 uint64_t base = desc.baseLow + (desc.baseHigh << 24); | |
67 bool honorBase = !longmode || seg == SEGMENT_REG_FS || 68 seg == SEGMENT_REG_GS || 69 seg == SEGMENT_REG_TSL || 70 seg == SYS_SEGMENT_REG_TR; | 66 bool honorBase = !longmode || seg == SEGMENT_REG_FS || 67 seg == SEGMENT_REG_GS || 68 seg == SEGMENT_REG_TSL || 69 seg == SYS_SEGMENT_REG_TR; |
71 uint64_t limit = desc.limitLow | (desc.limitHigh << 16); 72 if (desc.g) 73 limit = (limit << 12) | mask(12); | |
74 75 SegAttr attr = 0; 76 77 attr.dpl = desc.dpl; 78 attr.unusable = 0; 79 attr.defaultSize = desc.d; 80 attr.longMode = desc.l; 81 attr.avl = desc.avl; --- 14 unchanged lines hidden (view full) --- 96 attr.writable = desc.type.w; 97 } 98 } else { 99 attr.readable = 1; 100 attr.writable = 1; 101 attr.expandDown = 0; 102 } 103 | 70 71 SegAttr attr = 0; 72 73 attr.dpl = desc.dpl; 74 attr.unusable = 0; 75 attr.defaultSize = desc.d; 76 attr.longMode = desc.l; 77 attr.avl = desc.avl; --- 14 unchanged lines hidden (view full) --- 92 attr.writable = desc.type.w; 93 } 94 } else { 95 attr.readable = 1; 96 attr.writable = 1; 97 attr.expandDown = 0; 98 } 99 |
104 tc->setMiscReg(MISCREG_SEG_BASE(seg), base); 105 tc->setMiscReg(MISCREG_SEG_EFF_BASE(seg), honorBase ? base : 0); 106 tc->setMiscReg(MISCREG_SEG_LIMIT(seg), limit); | 100 tc->setMiscReg(MISCREG_SEG_BASE(seg), desc.base); 101 tc->setMiscReg(MISCREG_SEG_EFF_BASE(seg), honorBase ? desc.base : 0); 102 tc->setMiscReg(MISCREG_SEG_LIMIT(seg), desc.limit); |
107 tc->setMiscReg(MISCREG_SEG_ATTR(seg), (MiscReg)attr); 108} 109 110void 111X86System::initState() 112{ 113 System::initState(); 114 --- 39 unchanged lines hidden (view full) --- 154 initDesc.type.c = 0; // conforming 155 initDesc.type.r = 1; // readable 156 initDesc.dpl = 0; // privilege 157 initDesc.p = 1; // present 158 initDesc.l = 1; // longmode - 64 bit 159 initDesc.d = 0; // operand size 160 initDesc.g = 1; // granularity 161 initDesc.s = 1; // system segment | 103 tc->setMiscReg(MISCREG_SEG_ATTR(seg), (MiscReg)attr); 104} 105 106void 107X86System::initState() 108{ 109 System::initState(); 110 --- 39 unchanged lines hidden (view full) --- 150 initDesc.type.c = 0; // conforming 151 initDesc.type.r = 1; // readable 152 initDesc.dpl = 0; // privilege 153 initDesc.p = 1; // present 154 initDesc.l = 1; // longmode - 64 bit 155 initDesc.d = 0; // operand size 156 initDesc.g = 1; // granularity 157 initDesc.s = 1; // system segment |
162 initDesc.limitHigh = 0xF; 163 initDesc.limitLow = 0xFFFF; 164 initDesc.baseHigh = 0x0; 165 initDesc.baseLow = 0x0; | 158 initDesc.limit = 0xFFFFFFFF; 159 initDesc.base = 0; |
166 167 // 64 bit code segment 168 SegDescriptor csDesc = initDesc; 169 csDesc.type.codeOrData = 1; 170 csDesc.dpl = 0; 171 // Because we're dealing with a pointer and I don't think it's 172 // guaranteed that there isn't anything in a nonvirtual class between 173 // it's beginning in memory and it's actual data, we'll use an --- 208 unchanged lines hidden --- | 160 161 // 64 bit code segment 162 SegDescriptor csDesc = initDesc; 163 csDesc.type.codeOrData = 1; 164 csDesc.dpl = 0; 165 // Because we're dealing with a pointer and I don't think it's 166 // guaranteed that there isn't anything in a nonvirtual class between 167 // it's beginning in memory and it's actual data, we'll use an --- 208 unchanged lines hidden --- |