47 #include "params/X86FsWorkload.hh"
54 smbiosTable(
p.smbios_table),
55 mpFloatingPointer(
p.intel_mp_pointer),
56 mpConfigTable(
p.intel_mp_table),
57 rsdp(
p.acpi_description_table_pointer)
62 SegDescriptor desc,
bool longmode)
73 attr.defaultSize = desc.d;
74 attr.longMode = desc.l;
76 attr.granularity = desc.g;
77 attr.present = desc.p;
79 attr.type = desc.type;
81 if (desc.type.codeOrData) {
84 attr.readable = desc.type.r;
88 attr.expandDown = desc.type.e;
90 attr.writable = desc.type.w;
112 if (tc->contextId() == 0) {
125 "Loading a 32 bit x86 kernel is not supported.");
138 const int NumPDTs = 4;
140 const Addr PageMapLevel4 = 0x70000;
141 const Addr PageDirPtrTable = 0x71000;
142 const Addr PageDirTable[NumPDTs] =
143 {0x72000, 0x73000, 0x74000, 0x75000};
144 const Addr GDTBase = 0x76000;
146 const int PML4Bits = 9;
147 const int PDPTBits = 9;
148 const int PDTBits = 9;
153 uint8_t numGDTEntries = 0;
155 uint64_t nullDescriptor = 0;
156 phys_proxy.
writeBlob(GDTBase + numGDTEntries * 8, &nullDescriptor, 8);
159 SegDescriptor initDesc = 0;
160 initDesc.type.codeOrData = 0;
169 initDesc.limit = 0xFFFFFFFF;
173 SegDescriptor csDesc = initDesc;
174 csDesc.type.codeOrData = 1;
180 uint64_t csDescVal = csDesc;
181 phys_proxy.writeBlob(GDTBase + numGDTEntries * 8, (&csDescVal), 8);
186 cs.si = numGDTEntries - 1;
191 SegDescriptor dsDesc = initDesc;
198 uint64_t dsDescVal = dsDesc;
199 phys_proxy.writeBlob(GDTBase + numGDTEntries * 8, (&dsDescVal), 8);
204 ds.si = numGDTEntries - 1;
214 ldtAttr.unusable = 1;
219 SegDescriptor tssDesc = initDesc;
223 uint64_t tssDescVal = tssDesc;
224 phys_proxy.writeBlob(GDTBase + numGDTEntries * 8, (&tssDescVal), 8);
229 tss.si = numGDTEntries - 1;
251 uint64_t pml4e = htole<uint64_t>(0x6);
253 phys_proxy.writeBlob(PageMapLevel4 +
offset, (&pml4e), 8);
255 pml4e = htole<uint64_t>(0x7 | PageDirPtrTable);
256 phys_proxy.writeBlob(PageMapLevel4, (&pml4e), 8);
261 uint64_t pdpe = htole<uint64_t>(0x6);
263 phys_proxy.writeBlob(PageDirPtrTable +
offset, &pdpe, 8);
265 for (
int table = 0; table < NumPDTs; table++) {
266 pdpe = htole<uint64_t>(0x7 | PageDirTable[table]);
267 phys_proxy.writeBlob(PageDirPtrTable + table * 8, &pdpe, 8);
273 const Addr pageSize = 2 << 20;
274 for (
int table = 0; table < NumPDTs; table++) {
278 phys_proxy.writeBlob(PageDirTable[table] +
offset, &pdte, 8);
323 Addr ebdaPos = 0xF0000;
328 ebdaPos += (fixed + table);
329 ebdaPos =
roundUp(ebdaPos, 16);
333 ebdaPos += (fixed + table);
374 assert(
fp > table ||
fp + fpSize <= table);
375 assert(table >
fp || table + tableSize <=
fp);
376 assert(fpSize == 0x10);