47 #include "debug/ACPI.hh"
48 #include "params/X86FsWorkload.hh"
58 smbiosTable(
p.smbios_table),
59 mpFloatingPointer(
p.intel_mp_pointer),
60 mpConfigTable(
p.intel_mp_table),
61 rsdp(
p.acpi_description_table_pointer)
66 SegDescriptor desc,
bool longmode)
77 attr.defaultSize = desc.d;
78 attr.longMode = desc.l;
80 attr.granularity = desc.g;
81 attr.present = desc.p;
83 attr.type = desc.type;
85 if (desc.type.codeOrData) {
88 attr.readable = desc.type.r;
92 attr.expandDown = desc.type.e;
94 attr.writable = desc.type.w;
116 if (tc->contextId() == 0) {
129 "Loading a 32 bit x86 kernel is not supported.");
142 const int NumPDTs = 4;
144 const Addr PageMapLevel4 = 0x70000;
145 const Addr PageDirPtrTable = 0x71000;
146 const Addr PageDirTable[NumPDTs] =
147 {0x72000, 0x73000, 0x74000, 0x75000};
148 const Addr GDTBase = 0x76000;
150 const int PML4Bits = 9;
151 const int PDPTBits = 9;
152 const int PDTBits = 9;
157 uint8_t numGDTEntries = 0;
159 uint64_t nullDescriptor = 0;
160 phys_proxy.
writeBlob(GDTBase + numGDTEntries * 8, &nullDescriptor, 8);
163 SegDescriptor initDesc = 0;
164 initDesc.type.codeOrData = 0;
173 initDesc.limit = 0xFFFFFFFF;
177 SegDescriptor csDesc = initDesc;
178 csDesc.type.codeOrData = 1;
184 uint64_t csDescVal = csDesc;
185 phys_proxy.writeBlob(GDTBase + numGDTEntries * 8, (&csDescVal), 8);
190 cs.si = numGDTEntries - 1;
195 SegDescriptor dsDesc = initDesc;
202 uint64_t dsDescVal = dsDesc;
203 phys_proxy.writeBlob(GDTBase + numGDTEntries * 8, (&dsDescVal), 8);
208 ds.si = numGDTEntries - 1;
218 ldtAttr.unusable = 1;
223 SegDescriptor tssDesc = initDesc;
227 uint64_t tssDescVal = tssDesc;
228 phys_proxy.writeBlob(GDTBase + numGDTEntries * 8, (&tssDescVal), 8);
233 tss.si = numGDTEntries - 1;
255 uint64_t pml4e = htole<uint64_t>(0x6);
257 phys_proxy.writeBlob(PageMapLevel4 +
offset, (&pml4e), 8);
259 pml4e = htole<uint64_t>(0x7 | PageDirPtrTable);
260 phys_proxy.writeBlob(PageMapLevel4, (&pml4e), 8);
265 uint64_t pdpe = htole<uint64_t>(0x6);
267 phys_proxy.writeBlob(PageDirPtrTable +
offset, &pdpe, 8);
269 for (
int table = 0; table < NumPDTs; table++) {
270 pdpe = htole<uint64_t>(0x7 | PageDirTable[table]);
271 phys_proxy.writeBlob(PageDirPtrTable + table * 8, &pdpe, 8);
277 const Addr pageSize = 2 << 20;
278 for (
int table = 0; table < NumPDTs; table++) {
282 phys_proxy.writeBlob(PageDirTable[table] +
offset, &pdte, 8);
327 Addr ebdaPos = 0xF0000;
332 ebdaPos += (fixed + table);
333 ebdaPos =
roundUp(ebdaPos, 16);
337 ebdaPos += (fixed + table);
382 assert(
fp > table ||
fp + fpSize <= table);
383 assert(table >
fp || table + tableSize <=
fp);
384 assert(fpSize == 0x10);
394 fpSize = alloc.
alloc(0, 0) -
fp;
395 DPRINTF(ACPI,
"Wrote ACPI tables to memory at %llx with size %llx.\n",