process.cc revision 2207
112863Sgabeblack@google.com/*
212863Sgabeblack@google.com * Copyright (c) 2003-2004 The Regents of The University of Michigan
312863Sgabeblack@google.com * All rights reserved.
412863Sgabeblack@google.com *
512863Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
612863Sgabeblack@google.com * modification, are permitted provided that the following conditions are
712863Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
812863Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
912863Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
1012863Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1112863Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1212863Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1312863Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1412863Sgabeblack@google.com * this software without specific prior written permission.
1512863Sgabeblack@google.com *
1612863Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1712863Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1812863Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1912863Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2012863Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2112863Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2212863Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2312863Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2412863Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2512863Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2612863Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2712863Sgabeblack@google.com */
2812863Sgabeblack@google.com
2912863Sgabeblack@google.com#include "arch/alpha/process.hh"
3012863Sgabeblack@google.com
3112863Sgabeblack@google.comnamespace AlphaISA
3212863Sgabeblack@google.com{
3312950Sgabeblack@google.com
3413035Sgabeblack@google.comLiveProcess *
3512982Sgabeblack@google.comcreateProcess(const std::string &nm, ObjectFile * objFile,
3613035Sgabeblack@google.com        int stdin_fd, int stdout_fd, int stderr_fd,
3713035Sgabeblack@google.com        std::vector<std::string> &argv, std::vector<std::string> &envp)
3812950Sgabeblack@google.com{
3912950Sgabeblack@google.com    LiveProcess * process = NULL;
4012950Sgabeblack@google.com    if (objFile->getArch() != ObjectFile::Alpha)
4112950Sgabeblack@google.com        fatal("Object file does not match architecture.");
4212950Sgabeblack@google.com    switch (objFile->getOpSys()) {
4312863Sgabeblack@google.com      case ObjectFile::Tru64:
4412863Sgabeblack@google.com        process = new AlphaTru64Process(nm, objFile,
4513035Sgabeblack@google.com                                        stdin_fd, stdout_fd, stderr_fd,
4613035Sgabeblack@google.com                                        argv, envp);
4713035Sgabeblack@google.com        break;
4813035Sgabeblack@google.com
4913035Sgabeblack@google.com      case ObjectFile::Linux:
5013035Sgabeblack@google.com        process = new AlphaLinuxProcess(nm, objFile,
5113035Sgabeblack@google.com                                        stdin_fd, stdout_fd, stderr_fd,
5213035Sgabeblack@google.com                                        argv, envp);
5313035Sgabeblack@google.com        break;
5413035Sgabeblack@google.com
5513035Sgabeblack@google.com      default:
5613035Sgabeblack@google.com        fatal("Unknown/unsupported operating system.");
5713035Sgabeblack@google.com    }
5813035Sgabeblack@google.com    return process;
5913035Sgabeblack@google.com}
6013035Sgabeblack@google.com
6113035Sgabeblack@google.com} // namespace AlphaISA
6212863Sgabeblack@google.com