process.cc (11387:8eeee90c69a8) process.cc (11389:1e55f16160cb)
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
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
759 // load object file into target memory
760 objFile->loadSections(initVirtMem);
761
762 enum X86CpuFeature {
763 X86_OnboardFPU = 1 << 0,
764 X86_VirtualModeExtensions = 1 << 1,
765 X86_DebuggingExtensions = 1 << 2,
766 X86_PageSizeExtensions = 1 << 3,

--- 26 unchanged lines hidden (view full) ---

793 X86_StreamingSIMDExtensions2 = 1 << 26,
794 X86_CPUSelfSnoop = 1 << 27,
795
796 X86_HyperThreading = 1 << 28,
797 X86_AutomaticClockControl = 1 << 29,
798 X86_IA64Processor = 1 << 30
799 };
800
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
801 // Setup the auxilliary vectors. These will already have endian conversion.
802 // Auxilliary vectors are loaded only for elf formatted executables.
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.
803 ElfObject * elfObject = dynamic_cast<ElfObject *>(objFile);
804 if (elfObject) {
805 uint64_t features =
806 X86_OnboardFPU |
807 X86_VirtualModeExtensions |
808 X86_DebuggingExtensions |
809 X86_PageSizeExtensions |
810 X86_TimeStampCounter |

--- 26 unchanged lines hidden (view full) ---

837 //Bits which describe the system hardware capabilities
838 //XXX Figure out what these should be
839 auxv.push_back(auxv_t(M5_AT_HWCAP, features));
840 //The system page size
841 auxv.push_back(auxv_t(M5_AT_PAGESZ, X86ISA::PageBytes));
842 //Frequency at which times() increments
843 //Defined to be 100 in the kernel source.
844 auxv.push_back(auxv_t(M5_AT_CLKTCK, 100));
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));
845 // For statically linked executables, this is the virtual address of the
846 // program header tables if they appear in the executable image
850 // This is the virtual address of the program header tables if they
851 // appear in the executable image.
847 auxv.push_back(auxv_t(M5_AT_PHDR, elfObject->programHeaderTable()));
848 // This is the size of a program header entry from the elf file.
849 auxv.push_back(auxv_t(M5_AT_PHENT, elfObject->programHeaderSize()));
850 // This is the number of program headers from the original elf file.
851 auxv.push_back(auxv_t(M5_AT_PHNUM, elfObject->programHeaderCount()));
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()));
852 //This is the address of the elf "interpreter", It should be set
853 //to 0 for regular executables. It should be something else
854 //(not sure what) for dynamic libraries.
855 auxv.push_back(auxv_t(M5_AT_BASE, 0));
856
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()));
857 //XXX Figure out what this should be.
858 auxv.push_back(auxv_t(M5_AT_FLAGS, 0));
859 //The entry point to the program
860 auxv.push_back(auxv_t(M5_AT_ENTRY, objFile->entryPoint()));
861 //Different user and group IDs
862 auxv.push_back(auxv_t(M5_AT_UID, uid()));
863 auxv.push_back(auxv_t(M5_AT_EUID, euid()));
864 auxv.push_back(auxv_t(M5_AT_GID, gid()));

--- 144 unchanged lines hidden (view full) ---

1009 initVirtMem.writeBlob(argc_base, (uint8_t*)&guestArgc, intSize);
1010
1011 ThreadContext *tc = system->getThreadContext(contextIds[0]);
1012 //Set the stack pointer register
1013 tc->setIntReg(StackPointerReg, stack_min);
1014
1015 // There doesn't need to be any segment base added in since we're dealing
1016 // with the flat segmentation model.
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.
1017 tc->pcState(objFile->entryPoint());
1021 tc->pcState(getStartPC());
1018
1019 //Align the "stack_min" to a page boundary.
1020 stack_min = roundDown(stack_min, pageSize);
1021
1022// num_processes++;
1023}
1024
1025void

--- 64 unchanged lines hidden ---
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 ---