process.cc revision 5823
12SN/A/*
21762SN/A * Copyright (c) 2001-2005 The Regents of The University of Michigan
32SN/A * All rights reserved.
42SN/A *
52SN/A * Redistribution and use in source and binary forms, with or without
62SN/A * modification, are permitted provided that the following conditions are
72SN/A * met: redistributions of source code must retain the above copyright
82SN/A * notice, this list of conditions and the following disclaimer;
92SN/A * redistributions in binary form must reproduce the above copyright
102SN/A * notice, this list of conditions and the following disclaimer in the
112SN/A * documentation and/or other materials provided with the distribution;
122SN/A * neither the name of the copyright holders nor the names of its
132SN/A * contributors may be used to endorse or promote products derived from
142SN/A * this software without specific prior written permission.
152SN/A *
162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Nathan Binkert
292665Ssaidi@eecs.umich.edu *          Steve Reinhardt
302665Ssaidi@eecs.umich.edu *          Ali Saidi
312SN/A */
322SN/A
332SN/A#include <unistd.h>
342SN/A#include <fcntl.h>
352SN/A#include <string>
362SN/A
373971Sgblack@eecs.umich.edu#include "arch/remote_gdb.hh"
3856SN/A#include "base/intmath.hh"
3956SN/A#include "base/loader/object_file.hh"
401158SN/A#include "base/loader/symtab.hh"
41146SN/A#include "base/statistics.hh"
421858SN/A#include "config/full_system.hh"
432680Sktlim@umich.edu#include "cpu/thread_context.hh"
442378SN/A#include "mem/page_table.hh"
452522SN/A#include "mem/physical.hh"
462401SN/A#include "mem/translating_port.hh"
475154Sgblack@eecs.umich.edu#include "params/Process.hh"
484762Snate@binkert.org#include "params/LiveProcess.hh"
495512SMichael.Adler@intel.com#include "sim/debug.hh"
50360SN/A#include "sim/process.hh"
514434Ssaidi@eecs.umich.edu#include "sim/process_impl.hh"
52695SN/A#include "sim/stats.hh"
532093SN/A#include "sim/syscall_emul.hh"
542378SN/A#include "sim/system.hh"
552SN/A
562715Sstever@eecs.umich.edu#include "arch/isa_specific.hh"
572715Sstever@eecs.umich.edu#if THE_ISA == ALPHA_ISA
582715Sstever@eecs.umich.edu#include "arch/alpha/linux/process.hh"
592715Sstever@eecs.umich.edu#include "arch/alpha/tru64/process.hh"
602715Sstever@eecs.umich.edu#elif THE_ISA == SPARC_ISA
612715Sstever@eecs.umich.edu#include "arch/sparc/linux/process.hh"
622715Sstever@eecs.umich.edu#include "arch/sparc/solaris/process.hh"
632715Sstever@eecs.umich.edu#elif THE_ISA == MIPS_ISA
642715Sstever@eecs.umich.edu#include "arch/mips/linux/process.hh"
655335Shines@cs.fsu.edu#elif THE_ISA == ARM_ISA
665335Shines@cs.fsu.edu#include "arch/arm/linux/process.hh"
674157Sgblack@eecs.umich.edu#elif THE_ISA == X86_ISA
684166Sgblack@eecs.umich.edu#include "arch/x86/linux/process.hh"
692715Sstever@eecs.umich.edu#else
702715Sstever@eecs.umich.edu#error "THE_ISA not set"
712715Sstever@eecs.umich.edu#endif
722715Sstever@eecs.umich.edu
732715Sstever@eecs.umich.edu
742SN/Ausing namespace std;
752107SN/Ausing namespace TheISA;
762SN/A
772SN/A//
782SN/A// The purpose of this code is to fake the loader & syscall mechanism
792SN/A// when there's no OS: thus there's no resone to use it in FULL_SYSTEM
802SN/A// mode when we do have an OS
812SN/A//
821858SN/A#if FULL_SYSTEM
83360SN/A#error "process.cc not compatible with FULL_SYSTEM"
842SN/A#endif
852SN/A
862SN/A// current number of allocated processes
872SN/Aint num_processes = 0;
882SN/A
895758Shsul@eecs.umich.edutemplate<class IntType>
905771Shsul@eecs.umich.eduAuxVector<IntType>::AuxVector(IntType type, IntType val)
915758Shsul@eecs.umich.edu{
925758Shsul@eecs.umich.edu    a_type = TheISA::htog(type);
935758Shsul@eecs.umich.edu    a_val = TheISA::htog(val);
945758Shsul@eecs.umich.edu}
955758Shsul@eecs.umich.edu
965771Shsul@eecs.umich.edutemplate class AuxVector<uint32_t>;
975771Shsul@eecs.umich.edutemplate class AuxVector<uint64_t>;
985758Shsul@eecs.umich.edu
995154Sgblack@eecs.umich.eduProcess::Process(ProcessParams * params)
1005183Ssaidi@eecs.umich.edu    : SimObject(params), system(params->system), checkpointRestored(false),
1015154Sgblack@eecs.umich.edu    max_stack_size(params->max_stack_size)
1022SN/A{
1035154Sgblack@eecs.umich.edu    string in = params->input;
1045154Sgblack@eecs.umich.edu    string out = params->output;
1055514SMichael.Adler@intel.com    string err = params->errout;
1065154Sgblack@eecs.umich.edu
1075154Sgblack@eecs.umich.edu    // initialize file descriptors to default: same as simulator
1085154Sgblack@eecs.umich.edu    int stdin_fd, stdout_fd, stderr_fd;
1095154Sgblack@eecs.umich.edu
1105154Sgblack@eecs.umich.edu    if (in == "stdin" || in == "cin")
1115154Sgblack@eecs.umich.edu        stdin_fd = STDIN_FILENO;
1125154Sgblack@eecs.umich.edu    else if (in == "None")
1135154Sgblack@eecs.umich.edu        stdin_fd = -1;
1145154Sgblack@eecs.umich.edu    else
1155154Sgblack@eecs.umich.edu        stdin_fd = Process::openInputFile(in);
1165154Sgblack@eecs.umich.edu
1175154Sgblack@eecs.umich.edu    if (out == "stdout" || out == "cout")
1185154Sgblack@eecs.umich.edu        stdout_fd = STDOUT_FILENO;
1195154Sgblack@eecs.umich.edu    else if (out == "stderr" || out == "cerr")
1205154Sgblack@eecs.umich.edu        stdout_fd = STDERR_FILENO;
1215154Sgblack@eecs.umich.edu    else if (out == "None")
1225154Sgblack@eecs.umich.edu        stdout_fd = -1;
1235154Sgblack@eecs.umich.edu    else
1245154Sgblack@eecs.umich.edu        stdout_fd = Process::openOutputFile(out);
1255154Sgblack@eecs.umich.edu
1265514SMichael.Adler@intel.com    if (err == "stdout" || err == "cout")
1275514SMichael.Adler@intel.com        stderr_fd = STDOUT_FILENO;
1285514SMichael.Adler@intel.com    else if (err == "stderr" || err == "cerr")
1295514SMichael.Adler@intel.com        stderr_fd = STDERR_FILENO;
1305514SMichael.Adler@intel.com    else if (err == "None")
1315514SMichael.Adler@intel.com        stderr_fd = -1;
1325514SMichael.Adler@intel.com    else if (err == out)
1335514SMichael.Adler@intel.com        stderr_fd = stdout_fd;
1345514SMichael.Adler@intel.com    else
1355514SMichael.Adler@intel.com        stderr_fd = Process::openOutputFile(err);
1365154Sgblack@eecs.umich.edu
1374997Sgblack@eecs.umich.edu    M5_pid = system->allocatePID();
1382SN/A    // initialize first 3 fds (stdin, stdout, stderr)
1395282Srstrong@cs.ucsd.edu    Process::FdMap *fdo = &fd_map[STDIN_FILENO];
1405282Srstrong@cs.ucsd.edu    fdo->fd = stdin_fd;
1415282Srstrong@cs.ucsd.edu    fdo->filename = in;
1425282Srstrong@cs.ucsd.edu    fdo->flags = O_RDONLY;
1435282Srstrong@cs.ucsd.edu    fdo->mode = -1;
1445282Srstrong@cs.ucsd.edu    fdo->fileOffset = 0;
1455282Srstrong@cs.ucsd.edu
1465282Srstrong@cs.ucsd.edu    fdo =  &fd_map[STDOUT_FILENO];
1475282Srstrong@cs.ucsd.edu    fdo->fd = stdout_fd;
1485282Srstrong@cs.ucsd.edu    fdo->filename = out;
1495282Srstrong@cs.ucsd.edu    fdo->flags =  O_WRONLY | O_CREAT | O_TRUNC;
1505282Srstrong@cs.ucsd.edu    fdo->mode = 0774;
1515282Srstrong@cs.ucsd.edu    fdo->fileOffset = 0;
1525282Srstrong@cs.ucsd.edu
1535282Srstrong@cs.ucsd.edu    fdo = &fd_map[STDERR_FILENO];
1545282Srstrong@cs.ucsd.edu    fdo->fd = stderr_fd;
1555514SMichael.Adler@intel.com    fdo->filename = err;
1565282Srstrong@cs.ucsd.edu    fdo->flags = O_WRONLY;
1575282Srstrong@cs.ucsd.edu    fdo->mode = -1;
1585282Srstrong@cs.ucsd.edu    fdo->fileOffset = 0;
1595282Srstrong@cs.ucsd.edu
1602SN/A
1612SN/A    // mark remaining fds as free
1622SN/A    for (int i = 3; i <= MAX_FD; ++i) {
1635282Srstrong@cs.ucsd.edu        Process::FdMap *fdo = &fd_map[i];
1645282Srstrong@cs.ucsd.edu        fdo->fd = -1;
1652SN/A    }
1662SN/A
1671450SN/A    mmap_start = mmap_end = 0;
1681514SN/A    nxm_start = nxm_end = 0;
1695184Sgblack@eecs.umich.edu    pTable = new PageTable(this);
1702SN/A    // other parameters will be initialized when the program is loaded
1712SN/A}
1722SN/A
1732378SN/A
1742SN/Avoid
1752SN/AProcess::regStats()
1762SN/A{
177729SN/A    using namespace Stats;
1782SN/A
1792SN/A    num_syscalls
1802SN/A        .name(name() + ".PROG:num_syscalls")
1812SN/A        .desc("Number of system calls")
1822SN/A        ;
1832SN/A}
1842SN/A
1852SN/A//
1862SN/A// static helper functions
1872SN/A//
1882SN/Aint
1892SN/AProcess::openInputFile(const string &filename)
1902SN/A{
1912SN/A    int fd = open(filename.c_str(), O_RDONLY);
1922SN/A
1932SN/A    if (fd == -1) {
1942SN/A        perror(NULL);
1952SN/A        cerr << "unable to open \"" << filename << "\" for reading\n";
1962SN/A        fatal("can't open input file");
1972SN/A    }
1982SN/A
1992SN/A    return fd;
2002SN/A}
2012SN/A
2022SN/A
2032SN/Aint
2042SN/AProcess::openOutputFile(const string &filename)
2052SN/A{
2065514SMichael.Adler@intel.com    int fd = open(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0664);
2072SN/A
2082SN/A    if (fd == -1) {
2092SN/A        perror(NULL);
2102SN/A        cerr << "unable to open \"" << filename << "\" for writing\n";
2112SN/A        fatal("can't open output file");
2122SN/A    }
2132SN/A
2142SN/A    return fd;
2152SN/A}
2162SN/A
2175713Shsul@eecs.umich.eduThreadContext *
2185713Shsul@eecs.umich.eduProcess::findFreeContext()
2192SN/A{
2205713Shsul@eecs.umich.edu    int size = contextIds.size();
2215713Shsul@eecs.umich.edu    ThreadContext *tc;
2225713Shsul@eecs.umich.edu    for (int i = 0; i < size; ++i) {
2235713Shsul@eecs.umich.edu        tc = system->getThreadContext(contextIds[i]);
2245713Shsul@eecs.umich.edu        if (tc->status() == ThreadContext::Unallocated) {
2255713Shsul@eecs.umich.edu            // inactive context, free to use
2265713Shsul@eecs.umich.edu            return tc;
2275713Shsul@eecs.umich.edu        }
2285512SMichael.Adler@intel.com    }
2295713Shsul@eecs.umich.edu    return NULL;
2302SN/A}
2312SN/A
2321395SN/Avoid
2331395SN/AProcess::startup()
2341395SN/A{
2355713Shsul@eecs.umich.edu    if (contextIds.empty())
2365713Shsul@eecs.umich.edu        fatal("Process %s is not associated with any HW contexts!\n", name());
2372378SN/A
2382680Sktlim@umich.edu    // first thread context for this process... initialize & enable
2395713Shsul@eecs.umich.edu    ThreadContext *tc = system->getThreadContext(contextIds[0]);
2401395SN/A
2411634SN/A    // mark this context as active so it will start ticking.
2422680Sktlim@umich.edu    tc->activate(0);
2432462SN/A
2442519SN/A    Port *mem_port;
2452519SN/A    mem_port = system->physmem->getPort("functional");
2464434Ssaidi@eecs.umich.edu    initVirtMem = new TranslatingPort("process init port", this,
2474434Ssaidi@eecs.umich.edu            TranslatingPort::Always);
2482519SN/A    mem_port->setPeer(initVirtMem);
2492519SN/A    initVirtMem->setPeer(mem_port);
2501395SN/A}
2512SN/A
2522SN/A// map simulator fd sim_fd to target fd tgt_fd
2532SN/Avoid
2542SN/AProcess::dup_fd(int sim_fd, int tgt_fd)
2552SN/A{
2562SN/A    if (tgt_fd < 0 || tgt_fd > MAX_FD)
2572SN/A        panic("Process::dup_fd tried to dup past MAX_FD (%d)", tgt_fd);
2582SN/A
2595282Srstrong@cs.ucsd.edu    Process::FdMap *fdo = &fd_map[tgt_fd];
2605282Srstrong@cs.ucsd.edu    fdo->fd = sim_fd;
2612SN/A}
2622SN/A
2632SN/A
2642SN/A// generate new target fd for sim_fd
2652SN/Aint
2665282Srstrong@cs.ucsd.eduProcess::alloc_fd(int sim_fd, string filename, int flags, int mode, bool pipe)
2672SN/A{
2682SN/A    // in case open() returns an error, don't allocate a new fd
2692SN/A    if (sim_fd == -1)
2702SN/A        return -1;
2712SN/A
2722SN/A    // find first free target fd
2735282Srstrong@cs.ucsd.edu    for (int free_fd = 0; free_fd <= MAX_FD; ++free_fd) {
2745282Srstrong@cs.ucsd.edu        Process::FdMap *fdo = &fd_map[free_fd];
2755282Srstrong@cs.ucsd.edu        if (fdo->fd == -1) {
2765282Srstrong@cs.ucsd.edu            fdo->fd = sim_fd;
2775282Srstrong@cs.ucsd.edu            fdo->filename = filename;
2785282Srstrong@cs.ucsd.edu            fdo->mode = mode;
2795282Srstrong@cs.ucsd.edu            fdo->fileOffset = 0;
2805282Srstrong@cs.ucsd.edu            fdo->flags = flags;
2815282Srstrong@cs.ucsd.edu            fdo->isPipe = pipe;
2825282Srstrong@cs.ucsd.edu            fdo->readPipeSource = 0;
2831970SN/A            return free_fd;
2841970SN/A        }
2852SN/A    }
2862SN/A
2871970SN/A    panic("Process::alloc_fd: out of file descriptors!");
2881970SN/A}
2892SN/A
2901970SN/A
2911970SN/A// free target fd (e.g., after close)
2921970SN/Avoid
2931970SN/AProcess::free_fd(int tgt_fd)
2941970SN/A{
2955282Srstrong@cs.ucsd.edu    Process::FdMap *fdo = &fd_map[tgt_fd];
2965282Srstrong@cs.ucsd.edu    if (fdo->fd == -1)
2971970SN/A        warn("Process::free_fd: request to free unused fd %d", tgt_fd);
2981970SN/A
2995282Srstrong@cs.ucsd.edu    fdo->fd = -1;
3005282Srstrong@cs.ucsd.edu    fdo->filename = "NULL";
3015282Srstrong@cs.ucsd.edu    fdo->mode = 0;
3025282Srstrong@cs.ucsd.edu    fdo->fileOffset = 0;
3035282Srstrong@cs.ucsd.edu    fdo->flags = 0;
3045282Srstrong@cs.ucsd.edu    fdo->isPipe = false;
3055282Srstrong@cs.ucsd.edu    fdo->readPipeSource = 0;
3062SN/A}
3072SN/A
3082SN/A
3092SN/A// look up simulator fd for given target fd
3102SN/Aint
3112SN/AProcess::sim_fd(int tgt_fd)
3122SN/A{
3132SN/A    if (tgt_fd > MAX_FD)
3142SN/A        return -1;
3152SN/A
3165282Srstrong@cs.ucsd.edu    return fd_map[tgt_fd].fd;
3172SN/A}
3182SN/A
3195282Srstrong@cs.ucsd.eduProcess::FdMap *
3205282Srstrong@cs.ucsd.eduProcess::sim_fd_obj(int tgt_fd)
3215282Srstrong@cs.ucsd.edu{
3225282Srstrong@cs.ucsd.edu    if (tgt_fd > MAX_FD)
3235282Srstrong@cs.ucsd.edu        panic("sim_fd_obj called in fd out of range.");
3245282Srstrong@cs.ucsd.edu
3255282Srstrong@cs.ucsd.edu    return &fd_map[tgt_fd];
3265282Srstrong@cs.ucsd.edu}
3274434Ssaidi@eecs.umich.edubool
3284434Ssaidi@eecs.umich.eduProcess::checkAndAllocNextPage(Addr vaddr)
3294434Ssaidi@eecs.umich.edu{
3304434Ssaidi@eecs.umich.edu    // if this is an initial write we might not have
3314434Ssaidi@eecs.umich.edu    if (vaddr >= stack_min && vaddr < stack_base) {
3324434Ssaidi@eecs.umich.edu        pTable->allocate(roundDown(vaddr, VMPageSize), VMPageSize);
3334434Ssaidi@eecs.umich.edu        return true;
3344434Ssaidi@eecs.umich.edu    }
3354434Ssaidi@eecs.umich.edu
3364434Ssaidi@eecs.umich.edu    // We've accessed the next page of the stack, so extend the stack
3374434Ssaidi@eecs.umich.edu    // to cover it.
3385154Sgblack@eecs.umich.edu    if (vaddr < stack_min && vaddr >= stack_base - max_stack_size) {
3395154Sgblack@eecs.umich.edu        while (vaddr < stack_min) {
3405154Sgblack@eecs.umich.edu            stack_min -= TheISA::PageBytes;
3415154Sgblack@eecs.umich.edu            if(stack_base - stack_min > max_stack_size)
3425154Sgblack@eecs.umich.edu                fatal("Maximum stack size exceeded\n");
3435154Sgblack@eecs.umich.edu            if(stack_base - stack_min > 8*1024*1024)
3445154Sgblack@eecs.umich.edu                fatal("Over max stack size for one thread\n");
3455154Sgblack@eecs.umich.edu            pTable->allocate(stack_min, TheISA::PageBytes);
3465823Ssaidi@eecs.umich.edu            inform("Increasing stack size by one page.");
3475154Sgblack@eecs.umich.edu        };
3484434Ssaidi@eecs.umich.edu        return true;
3494434Ssaidi@eecs.umich.edu    }
3504434Ssaidi@eecs.umich.edu    return false;
3514434Ssaidi@eecs.umich.edu}
3524434Ssaidi@eecs.umich.edu
3535282Srstrong@cs.ucsd.edu // find all offsets for currently open files and save them
3545282Srstrong@cs.ucsd.eduvoid
3555282Srstrong@cs.ucsd.eduProcess::fix_file_offsets() {
3565282Srstrong@cs.ucsd.edu    Process::FdMap *fdo_stdin = &fd_map[STDIN_FILENO];
3575282Srstrong@cs.ucsd.edu    Process::FdMap *fdo_stdout = &fd_map[STDOUT_FILENO];
3585282Srstrong@cs.ucsd.edu    Process::FdMap *fdo_stderr = &fd_map[STDERR_FILENO];
3595282Srstrong@cs.ucsd.edu    string in = fdo_stdin->filename;
3605282Srstrong@cs.ucsd.edu    string out = fdo_stdout->filename;
3615514SMichael.Adler@intel.com    string err = fdo_stderr->filename;
3625282Srstrong@cs.ucsd.edu
3635282Srstrong@cs.ucsd.edu    // initialize file descriptors to default: same as simulator
3645282Srstrong@cs.ucsd.edu    int stdin_fd, stdout_fd, stderr_fd;
3655282Srstrong@cs.ucsd.edu
3665282Srstrong@cs.ucsd.edu    if (in == "stdin" || in == "cin")
3675282Srstrong@cs.ucsd.edu        stdin_fd = STDIN_FILENO;
3685282Srstrong@cs.ucsd.edu    else if (in == "None")
3695282Srstrong@cs.ucsd.edu        stdin_fd = -1;
3705282Srstrong@cs.ucsd.edu    else{
3715282Srstrong@cs.ucsd.edu        //OPEN standard in and seek to the right location
3725282Srstrong@cs.ucsd.edu        stdin_fd = Process::openInputFile(in);
3735282Srstrong@cs.ucsd.edu        if (lseek(stdin_fd, fdo_stdin->fileOffset, SEEK_SET) < 0)
3745282Srstrong@cs.ucsd.edu            panic("Unable to seek to correct location in file: %s", in);
3755282Srstrong@cs.ucsd.edu    }
3765282Srstrong@cs.ucsd.edu
3775282Srstrong@cs.ucsd.edu    if (out == "stdout" || out == "cout")
3785282Srstrong@cs.ucsd.edu        stdout_fd = STDOUT_FILENO;
3795282Srstrong@cs.ucsd.edu    else if (out == "stderr" || out == "cerr")
3805282Srstrong@cs.ucsd.edu        stdout_fd = STDERR_FILENO;
3815282Srstrong@cs.ucsd.edu    else if (out == "None")
3825282Srstrong@cs.ucsd.edu        stdout_fd = -1;
3835282Srstrong@cs.ucsd.edu    else{
3845282Srstrong@cs.ucsd.edu        stdout_fd = Process::openOutputFile(out);
3855514SMichael.Adler@intel.com        if (lseek(stdout_fd, fdo_stdout->fileOffset, SEEK_SET) < 0)
3865514SMichael.Adler@intel.com            panic("Unable to seek to correct location in file: %s", out);
3875282Srstrong@cs.ucsd.edu    }
3885282Srstrong@cs.ucsd.edu
3895514SMichael.Adler@intel.com    if (err == "stdout" || err == "cout")
3905514SMichael.Adler@intel.com        stderr_fd = STDOUT_FILENO;
3915514SMichael.Adler@intel.com    else if (err == "stderr" || err == "cerr")
3925514SMichael.Adler@intel.com        stderr_fd = STDERR_FILENO;
3935514SMichael.Adler@intel.com    else if (err == "None")
3945514SMichael.Adler@intel.com        stderr_fd = -1;
3955514SMichael.Adler@intel.com    else if (err == out)
3965514SMichael.Adler@intel.com        stderr_fd = stdout_fd;
3975514SMichael.Adler@intel.com    else {
3985514SMichael.Adler@intel.com        stderr_fd = Process::openOutputFile(err);
3995514SMichael.Adler@intel.com        if (lseek(stderr_fd, fdo_stderr->fileOffset, SEEK_SET) < 0)
4005514SMichael.Adler@intel.com            panic("Unable to seek to correct location in file: %s", err);
4015514SMichael.Adler@intel.com    }
4025282Srstrong@cs.ucsd.edu
4035282Srstrong@cs.ucsd.edu    fdo_stdin->fd = stdin_fd;
4045282Srstrong@cs.ucsd.edu    fdo_stdout->fd = stdout_fd;
4055282Srstrong@cs.ucsd.edu    fdo_stderr->fd = stderr_fd;
4065282Srstrong@cs.ucsd.edu
4075282Srstrong@cs.ucsd.edu
4085282Srstrong@cs.ucsd.edu    for (int free_fd = 3; free_fd <= MAX_FD; ++free_fd) {
4095282Srstrong@cs.ucsd.edu        Process::FdMap *fdo = &fd_map[free_fd];
4105282Srstrong@cs.ucsd.edu        if (fdo->fd != -1) {
4115282Srstrong@cs.ucsd.edu            if (fdo->isPipe){
4125282Srstrong@cs.ucsd.edu                if (fdo->filename == "PIPE-WRITE")
4135282Srstrong@cs.ucsd.edu                    continue;
4145282Srstrong@cs.ucsd.edu                else {
4155282Srstrong@cs.ucsd.edu                    assert (fdo->filename == "PIPE-READ");
4165282Srstrong@cs.ucsd.edu                    //create a new pipe
4175282Srstrong@cs.ucsd.edu                    int fds[2];
4185282Srstrong@cs.ucsd.edu                    int pipe_retval = pipe(fds);
4195282Srstrong@cs.ucsd.edu
4205282Srstrong@cs.ucsd.edu                    if (pipe_retval < 0) {
4215282Srstrong@cs.ucsd.edu                        // error
4225282Srstrong@cs.ucsd.edu                        panic("Unable to create new pipe.");
4235282Srstrong@cs.ucsd.edu                    }
4245282Srstrong@cs.ucsd.edu                    fdo->fd = fds[0]; //set read pipe
4255282Srstrong@cs.ucsd.edu                    Process::FdMap *fdo_write = &fd_map[fdo->readPipeSource];
4265282Srstrong@cs.ucsd.edu                    if (fdo_write->filename != "PIPE-WRITE")
4275282Srstrong@cs.ucsd.edu                        panic ("Couldn't find write end of the pipe");
4285282Srstrong@cs.ucsd.edu
4295282Srstrong@cs.ucsd.edu                    fdo_write->fd = fds[1];//set write pipe
4305282Srstrong@cs.ucsd.edu               }
4315282Srstrong@cs.ucsd.edu            } else {
4325282Srstrong@cs.ucsd.edu                //Open file
4335282Srstrong@cs.ucsd.edu                int fd = open(fdo->filename.c_str(), fdo->flags, fdo->mode);
4345282Srstrong@cs.ucsd.edu
4355282Srstrong@cs.ucsd.edu                if (fd == -1)
4365282Srstrong@cs.ucsd.edu                    panic("Unable to open file: %s", fdo->filename);
4375282Srstrong@cs.ucsd.edu                fdo->fd = fd;
4385282Srstrong@cs.ucsd.edu
4395282Srstrong@cs.ucsd.edu                //Seek to correct location before checkpoint
4405282Srstrong@cs.ucsd.edu                if (lseek(fd,fdo->fileOffset, SEEK_SET) < 0)
4415282Srstrong@cs.ucsd.edu                    panic("Unable to seek to correct location in file: %s", fdo->filename);
4425282Srstrong@cs.ucsd.edu            }
4435282Srstrong@cs.ucsd.edu        }
4445282Srstrong@cs.ucsd.edu    }
4455282Srstrong@cs.ucsd.edu}
4465282Srstrong@cs.ucsd.eduvoid
4475282Srstrong@cs.ucsd.eduProcess::find_file_offsets(){
4485282Srstrong@cs.ucsd.edu    for (int free_fd = 0; free_fd <= MAX_FD; ++free_fd) {
4495282Srstrong@cs.ucsd.edu        Process::FdMap *fdo = &fd_map[free_fd];
4505282Srstrong@cs.ucsd.edu        if (fdo->fd != -1) {
4515282Srstrong@cs.ucsd.edu            fdo->fileOffset = lseek(fdo->fd, 0, SEEK_CUR);
4525282Srstrong@cs.ucsd.edu        }  else {
4535282Srstrong@cs.ucsd.edu                fdo->filename = "NULL";
4545282Srstrong@cs.ucsd.edu                fdo->fileOffset = 0;
4555282Srstrong@cs.ucsd.edu        }
4565282Srstrong@cs.ucsd.edu    }
4575282Srstrong@cs.ucsd.edu}
4585282Srstrong@cs.ucsd.edu
4595282Srstrong@cs.ucsd.eduvoid
4605282Srstrong@cs.ucsd.eduProcess::setReadPipeSource(int read_pipe_fd, int source_fd){
4615282Srstrong@cs.ucsd.edu    Process::FdMap *fdo = &fd_map[read_pipe_fd];
4625282Srstrong@cs.ucsd.edu    fdo->readPipeSource = source_fd;
4635282Srstrong@cs.ucsd.edu}
4645282Srstrong@cs.ucsd.edu
4655282Srstrong@cs.ucsd.eduvoid
4665282Srstrong@cs.ucsd.eduProcess::FdMap::serialize(std::ostream &os)
4675282Srstrong@cs.ucsd.edu{
4685282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(fd);
4695282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(isPipe);
4705282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(filename);
4715282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(flags);
4725282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(readPipeSource);
4735282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(fileOffset);
4745282Srstrong@cs.ucsd.edu}
4755282Srstrong@cs.ucsd.edu
4765282Srstrong@cs.ucsd.eduvoid
4775282Srstrong@cs.ucsd.eduProcess::FdMap::unserialize(Checkpoint *cp, const std::string &section)
4785282Srstrong@cs.ucsd.edu{
4795282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(fd);
4805282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(isPipe);
4815282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(filename);
4825282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(flags);
4835282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(readPipeSource);
4845282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(fileOffset);
4855282Srstrong@cs.ucsd.edu}
4865282Srstrong@cs.ucsd.edu
4873311Ssaidi@eecs.umich.eduvoid
4883311Ssaidi@eecs.umich.eduProcess::serialize(std::ostream &os)
4893311Ssaidi@eecs.umich.edu{
4903311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(initialContextLoaded);
4913311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(brk_point);
4923311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(stack_base);
4933311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(stack_size);
4943311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(stack_min);
4953311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(next_thread_stack_base);
4963311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(mmap_start);
4973311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(mmap_end);
4983311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(nxm_start);
4993311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(nxm_end);
5005282Srstrong@cs.ucsd.edu    find_file_offsets();
5015282Srstrong@cs.ucsd.edu    pTable->serialize(os);
5025282Srstrong@cs.ucsd.edu    for (int x = 0; x <= MAX_FD; x++) {
5035282Srstrong@cs.ucsd.edu        nameOut(os, csprintf("%s.FdMap%d", name(), x));
5045282Srstrong@cs.ucsd.edu        fd_map[x].serialize(os);
5055282Srstrong@cs.ucsd.edu    }
5063311Ssaidi@eecs.umich.edu
5073311Ssaidi@eecs.umich.edu}
5083311Ssaidi@eecs.umich.edu
5093311Ssaidi@eecs.umich.eduvoid
5103311Ssaidi@eecs.umich.eduProcess::unserialize(Checkpoint *cp, const std::string &section)
5113311Ssaidi@eecs.umich.edu{
5123311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(initialContextLoaded);
5133311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(brk_point);
5143311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(stack_base);
5153311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(stack_size);
5163311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(stack_min);
5173311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(next_thread_stack_base);
5183311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(mmap_start);
5193311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(mmap_end);
5203311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(nxm_start);
5213311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(nxm_end);
5223311Ssaidi@eecs.umich.edu    pTable->unserialize(cp, section);
5235282Srstrong@cs.ucsd.edu    for (int x = 0; x <= MAX_FD; x++) {
5245282Srstrong@cs.ucsd.edu        fd_map[x].unserialize(cp, csprintf("%s.FdMap%d", section, x));
5255282Srstrong@cs.ucsd.edu     }
5265282Srstrong@cs.ucsd.edu    fix_file_offsets();
5275183Ssaidi@eecs.umich.edu
5285183Ssaidi@eecs.umich.edu    checkpointRestored = true;
5295183Ssaidi@eecs.umich.edu
5303311Ssaidi@eecs.umich.edu}
5312SN/A
5322SN/A
5332SN/A////////////////////////////////////////////////////////////////////////
5342SN/A//
5352SN/A// LiveProcess member definitions
5362SN/A//
5372SN/A////////////////////////////////////////////////////////////////////////
5382SN/A
53912SN/A
5405154Sgblack@eecs.umich.eduLiveProcess::LiveProcess(LiveProcessParams * params, ObjectFile *_objFile)
5415154Sgblack@eecs.umich.edu    : Process(params), objFile(_objFile),
5425154Sgblack@eecs.umich.edu      argv(params->cmd), envp(params->env), cwd(params->cwd)
5432SN/A{
5445154Sgblack@eecs.umich.edu    __uid = params->uid;
5455154Sgblack@eecs.umich.edu    __euid = params->euid;
5465154Sgblack@eecs.umich.edu    __gid = params->gid;
5475154Sgblack@eecs.umich.edu    __egid = params->egid;
5485154Sgblack@eecs.umich.edu    __pid = params->pid;
5495154Sgblack@eecs.umich.edu    __ppid = params->ppid;
5503114Sgblack@eecs.umich.edu
5515154Sgblack@eecs.umich.edu    prog_fname = params->cmd[0];
55212SN/A
5531158SN/A    // load up symbols, if any... these may be used for debugging or
5541158SN/A    // profiling.
5551158SN/A    if (!debugSymbolTable) {
5561158SN/A        debugSymbolTable = new SymbolTable();
5571158SN/A        if (!objFile->loadGlobalSymbols(debugSymbolTable) ||
5581158SN/A            !objFile->loadLocalSymbols(debugSymbolTable)) {
5591158SN/A            // didn't load any symbols
5601158SN/A            delete debugSymbolTable;
5611158SN/A            debugSymbolTable = NULL;
5621158SN/A        }
5631158SN/A    }
5642378SN/A}
5651158SN/A
5662378SN/Avoid
5672474SN/ALiveProcess::argsInit(int intSize, int pageSize)
5682378SN/A{
5692378SN/A    Process::startup();
57012SN/A
5712378SN/A    // load object file into target memory
5722378SN/A    objFile->loadSections(initVirtMem);
57312SN/A
57412SN/A    // Calculate how much space we need for arg & env arrays.
5752474SN/A    int argv_array_size = intSize * (argv.size() + 1);
5762474SN/A    int envp_array_size = intSize * (envp.size() + 1);
57712SN/A    int arg_data_size = 0;
57812SN/A    for (int i = 0; i < argv.size(); ++i) {
57912SN/A        arg_data_size += argv[i].size() + 1;
58012SN/A    }
58112SN/A    int env_data_size = 0;
58212SN/A    for (int i = 0; i < envp.size(); ++i) {
58312SN/A        env_data_size += envp[i].size() + 1;
58412SN/A    }
58512SN/A
58612SN/A    int space_needed =
58712SN/A        argv_array_size + envp_array_size + arg_data_size + env_data_size;
5883005Sstever@eecs.umich.edu    if (space_needed < 32*1024)
5893005Sstever@eecs.umich.edu        space_needed = 32*1024;
59012SN/A
59112SN/A    // set bottom of stack
59212SN/A    stack_min = stack_base - space_needed;
59312SN/A    // align it
5942800Ssaidi@eecs.umich.edu    stack_min = roundDown(stack_min, pageSize);
59512SN/A    stack_size = stack_base - stack_min;
5962378SN/A    // map memory
5972800Ssaidi@eecs.umich.edu    pTable->allocate(stack_min, roundUp(stack_size, pageSize));
59812SN/A
59912SN/A    // map out initial stack contents
6002523SN/A    Addr argv_array_base = stack_min + intSize; // room for argc
60112SN/A    Addr envp_array_base = argv_array_base + argv_array_size;
60212SN/A    Addr arg_data_base = envp_array_base + envp_array_size;
60312SN/A    Addr env_data_base = arg_data_base + arg_data_size;
60412SN/A
60512SN/A    // write contents to stack
60612SN/A    uint64_t argc = argv.size();
6072474SN/A    if (intSize == 8)
6082474SN/A        argc = htog((uint64_t)argc);
6092474SN/A    else if (intSize == 4)
6102474SN/A        argc = htog((uint32_t)argc);
6112474SN/A    else
6122474SN/A        panic("Unknown int size");
6132474SN/A
6142474SN/A    initVirtMem->writeBlob(stack_min, (uint8_t*)&argc, intSize);
61512SN/A
6162378SN/A    copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem);
6172378SN/A    copyStringArray(envp, envp_array_base, env_data_base, initVirtMem);
61812SN/A
6194772Sgblack@eecs.umich.edu    assert(NumArgumentRegs >= 2);
6205713Shsul@eecs.umich.edu
6215713Shsul@eecs.umich.edu    ThreadContext *tc = system->getThreadContext(contextIds[0]);
6225713Shsul@eecs.umich.edu
6235713Shsul@eecs.umich.edu    tc->setIntReg(ArgumentReg[0], argc);
6245713Shsul@eecs.umich.edu    tc->setIntReg(ArgumentReg[1], argv_array_base);
6255713Shsul@eecs.umich.edu    tc->setIntReg(StackPointerReg, stack_min);
6262451SN/A
6272451SN/A    Addr prog_entry = objFile->entryPoint();
6285713Shsul@eecs.umich.edu    tc->setPC(prog_entry);
6295713Shsul@eecs.umich.edu    tc->setNextPC(prog_entry + sizeof(MachInst));
6302817Sksewell@umich.edu
6312817Sksewell@umich.edu#if THE_ISA != ALPHA_ISA //e.g. MIPS or Sparc
6325713Shsul@eecs.umich.edu    tc->setNextNPC(prog_entry + (2 * sizeof(MachInst)));
6332817Sksewell@umich.edu#endif
6342378SN/A
6352378SN/A    num_processes++;
6362SN/A}
6372SN/A
6382093SN/Avoid
6392680Sktlim@umich.eduLiveProcess::syscall(int64_t callnum, ThreadContext *tc)
6402093SN/A{
6412093SN/A    num_syscalls++;
6422093SN/A
6432093SN/A    SyscallDesc *desc = getDesc(callnum);
6442093SN/A    if (desc == NULL)
6452093SN/A        fatal("Syscall %d out of range", callnum);
6462093SN/A
6472680Sktlim@umich.edu    desc->doSyscall(callnum, this, tc);
6482093SN/A}
6492SN/A
6502715Sstever@eecs.umich.eduLiveProcess *
6515154Sgblack@eecs.umich.eduLiveProcess::create(LiveProcessParams * params)
6522715Sstever@eecs.umich.edu{
6532715Sstever@eecs.umich.edu    LiveProcess *process = NULL;
6542715Sstever@eecs.umich.edu
6555154Sgblack@eecs.umich.edu    string executable =
6565154Sgblack@eecs.umich.edu        params->executable == "" ? params->cmd[0] : params->executable;
6572715Sstever@eecs.umich.edu    ObjectFile *objFile = createObjectFile(executable);
6582715Sstever@eecs.umich.edu    if (objFile == NULL) {
6592715Sstever@eecs.umich.edu        fatal("Can't load object file %s", executable);
6602715Sstever@eecs.umich.edu    }
6612715Sstever@eecs.umich.edu
6623917Ssaidi@eecs.umich.edu    if (objFile->isDynamic())
6633917Ssaidi@eecs.umich.edu       fatal("Object file is a dynamic executable however only static "
6645070Ssaidi@eecs.umich.edu             "executables are supported!\n       Please recompile your "
6653917Ssaidi@eecs.umich.edu             "executable as a static binary and try again.\n");
6663917Ssaidi@eecs.umich.edu
6675089Sgblack@eecs.umich.edu#if THE_ISA == ALPHA_ISA
6685753Ssteve.reinhardt@amd.com    if (objFile->getArch() != ObjectFile::Alpha)
6695753Ssteve.reinhardt@amd.com        fatal("Object file architecture does not match compiled ISA (Alpha).");
6705753Ssteve.reinhardt@amd.com
6712715Sstever@eecs.umich.edu    switch (objFile->getOpSys()) {
6722715Sstever@eecs.umich.edu      case ObjectFile::Tru64:
6735154Sgblack@eecs.umich.edu        process = new AlphaTru64Process(params, objFile);
6742715Sstever@eecs.umich.edu        break;
6752715Sstever@eecs.umich.edu
6765753Ssteve.reinhardt@amd.com      case ObjectFile::UnknownOpSys:
6775753Ssteve.reinhardt@amd.com        warn("Unknown operating system; assuming Linux.");
6785753Ssteve.reinhardt@amd.com        // fall through
6792715Sstever@eecs.umich.edu      case ObjectFile::Linux:
6805154Sgblack@eecs.umich.edu        process = new AlphaLinuxProcess(params, objFile);
6812715Sstever@eecs.umich.edu        break;
6822715Sstever@eecs.umich.edu
6832715Sstever@eecs.umich.edu      default:
6842715Sstever@eecs.umich.edu        fatal("Unknown/unsupported operating system.");
6852715Sstever@eecs.umich.edu    }
6862715Sstever@eecs.umich.edu#elif THE_ISA == SPARC_ISA
6875753Ssteve.reinhardt@amd.com    if (objFile->getArch() != ObjectFile::SPARC64 &&
6885753Ssteve.reinhardt@amd.com        objFile->getArch() != ObjectFile::SPARC32)
6892715Sstever@eecs.umich.edu        fatal("Object file architecture does not match compiled ISA (SPARC).");
6902715Sstever@eecs.umich.edu    switch (objFile->getOpSys()) {
6915753Ssteve.reinhardt@amd.com      case ObjectFile::UnknownOpSys:
6925753Ssteve.reinhardt@amd.com        warn("Unknown operating system; assuming Linux.");
6935753Ssteve.reinhardt@amd.com        // fall through
6942715Sstever@eecs.umich.edu      case ObjectFile::Linux:
6954111Sgblack@eecs.umich.edu        if (objFile->getArch() == ObjectFile::SPARC64) {
6965154Sgblack@eecs.umich.edu            process = new Sparc64LinuxProcess(params, objFile);
6974111Sgblack@eecs.umich.edu        } else {
6985154Sgblack@eecs.umich.edu            process = new Sparc32LinuxProcess(params, objFile);
6994111Sgblack@eecs.umich.edu        }
7002715Sstever@eecs.umich.edu        break;
7012715Sstever@eecs.umich.edu
7022715Sstever@eecs.umich.edu
7032715Sstever@eecs.umich.edu      case ObjectFile::Solaris:
7045154Sgblack@eecs.umich.edu        process = new SparcSolarisProcess(params, objFile);
7052715Sstever@eecs.umich.edu        break;
7065753Ssteve.reinhardt@amd.com
7072715Sstever@eecs.umich.edu      default:
7082715Sstever@eecs.umich.edu        fatal("Unknown/unsupported operating system.");
7092715Sstever@eecs.umich.edu    }
7104157Sgblack@eecs.umich.edu#elif THE_ISA == X86_ISA
7114157Sgblack@eecs.umich.edu    if (objFile->getArch() != ObjectFile::X86)
7124166Sgblack@eecs.umich.edu        fatal("Object file architecture does not match compiled ISA (x86).");
7134157Sgblack@eecs.umich.edu    switch (objFile->getOpSys()) {
7145753Ssteve.reinhardt@amd.com      case ObjectFile::UnknownOpSys:
7155753Ssteve.reinhardt@amd.com        warn("Unknown operating system; assuming Linux.");
7165753Ssteve.reinhardt@amd.com        // fall through
7174166Sgblack@eecs.umich.edu      case ObjectFile::Linux:
7185154Sgblack@eecs.umich.edu        process = new X86LinuxProcess(params, objFile);
7194166Sgblack@eecs.umich.edu        break;
7205753Ssteve.reinhardt@amd.com
7214157Sgblack@eecs.umich.edu      default:
7224157Sgblack@eecs.umich.edu        fatal("Unknown/unsupported operating system.");
7234157Sgblack@eecs.umich.edu    }
7242715Sstever@eecs.umich.edu#elif THE_ISA == MIPS_ISA
7252715Sstever@eecs.umich.edu    if (objFile->getArch() != ObjectFile::Mips)
7262715Sstever@eecs.umich.edu        fatal("Object file architecture does not match compiled ISA (MIPS).");
7272715Sstever@eecs.umich.edu    switch (objFile->getOpSys()) {
7285753Ssteve.reinhardt@amd.com      case ObjectFile::UnknownOpSys:
7295753Ssteve.reinhardt@amd.com        warn("Unknown operating system; assuming Linux.");
7305753Ssteve.reinhardt@amd.com        // fall through
7312715Sstever@eecs.umich.edu      case ObjectFile::Linux:
7325154Sgblack@eecs.umich.edu        process = new MipsLinuxProcess(params, objFile);
7332715Sstever@eecs.umich.edu        break;
7342715Sstever@eecs.umich.edu
7352715Sstever@eecs.umich.edu      default:
7362715Sstever@eecs.umich.edu        fatal("Unknown/unsupported operating system.");
7372715Sstever@eecs.umich.edu    }
7385335Shines@cs.fsu.edu#elif THE_ISA == ARM_ISA
7395335Shines@cs.fsu.edu    if (objFile->getArch() != ObjectFile::Arm)
7405335Shines@cs.fsu.edu        fatal("Object file architecture does not match compiled ISA (ARM).");
7415335Shines@cs.fsu.edu    switch (objFile->getOpSys()) {
7425753Ssteve.reinhardt@amd.com      case ObjectFile::UnknownOpSys:
7435753Ssteve.reinhardt@amd.com        warn("Unknown operating system; assuming Linux.");
7445753Ssteve.reinhardt@amd.com        // fall through
7455335Shines@cs.fsu.edu      case ObjectFile::Linux:
7465335Shines@cs.fsu.edu        process = new ArmLinuxProcess(params, objFile);
7475335Shines@cs.fsu.edu        break;
7485335Shines@cs.fsu.edu
7495335Shines@cs.fsu.edu      default:
7505335Shines@cs.fsu.edu        fatal("Unknown/unsupported operating system.");
7515335Shines@cs.fsu.edu    }
7522715Sstever@eecs.umich.edu#else
7532715Sstever@eecs.umich.edu#error "THE_ISA not set"
7542715Sstever@eecs.umich.edu#endif
7552715Sstever@eecs.umich.edu
7562715Sstever@eecs.umich.edu
7572715Sstever@eecs.umich.edu    if (process == NULL)
7582715Sstever@eecs.umich.edu        fatal("Unknown error creating process object.");
7592715Sstever@eecs.umich.edu    return process;
7602715Sstever@eecs.umich.edu}
7612715Sstever@eecs.umich.edu
7624762Snate@binkert.orgLiveProcess *
7634762Snate@binkert.orgLiveProcessParams::create()
7642715Sstever@eecs.umich.edu{
7655154Sgblack@eecs.umich.edu    return LiveProcess::create(this);
7662715Sstever@eecs.umich.edu}
767