1/* 2 * Copyright (c) 2014 Advanced Micro Devices, Inc. 3 * Copyright (c) 2007 The Hewlett-Packard Development Company 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 --- 742 unchanged lines hidden (view full) --- 751 if (argv.size() < 1) 752 filename = ""; 753 else 754 filename = argv[0]; 755 756 //We want 16 byte alignment 757 uint64_t align = 16; 758 |
759 // Patch the ld_bias for dynamic executables. 760 updateBias(); 761 |
762 // load object file into target memory 763 objFile->loadSections(initVirtMem); 764 765 enum X86CpuFeature { 766 X86_OnboardFPU = 1 << 0, 767 X86_VirtualModeExtensions = 1 << 1, 768 X86_DebuggingExtensions = 1 << 2, 769 X86_PageSizeExtensions = 1 << 3, --- 26 unchanged lines hidden (view full) --- 796 X86_StreamingSIMDExtensions2 = 1 << 26, 797 X86_CPUSelfSnoop = 1 << 27, 798 799 X86_HyperThreading = 1 << 28, 800 X86_AutomaticClockControl = 1 << 29, 801 X86_IA64Processor = 1 << 30 802 }; 803 |
804 // Setup the auxiliary vectors. These will already have endian 805 // conversion. Auxiliary vectors are loaded only for elf formatted 806 // executables; the auxv is responsible for passing information from 807 // the OS to the interpreter. |
808 ElfObject * elfObject = dynamic_cast<ElfObject *>(objFile); 809 if (elfObject) { 810 uint64_t features = 811 X86_OnboardFPU | 812 X86_VirtualModeExtensions | 813 X86_DebuggingExtensions | 814 X86_PageSizeExtensions | 815 X86_TimeStampCounter | --- 26 unchanged lines hidden (view full) --- 842 //Bits which describe the system hardware capabilities 843 //XXX Figure out what these should be 844 auxv.push_back(auxv_t(M5_AT_HWCAP, features)); 845 //The system page size 846 auxv.push_back(auxv_t(M5_AT_PAGESZ, X86ISA::PageBytes)); 847 //Frequency at which times() increments 848 //Defined to be 100 in the kernel source. 849 auxv.push_back(auxv_t(M5_AT_CLKTCK, 100)); |
850 // This is the virtual address of the program header tables if they 851 // appear in the executable image. |
852 auxv.push_back(auxv_t(M5_AT_PHDR, elfObject->programHeaderTable())); 853 // This is the size of a program header entry from the elf file. 854 auxv.push_back(auxv_t(M5_AT_PHENT, elfObject->programHeaderSize())); 855 // This is the number of program headers from the original elf file. 856 auxv.push_back(auxv_t(M5_AT_PHNUM, elfObject->programHeaderCount())); |
857 // This is the base address of the ELF interpreter; it should be 858 // zero for static executables or contain the base address for 859 // dynamic executables. 860 auxv.push_back(auxv_t(M5_AT_BASE, getBias())); |
861 //XXX Figure out what this should be. 862 auxv.push_back(auxv_t(M5_AT_FLAGS, 0)); 863 //The entry point to the program 864 auxv.push_back(auxv_t(M5_AT_ENTRY, objFile->entryPoint())); 865 //Different user and group IDs 866 auxv.push_back(auxv_t(M5_AT_UID, uid())); 867 auxv.push_back(auxv_t(M5_AT_EUID, euid())); 868 auxv.push_back(auxv_t(M5_AT_GID, gid())); --- 144 unchanged lines hidden (view full) --- 1013 initVirtMem.writeBlob(argc_base, (uint8_t*)&guestArgc, intSize); 1014 1015 ThreadContext *tc = system->getThreadContext(contextIds[0]); 1016 //Set the stack pointer register 1017 tc->setIntReg(StackPointerReg, stack_min); 1018 1019 // There doesn't need to be any segment base added in since we're dealing 1020 // with the flat segmentation model. |
1021 tc->pcState(getStartPC()); |
1022 1023 //Align the "stack_min" to a page boundary. 1024 stack_min = roundDown(stack_min, pageSize); 1025 1026// num_processes++; 1027} 1028 1029void --- 64 unchanged lines hidden --- |