50 #include "params/X86System.hh" 55 System(p), smbiosTable(p->smbios_table),
56 mpFloatingPointer(p->intel_mp_pointer),
57 mpConfigTable(p->intel_mp_table),
58 rsdp(p->acpi_description_table_pointer)
64 SegDescriptor desc,
bool longmode)
75 attr.defaultSize = desc.d;
76 attr.longMode = desc.l;
78 attr.granularity = desc.g;
79 attr.present = desc.p;
81 attr.type = desc.type;
83 if (desc.type.codeOrData) {
86 attr.readable = desc.type.r;
90 attr.expandDown = desc.type.e;
92 attr.writable = desc.type.w;
114 if (tc->contextId() == 0) {
125 fatal(
"No kernel to load.\n");
128 fatal(
"Loading a 32 bit x86 kernel is not supported.\n");
139 const int NumPDTs = 4;
141 const Addr PageMapLevel4 = 0x70000;
142 const Addr PageDirPtrTable = 0x71000;
143 const Addr PageDirTable[NumPDTs] =
144 {0x72000, 0x73000, 0x74000, 0x75000};
145 const Addr GDTBase = 0x76000;
147 const int PML4Bits = 9;
148 const int PDPTBits = 9;
149 const int PDTBits = 9;
154 uint8_t numGDTEntries = 0;
156 uint64_t nullDescriptor = 0;
160 SegDescriptor initDesc = 0;
161 initDesc.type.codeOrData = 0;
170 initDesc.limit = 0xFFFFFFFF;
174 SegDescriptor csDesc = initDesc;
175 csDesc.type.codeOrData = 1;
181 uint64_t csDescVal = csDesc;
187 cs.si = numGDTEntries - 1;
192 SegDescriptor dsDesc = initDesc;
193 uint64_t dsDescVal = dsDesc;
199 ds.si = numGDTEntries - 1;
211 SegDescriptor tssDesc = initDesc;
212 uint64_t tssDescVal = tssDesc;
218 tss.si = numGDTEntries - 1;
240 uint64_t pml4e = htole<uint64_t>(0x6);
245 pml4e = htole<uint64_t>(0x7 | PageDirPtrTable);
251 uint64_t pdpe = htole<uint64_t>(0x6);
252 for (
int offset = 0; offset < (1 << PDPTBits) * 8; offset += 8)
255 for (
int table = 0; table < NumPDTs; table++) {
256 pdpe = htole<uint64_t>(0x7 | PageDirTable[table]);
263 const Addr pageSize = 2 << 20;
264 for (
int table = 0; table < NumPDTs; table++) {
265 for (
int offset = 0; offset < (1 << PDTBits) * 8; offset += 8) {
267 uint64_t pdte =
htole(0x87 | base);
313 Addr ebdaPos = 0xF0000;
318 ebdaPos += (fixed + table);
319 ebdaPos =
roundUp(ebdaPos, 16);
323 ebdaPos += (fixed + table);
333 table = header + 0x1F;
340 assert(header > table || header + headerSize <= table);
341 assert(table > header || table + structSize <= header);
365 assert(fp > table || fp + fpSize <= table);
366 assert(table > fp || table + tableSize <= fp);
367 assert(fpSize == 0x10);
377 X86SystemParams::create()
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
virtual System * getSystemPtr()=0
void installSegDesc(ThreadContext *tc, SegmentRegIndex seg, SegDescriptor desc, bool longmode)
#define fatal(...)
This implements a cprintf based fatal() function.
void writeOut(PortProxy &proxy, Addr addr, Addr &headerSize, Addr &structSize)
void invoke(ThreadContext *tc, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr)
virtual TheISA::PCState pcState() const =0
Addr writeOut(PortProxy &proxy, Addr addr)
X86ISA::IntelMP::ConfigTable * mpConfigTable
T roundUp(const T &val, const U &align)
This function is used to align addresses in memory.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
PortProxy physProxy
Port to physical memory used for writing object files into ram at boot.
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
void writeOutSMBiosTable(Addr header, Addr &headerSize, Addr &tableSize, Addr table=0)
void setTableAddr(Addr addr)
static MiscRegIndex MISCREG_SEG_ATTR(int index)
void initState()
Serialization stuff.
static MiscRegIndex MISCREG_SEG_LIMIT(int index)
void writeBlob(Addr addr, const void *p, int size) const
Same as tryWriteBlob, but insists on success.
Addr writeOut(PortProxy &proxy, Addr addr)
std::vector< ThreadContext * > threadContexts
Addr kernelEntry
Entry point in the kernel to start at.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
X86ISA::SMBios::SMBiosTable * smbiosTable
ObjectFile * kernel
Object pointer for the kernel code.
void setTableAddr(Addr addr)
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
static MiscRegIndex MISCREG_SEG_BASE(int index)
This is exposed globally, independent of the ISA.
static MiscRegIndex MISCREG_SEG_EFF_BASE(int index)
X86ISA::IntelMP::FloatingPointer * mpFloatingPointer
void writeOutMPTable(Addr fp, Addr &fpSize, Addr &tableSize, Addr table=0)