process.cc revision 2458
111106Spower.jg@gmail.com/* 211106Spower.jg@gmail.com * Copyright (c) 2003-2004 The Regents of The University of Michigan 311680SCurtis.Dunham@arm.com * All rights reserved. 411680SCurtis.Dunham@arm.com * 511680SCurtis.Dunham@arm.com * Redistribution and use in source and binary forms, with or without 611106Spower.jg@gmail.com * modification, are permitted provided that the following conditions are 711687Sandreas.hansson@arm.com * met: redistributions of source code must retain the above copyright 811687Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer; 911687Sandreas.hansson@arm.com * redistributions in binary form must reproduce the above copyright 1011687Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer in the 1111687Sandreas.hansson@arm.com * documentation and/or other materials provided with the distribution; 1211390Ssteve.reinhardt@amd.com * neither the name of the copyright holders nor the names of its 1311390Ssteve.reinhardt@amd.com * contributors may be used to endorse or promote products derived from 1411106Spower.jg@gmail.com * this software without specific prior written permission. 1511106Spower.jg@gmail.com * 1611680SCurtis.Dunham@arm.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1711390Ssteve.reinhardt@amd.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1811390Ssteve.reinhardt@amd.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1911390Ssteve.reinhardt@amd.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2011390Ssteve.reinhardt@amd.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2111390Ssteve.reinhardt@amd.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2211106Spower.jg@gmail.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2311106Spower.jg@gmail.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2411390Ssteve.reinhardt@amd.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2511390Ssteve.reinhardt@amd.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2611390Ssteve.reinhardt@amd.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2711106Spower.jg@gmail.com */ 2811106Spower.jg@gmail.com 2911680SCurtis.Dunham@arm.com#include "arch/alpha/process.hh" 3011680SCurtis.Dunham@arm.com#include "arch/alpha/linux/process.hh" 3111680SCurtis.Dunham@arm.com#include "arch/alpha/tru64/process.hh" 3211680SCurtis.Dunham@arm.com#include "base/loader/object_file.hh" 3311680SCurtis.Dunham@arm.com#include "base/misc.hh" 3411680SCurtis.Dunham@arm.com 3511680SCurtis.Dunham@arm.comnamespace AlphaISA 3611680SCurtis.Dunham@arm.com{ 3711680SCurtis.Dunham@arm.com 3811680SCurtis.Dunham@arm.comLiveProcess * 3911390Ssteve.reinhardt@amd.comcreateProcess(const std::string &nm, ObjectFile * objFile, System *system, 4011106Spower.jg@gmail.com int stdin_fd, int stdout_fd, int stderr_fd, 4111390Ssteve.reinhardt@amd.com std::vector<std::string> &argv, std::vector<std::string> &envp) 4211106Spower.jg@gmail.com{ 4311680SCurtis.Dunham@arm.com LiveProcess * process = NULL; 4411680SCurtis.Dunham@arm.com if (objFile->getArch() != ObjectFile::Alpha) 4511106Spower.jg@gmail.com fatal("Object file does not match architecture."); 4611390Ssteve.reinhardt@amd.com switch (objFile->getOpSys()) { 4711106Spower.jg@gmail.com case ObjectFile::Tru64: 4811680SCurtis.Dunham@arm.com process = new AlphaTru64Process(nm, objFile, system, 4911680SCurtis.Dunham@arm.com stdin_fd, stdout_fd, stderr_fd, 5011106Spower.jg@gmail.com argv, envp); 5111106Spower.jg@gmail.com break; 5211106Spower.jg@gmail.com 5311106Spower.jg@gmail.com case ObjectFile::Linux: 5411106Spower.jg@gmail.com process = new AlphaLinuxProcess(nm, objFile, system, 5511106Spower.jg@gmail.com stdin_fd, stdout_fd, stderr_fd, 5611106Spower.jg@gmail.com argv, envp); 5711106Spower.jg@gmail.com break; 5811680SCurtis.Dunham@arm.com 5911106Spower.jg@gmail.com default: 6011390Ssteve.reinhardt@amd.com fatal("Unknown/unsupported operating system."); 6111106Spower.jg@gmail.com } 6211606Sandreas.sandberg@arm.com return process; 6311106Spower.jg@gmail.com} 6411390Ssteve.reinhardt@amd.com 6511680SCurtis.Dunham@arm.com} // namespace AlphaISA 6611606Sandreas.sandberg@arm.com