128c128
< stack_base = (Addr)0x7FFFFFFF000ULL;
---
> stack_base = (Addr)0x7FFFFFFFF000ULL;
169c169,170
< Addr alignmentMask = ~(intSize - 1);
---
> //We want 16 byte alignment
> Addr alignmentMask = ~mask(4);
174,194c175,179
< //These are the auxilliary vector types
< enum auxTypes
< {
< X86_AT_NULL = 0,
< X86_AT_IGNORE = 1,
< X86_AT_EXECFD = 2,
< X86_AT_PHDR = 3,
< X86_AT_PHENT = 4,
< X86_AT_PHNUM = 5,
< X86_AT_PAGESZ = 6,
< X86_AT_BASE = 7,
< X86_AT_FLAGS = 8,
< X86_AT_ENTRY = 9,
< X86_AT_NOTELF = 10,
< X86_AT_UID = 11,
< X86_AT_EUID = 12,
< X86_AT_GID = 13,
< X86_AT_EGID = 14,
< X86_AT_PLATFORM = 15,
< X86_AT_HWCAP = 16,
< X86_AT_CLKTCK = 17,
---
> enum X86CpuFeature {
> X86_OnboardFPU = 1 << 0,
> X86_VirtualModeExtensions = 1 << 1,
> X86_DebuggingExtensions = 1 << 2,
> X86_PageSizeExtensions = 1 << 3,
196c181,184
< X86_AT_SECURE = 13,
---
> X86_TimeStampCounter = 1 << 4,
> X86_ModelSpecificRegisters = 1 << 5,
> X86_PhysicalAddressExtensions = 1 << 6,
> X86_MachineCheckExtensions = 1 << 7,
198c186,211
< X86_AT_VECTOR_SIZE = 44
---
> X86_CMPXCHG8Instruction = 1 << 8,
> X86_OnboardAPIC = 1 << 9,
> X86_SYSENTER_SYSEXIT = 1 << 11,
>
> X86_MemoryTypeRangeRegisters = 1 << 12,
> X86_PageGlobalEnable = 1 << 13,
> X86_MachineCheckArchitecture = 1 << 14,
> X86_CMOVInstruction = 1 << 15,
>
> X86_PageAttributeTable = 1 << 16,
> X86_36BitPSEs = 1 << 17,
> X86_ProcessorSerialNumber = 1 << 18,
> X86_CLFLUSHInstruction = 1 << 19,
>
> X86_DebugTraceStore = 1 << 21,
> X86_ACPIViaMSR = 1 << 22,
> X86_MultimediaExtensions = 1 << 23,
>
> X86_FXSAVE_FXRSTOR = 1 << 24,
> X86_StreamingSIMDExtensions = 1 << 25,
> X86_StreamingSIMDExtensions2 = 1 << 26,
> X86_CPUSelfSnoop = 1 << 27,
>
> X86_HyperThreading = 1 << 28,
> X86_AutomaticClockControl = 1 << 29,
> X86_IA64Processor = 1 << 30
205a219,250
> uint64_t features =
> X86_OnboardFPU |
> X86_VirtualModeExtensions |
> X86_DebuggingExtensions |
> X86_PageSizeExtensions |
> X86_TimeStampCounter |
> X86_ModelSpecificRegisters |
> X86_PhysicalAddressExtensions |
> X86_MachineCheckExtensions |
> X86_CMPXCHG8Instruction |
> X86_OnboardAPIC |
> X86_SYSENTER_SYSEXIT |
> X86_MemoryTypeRangeRegisters |
> X86_PageGlobalEnable |
> X86_MachineCheckArchitecture |
> X86_CMOVInstruction |
> X86_PageAttributeTable |
> X86_36BitPSEs |
> // X86_ProcessorSerialNumber |
> X86_CLFLUSHInstruction |
> // X86_DebugTraceStore |
> // X86_ACPIViaMSR |
> X86_MultimediaExtensions |
> X86_FXSAVE_FXRSTOR |
> X86_StreamingSIMDExtensions |
> X86_StreamingSIMDExtensions2 |
> // X86_CPUSelfSnoop |
> // X86_HyperThreading |
> // X86_AutomaticClockControl |
> // X86_IA64Processor |
> 0;
>
208c253
< auxv.push_back(auxv_t(X86_AT_HWCAP, 0));
---
> auxv.push_back(auxv_t(M5_AT_HWCAP, features));
210c255
< auxv.push_back(auxv_t(X86_AT_PAGESZ, X86ISA::VMPageSize));
---
> auxv.push_back(auxv_t(M5_AT_PAGESZ, X86ISA::VMPageSize));
212c257
< auxv.push_back(auxv_t(X86_AT_CLKTCK, 100));
---
> auxv.push_back(auxv_t(M5_AT_CLKTCK, 100));
215c260
< auxv.push_back(auxv_t(X86_AT_PHDR, elfObject->programHeaderTable()));
---
> auxv.push_back(auxv_t(M5_AT_PHDR, elfObject->programHeaderTable()));
217c262
< auxv.push_back(auxv_t(X86_AT_PHENT, elfObject->programHeaderSize()));
---
> auxv.push_back(auxv_t(M5_AT_PHENT, elfObject->programHeaderSize()));
219c264
< auxv.push_back(auxv_t(X86_AT_PHNUM, elfObject->programHeaderCount()));
---
> auxv.push_back(auxv_t(M5_AT_PHNUM, elfObject->programHeaderCount()));
224c269
< auxv.push_back(auxv_t(X86_AT_BASE, 0));
---
> auxv.push_back(auxv_t(M5_AT_BASE, 0));
227c272
< auxv.push_back(auxv_t(X86_AT_FLAGS, 0));
---
> auxv.push_back(auxv_t(M5_AT_FLAGS, 0));
229c274
< auxv.push_back(auxv_t(X86_AT_ENTRY, objFile->entryPoint()));
---
> auxv.push_back(auxv_t(M5_AT_ENTRY, objFile->entryPoint()));
231,234c276,279
< auxv.push_back(auxv_t(X86_AT_UID, uid()));
< auxv.push_back(auxv_t(X86_AT_EUID, euid()));
< auxv.push_back(auxv_t(X86_AT_GID, gid()));
< auxv.push_back(auxv_t(X86_AT_EGID, egid()));
---
> auxv.push_back(auxv_t(M5_AT_UID, uid()));
> auxv.push_back(auxv_t(M5_AT_EUID, euid()));
> auxv.push_back(auxv_t(M5_AT_GID, gid()));
> auxv.push_back(auxv_t(M5_AT_EGID, egid()));
236c281
< auxv.push_back(auxv_t(X86_AT_SECURE, 0));
---
> auxv.push_back(auxv_t(M5_AT_SECURE, 0));
238c283
< auxv.push_back(auxv_t(X86_AT_PLATFORM, 0));
---
> auxv.push_back(auxv_t(M5_AT_PLATFORM, 0));
248c293
< int file_name_size = filename.size() + 1;
---
> int file_name_size = filename.size();
249a295,297
> string platform = "x86_64";
> int aux_data_size = platform.size() + 1;
>
252c300
< env_data_size += envp[i].size() + 1;
---
> env_data_size += envp[i].size();
256c304
< arg_data_size += argv[i].size() + 1;
---
> arg_data_size += argv[i].size();
258a307,311
> //The auxiliary vector data needs to be padded so it's size is a multiple
> //of the alignment mask.
> int aux_padding =
> ((aux_data_size + ~alignmentMask) & alignmentMask) - aux_data_size;
>
264c317,318
< (file_name_size +
---
> (mysterious_size +
> file_name_size +
267c321
< intSize) & alignmentMask;
---
> ~alignmentMask) & alignmentMask;
270a325
> mysterious_size -
284d338
< mysterious_size +
285a340,341
> aux_data_size +
> aux_padding +
304c360,361
< Addr auxv_array_base = arg_data_base - aux_array_size - info_block_padding;
---
> Addr aux_data_base = arg_data_base - aux_data_size - info_block_padding;
> Addr auxv_array_base = aux_data_base - aux_array_size - aux_padding;
312a370
> DPRINTF(X86, "0x%x - aux data\n", aux_data_base);
332a391,394
> //Fix up the aux vector which points to the "platform" string
> assert(auxv[auxv.size() - 1].a_type = M5_AT_PLATFORM);
> auxv[auxv.size() - 1].a_val = aux_data_base;
>
345a408,409
> initVirtMem->writeString(aux_data_base, platform.c_str());
>
351a416,420
> //Because of the peculiarities of how syscall works, I believe
> //a process starts with r11 containing the value of eflags or maybe r11
> //from before the call to execve. Empirically this value is 0x200.
> threadContexts[0]->setIntReg(INTREG_R11, 0x200);
> //Set the stack pointer register