process.cc revision 8852
12SN/A/*
28852Sandreas.hansson@arm.com * Copyright (c) 2012 ARM Limited
38852Sandreas.hansson@arm.com * All rights reserved
48852Sandreas.hansson@arm.com *
58852Sandreas.hansson@arm.com * The license below extends only to copyright in the software and shall
68852Sandreas.hansson@arm.com * not be construed as granting a license to any other intellectual
78852Sandreas.hansson@arm.com * property including but not limited to intellectual property relating
88852Sandreas.hansson@arm.com * to a hardware implementation of the functionality of the software
98852Sandreas.hansson@arm.com * licensed hereunder.  You may use the software subject to the license
108852Sandreas.hansson@arm.com * terms below provided that you ensure that this notice is replicated
118852Sandreas.hansson@arm.com * unmodified and in its entirety in all distributions of the software,
128852Sandreas.hansson@arm.com * modified or unmodified, in source code or in binary form.
138852Sandreas.hansson@arm.com *
141762SN/A * Copyright (c) 2001-2005 The Regents of The University of Michigan
152SN/A * All rights reserved.
162SN/A *
172SN/A * Redistribution and use in source and binary forms, with or without
182SN/A * modification, are permitted provided that the following conditions are
192SN/A * met: redistributions of source code must retain the above copyright
202SN/A * notice, this list of conditions and the following disclaimer;
212SN/A * redistributions in binary form must reproduce the above copyright
222SN/A * notice, this list of conditions and the following disclaimer in the
232SN/A * documentation and/or other materials provided with the distribution;
242SN/A * neither the name of the copyright holders nor the names of its
252SN/A * contributors may be used to endorse or promote products derived from
262SN/A * this software without specific prior written permission.
272SN/A *
282SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
292SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
302SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
312SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
322SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
332SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
342SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
352SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
362SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
372SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
382SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
392665Ssaidi@eecs.umich.edu *
402665Ssaidi@eecs.umich.edu * Authors: Nathan Binkert
412665Ssaidi@eecs.umich.edu *          Steve Reinhardt
422665Ssaidi@eecs.umich.edu *          Ali Saidi
432SN/A */
442SN/A
458229Snate@binkert.org#include <fcntl.h>
462SN/A#include <unistd.h>
476712Snate@binkert.org
486712Snate@binkert.org#include <cstdio>
492SN/A#include <string>
502SN/A
5156SN/A#include "base/loader/object_file.hh"
521158SN/A#include "base/loader/symtab.hh"
538229Snate@binkert.org#include "base/intmath.hh"
54146SN/A#include "base/statistics.hh"
556658Snate@binkert.org#include "config/the_isa.hh"
562680Sktlim@umich.edu#include "cpu/thread_context.hh"
572378SN/A#include "mem/page_table.hh"
588706Sandreas.hansson@arm.com#include "mem/se_translating_port_proxy.hh"
598229Snate@binkert.org#include "params/LiveProcess.hh"
605154Sgblack@eecs.umich.edu#include "params/Process.hh"
615512SMichael.Adler@intel.com#include "sim/debug.hh"
62360SN/A#include "sim/process.hh"
634434Ssaidi@eecs.umich.edu#include "sim/process_impl.hh"
64695SN/A#include "sim/stats.hh"
652093SN/A#include "sim/syscall_emul.hh"
662378SN/A#include "sim/system.hh"
672SN/A
682715Sstever@eecs.umich.edu#if THE_ISA == ALPHA_ISA
692715Sstever@eecs.umich.edu#include "arch/alpha/linux/process.hh"
702715Sstever@eecs.umich.edu#include "arch/alpha/tru64/process.hh"
712715Sstever@eecs.umich.edu#elif THE_ISA == SPARC_ISA
722715Sstever@eecs.umich.edu#include "arch/sparc/linux/process.hh"
732715Sstever@eecs.umich.edu#include "arch/sparc/solaris/process.hh"
742715Sstever@eecs.umich.edu#elif THE_ISA == MIPS_ISA
752715Sstever@eecs.umich.edu#include "arch/mips/linux/process.hh"
765335Shines@cs.fsu.edu#elif THE_ISA == ARM_ISA
775335Shines@cs.fsu.edu#include "arch/arm/linux/process.hh"
784157Sgblack@eecs.umich.edu#elif THE_ISA == X86_ISA
794166Sgblack@eecs.umich.edu#include "arch/x86/linux/process.hh"
806691Stjones1@inf.ed.ac.uk#elif THE_ISA == POWER_ISA
816691Stjones1@inf.ed.ac.uk#include "arch/power/linux/process.hh"
822715Sstever@eecs.umich.edu#else
832715Sstever@eecs.umich.edu#error "THE_ISA not set"
842715Sstever@eecs.umich.edu#endif
852715Sstever@eecs.umich.edu
862715Sstever@eecs.umich.edu
872SN/Ausing namespace std;
882107SN/Ausing namespace TheISA;
892SN/A
902SN/A// current number of allocated processes
912SN/Aint num_processes = 0;
922SN/A
935758Shsul@eecs.umich.edutemplate<class IntType>
945771Shsul@eecs.umich.eduAuxVector<IntType>::AuxVector(IntType type, IntType val)
955758Shsul@eecs.umich.edu{
965758Shsul@eecs.umich.edu    a_type = TheISA::htog(type);
975758Shsul@eecs.umich.edu    a_val = TheISA::htog(val);
985758Shsul@eecs.umich.edu}
995758Shsul@eecs.umich.edu
1008737Skoansin.tan@gmail.comtemplate struct AuxVector<uint32_t>;
1018737Skoansin.tan@gmail.comtemplate struct AuxVector<uint64_t>;
1025758Shsul@eecs.umich.edu
1035154Sgblack@eecs.umich.eduProcess::Process(ProcessParams * params)
1047532Ssteve.reinhardt@amd.com    : SimObject(params), system(params->system),
1058852Sandreas.hansson@arm.com      max_stack_size(params->max_stack_size),
1068852Sandreas.hansson@arm.com      M5_pid(system->allocatePID()),
1078852Sandreas.hansson@arm.com      pTable(new PageTable(name(), M5_pid)),
1088852Sandreas.hansson@arm.com      initVirtMem(system->getSystemPort(), this,
1098852Sandreas.hansson@arm.com                  SETranslatingPortProxy::Always)
1102SN/A{
1115154Sgblack@eecs.umich.edu    string in = params->input;
1125154Sgblack@eecs.umich.edu    string out = params->output;
1135514SMichael.Adler@intel.com    string err = params->errout;
1145154Sgblack@eecs.umich.edu
1155154Sgblack@eecs.umich.edu    // initialize file descriptors to default: same as simulator
1165154Sgblack@eecs.umich.edu    int stdin_fd, stdout_fd, stderr_fd;
1175154Sgblack@eecs.umich.edu
1185154Sgblack@eecs.umich.edu    if (in == "stdin" || in == "cin")
1195154Sgblack@eecs.umich.edu        stdin_fd = STDIN_FILENO;
1205154Sgblack@eecs.umich.edu    else if (in == "None")
1215154Sgblack@eecs.umich.edu        stdin_fd = -1;
1225154Sgblack@eecs.umich.edu    else
1235154Sgblack@eecs.umich.edu        stdin_fd = Process::openInputFile(in);
1245154Sgblack@eecs.umich.edu
1255154Sgblack@eecs.umich.edu    if (out == "stdout" || out == "cout")
1265154Sgblack@eecs.umich.edu        stdout_fd = STDOUT_FILENO;
1275154Sgblack@eecs.umich.edu    else if (out == "stderr" || out == "cerr")
1285154Sgblack@eecs.umich.edu        stdout_fd = STDERR_FILENO;
1295154Sgblack@eecs.umich.edu    else if (out == "None")
1305154Sgblack@eecs.umich.edu        stdout_fd = -1;
1315154Sgblack@eecs.umich.edu    else
1325154Sgblack@eecs.umich.edu        stdout_fd = Process::openOutputFile(out);
1335154Sgblack@eecs.umich.edu
1345514SMichael.Adler@intel.com    if (err == "stdout" || err == "cout")
1355514SMichael.Adler@intel.com        stderr_fd = STDOUT_FILENO;
1365514SMichael.Adler@intel.com    else if (err == "stderr" || err == "cerr")
1375514SMichael.Adler@intel.com        stderr_fd = STDERR_FILENO;
1385514SMichael.Adler@intel.com    else if (err == "None")
1395514SMichael.Adler@intel.com        stderr_fd = -1;
1405514SMichael.Adler@intel.com    else if (err == out)
1415514SMichael.Adler@intel.com        stderr_fd = stdout_fd;
1425514SMichael.Adler@intel.com    else
1435514SMichael.Adler@intel.com        stderr_fd = Process::openOutputFile(err);
1445154Sgblack@eecs.umich.edu
1452SN/A    // initialize first 3 fds (stdin, stdout, stderr)
1465282Srstrong@cs.ucsd.edu    Process::FdMap *fdo = &fd_map[STDIN_FILENO];
1475282Srstrong@cs.ucsd.edu    fdo->fd = stdin_fd;
1485282Srstrong@cs.ucsd.edu    fdo->filename = in;
1495282Srstrong@cs.ucsd.edu    fdo->flags = O_RDONLY;
1505282Srstrong@cs.ucsd.edu    fdo->mode = -1;
1515282Srstrong@cs.ucsd.edu    fdo->fileOffset = 0;
1525282Srstrong@cs.ucsd.edu
1535282Srstrong@cs.ucsd.edu    fdo =  &fd_map[STDOUT_FILENO];
1545282Srstrong@cs.ucsd.edu    fdo->fd = stdout_fd;
1555282Srstrong@cs.ucsd.edu    fdo->filename = out;
1565282Srstrong@cs.ucsd.edu    fdo->flags =  O_WRONLY | O_CREAT | O_TRUNC;
1575282Srstrong@cs.ucsd.edu    fdo->mode = 0774;
1585282Srstrong@cs.ucsd.edu    fdo->fileOffset = 0;
1595282Srstrong@cs.ucsd.edu
1605282Srstrong@cs.ucsd.edu    fdo = &fd_map[STDERR_FILENO];
1615282Srstrong@cs.ucsd.edu    fdo->fd = stderr_fd;
1625514SMichael.Adler@intel.com    fdo->filename = err;
1635282Srstrong@cs.ucsd.edu    fdo->flags = O_WRONLY;
1645282Srstrong@cs.ucsd.edu    fdo->mode = -1;
1655282Srstrong@cs.ucsd.edu    fdo->fileOffset = 0;
1665282Srstrong@cs.ucsd.edu
1672SN/A
1682SN/A    // mark remaining fds as free
1692SN/A    for (int i = 3; i <= MAX_FD; ++i) {
1705282Srstrong@cs.ucsd.edu        Process::FdMap *fdo = &fd_map[i];
1715282Srstrong@cs.ucsd.edu        fdo->fd = -1;
1722SN/A    }
1732SN/A
1741450SN/A    mmap_start = mmap_end = 0;
1751514SN/A    nxm_start = nxm_end = 0;
1762SN/A    // other parameters will be initialized when the program is loaded
1772SN/A}
1782SN/A
1792378SN/A
1802SN/Avoid
1812SN/AProcess::regStats()
1822SN/A{
183729SN/A    using namespace Stats;
1842SN/A
1852SN/A    num_syscalls
1868240Snate@binkert.org        .name(name() + ".num_syscalls")
1872SN/A        .desc("Number of system calls")
1882SN/A        ;
1892SN/A}
1902SN/A
1912SN/A//
1922SN/A// static helper functions
1932SN/A//
1942SN/Aint
1952SN/AProcess::openInputFile(const string &filename)
1962SN/A{
1972SN/A    int fd = open(filename.c_str(), O_RDONLY);
1982SN/A
1992SN/A    if (fd == -1) {
2002SN/A        perror(NULL);
2012SN/A        cerr << "unable to open \"" << filename << "\" for reading\n";
2022SN/A        fatal("can't open input file");
2032SN/A    }
2042SN/A
2052SN/A    return fd;
2062SN/A}
2072SN/A
2082SN/A
2092SN/Aint
2102SN/AProcess::openOutputFile(const string &filename)
2112SN/A{
2125514SMichael.Adler@intel.com    int fd = open(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0664);
2132SN/A
2142SN/A    if (fd == -1) {
2152SN/A        perror(NULL);
2162SN/A        cerr << "unable to open \"" << filename << "\" for writing\n";
2172SN/A        fatal("can't open output file");
2182SN/A    }
2192SN/A
2202SN/A    return fd;
2212SN/A}
2222SN/A
2235713Shsul@eecs.umich.eduThreadContext *
2245713Shsul@eecs.umich.eduProcess::findFreeContext()
2252SN/A{
2265713Shsul@eecs.umich.edu    int size = contextIds.size();
2275713Shsul@eecs.umich.edu    ThreadContext *tc;
2285713Shsul@eecs.umich.edu    for (int i = 0; i < size; ++i) {
2295713Shsul@eecs.umich.edu        tc = system->getThreadContext(contextIds[i]);
2306029Ssteve.reinhardt@amd.com        if (tc->status() == ThreadContext::Halted) {
2315713Shsul@eecs.umich.edu            // inactive context, free to use
2325713Shsul@eecs.umich.edu            return tc;
2335713Shsul@eecs.umich.edu        }
2345512SMichael.Adler@intel.com    }
2355713Shsul@eecs.umich.edu    return NULL;
2362SN/A}
2372SN/A
2381395SN/Avoid
2397532Ssteve.reinhardt@amd.comProcess::initState()
2401395SN/A{
2415713Shsul@eecs.umich.edu    if (contextIds.empty())
2425713Shsul@eecs.umich.edu        fatal("Process %s is not associated with any HW contexts!\n", name());
2432378SN/A
2442680Sktlim@umich.edu    // first thread context for this process... initialize & enable
2455713Shsul@eecs.umich.edu    ThreadContext *tc = system->getThreadContext(contextIds[0]);
2461395SN/A
2471634SN/A    // mark this context as active so it will start ticking.
2482680Sktlim@umich.edu    tc->activate(0);
2491395SN/A}
2502SN/A
2512SN/A// map simulator fd sim_fd to target fd tgt_fd
2522SN/Avoid
2532SN/AProcess::dup_fd(int sim_fd, int tgt_fd)
2542SN/A{
2552SN/A    if (tgt_fd < 0 || tgt_fd > MAX_FD)
2562SN/A        panic("Process::dup_fd tried to dup past MAX_FD (%d)", tgt_fd);
2572SN/A
2585282Srstrong@cs.ucsd.edu    Process::FdMap *fdo = &fd_map[tgt_fd];
2595282Srstrong@cs.ucsd.edu    fdo->fd = sim_fd;
2602SN/A}
2612SN/A
2622SN/A
2632SN/A// generate new target fd for sim_fd
2642SN/Aint
2655282Srstrong@cs.ucsd.eduProcess::alloc_fd(int sim_fd, string filename, int flags, int mode, bool pipe)
2662SN/A{
2672SN/A    // in case open() returns an error, don't allocate a new fd
2682SN/A    if (sim_fd == -1)
2692SN/A        return -1;
2702SN/A
2712SN/A    // find first free target fd
2725282Srstrong@cs.ucsd.edu    for (int free_fd = 0; free_fd <= MAX_FD; ++free_fd) {
2735282Srstrong@cs.ucsd.edu        Process::FdMap *fdo = &fd_map[free_fd];
2745282Srstrong@cs.ucsd.edu        if (fdo->fd == -1) {
2755282Srstrong@cs.ucsd.edu            fdo->fd = sim_fd;
2765282Srstrong@cs.ucsd.edu            fdo->filename = filename;
2775282Srstrong@cs.ucsd.edu            fdo->mode = mode;
2785282Srstrong@cs.ucsd.edu            fdo->fileOffset = 0;
2795282Srstrong@cs.ucsd.edu            fdo->flags = flags;
2805282Srstrong@cs.ucsd.edu            fdo->isPipe = pipe;
2815282Srstrong@cs.ucsd.edu            fdo->readPipeSource = 0;
2821970SN/A            return free_fd;
2831970SN/A        }
2842SN/A    }
2852SN/A
2861970SN/A    panic("Process::alloc_fd: out of file descriptors!");
2871970SN/A}
2882SN/A
2891970SN/A
2901970SN/A// free target fd (e.g., after close)
2911970SN/Avoid
2921970SN/AProcess::free_fd(int tgt_fd)
2931970SN/A{
2945282Srstrong@cs.ucsd.edu    Process::FdMap *fdo = &fd_map[tgt_fd];
2955282Srstrong@cs.ucsd.edu    if (fdo->fd == -1)
2961970SN/A        warn("Process::free_fd: request to free unused fd %d", tgt_fd);
2971970SN/A
2985282Srstrong@cs.ucsd.edu    fdo->fd = -1;
2995282Srstrong@cs.ucsd.edu    fdo->filename = "NULL";
3005282Srstrong@cs.ucsd.edu    fdo->mode = 0;
3015282Srstrong@cs.ucsd.edu    fdo->fileOffset = 0;
3025282Srstrong@cs.ucsd.edu    fdo->flags = 0;
3035282Srstrong@cs.ucsd.edu    fdo->isPipe = false;
3045282Srstrong@cs.ucsd.edu    fdo->readPipeSource = 0;
3052SN/A}
3062SN/A
3072SN/A
3082SN/A// look up simulator fd for given target fd
3092SN/Aint
3102SN/AProcess::sim_fd(int tgt_fd)
3112SN/A{
3128324Ssteve.reinhardt@amd.com    if (tgt_fd < 0 || tgt_fd > MAX_FD)
3132SN/A        return -1;
3142SN/A
3155282Srstrong@cs.ucsd.edu    return fd_map[tgt_fd].fd;
3162SN/A}
3172SN/A
3185282Srstrong@cs.ucsd.eduProcess::FdMap *
3195282Srstrong@cs.ucsd.eduProcess::sim_fd_obj(int tgt_fd)
3205282Srstrong@cs.ucsd.edu{
3218324Ssteve.reinhardt@amd.com    if (tgt_fd < 0 || tgt_fd > MAX_FD)
3228324Ssteve.reinhardt@amd.com        return NULL;
3235282Srstrong@cs.ucsd.edu
3245282Srstrong@cs.ucsd.edu    return &fd_map[tgt_fd];
3255282Srstrong@cs.ucsd.edu}
3267487Ssteve.reinhardt@amd.com
3278601Ssteve.reinhardt@amd.comvoid
3288601Ssteve.reinhardt@amd.comProcess::allocateMem(Addr vaddr, int64_t size, bool clobber)
3298601Ssteve.reinhardt@amd.com{
3308601Ssteve.reinhardt@amd.com    int npages = divCeil(size, (int64_t)VMPageSize);
3318601Ssteve.reinhardt@amd.com    Addr paddr = system->allocPhysPages(npages);
3328601Ssteve.reinhardt@amd.com    pTable->map(vaddr, paddr, size, clobber);
3338601Ssteve.reinhardt@amd.com}
3348601Ssteve.reinhardt@amd.com
3354434Ssaidi@eecs.umich.edubool
3368539Sgblack@eecs.umich.eduProcess::fixupStackFault(Addr vaddr)
3374434Ssaidi@eecs.umich.edu{
3388539Sgblack@eecs.umich.edu    // Check if this is already on the stack and there's just no page there
3398539Sgblack@eecs.umich.edu    // yet.
3404434Ssaidi@eecs.umich.edu    if (vaddr >= stack_min && vaddr < stack_base) {
3418601Ssteve.reinhardt@amd.com        allocateMem(roundDown(vaddr, VMPageSize), VMPageSize);
3424434Ssaidi@eecs.umich.edu        return true;
3434434Ssaidi@eecs.umich.edu    }
3444434Ssaidi@eecs.umich.edu
3458539Sgblack@eecs.umich.edu    // We've accessed the next page of the stack, so extend it to include
3468539Sgblack@eecs.umich.edu    // this address.
3475154Sgblack@eecs.umich.edu    if (vaddr < stack_min && vaddr >= stack_base - max_stack_size) {
3485154Sgblack@eecs.umich.edu        while (vaddr < stack_min) {
3495154Sgblack@eecs.umich.edu            stack_min -= TheISA::PageBytes;
3508539Sgblack@eecs.umich.edu            if (stack_base - stack_min > max_stack_size)
3515154Sgblack@eecs.umich.edu                fatal("Maximum stack size exceeded\n");
3528539Sgblack@eecs.umich.edu            if (stack_base - stack_min > 8 * 1024 * 1024)
3535154Sgblack@eecs.umich.edu                fatal("Over max stack size for one thread\n");
3548601Ssteve.reinhardt@amd.com            allocateMem(stack_min, TheISA::PageBytes);
3555823Ssaidi@eecs.umich.edu            inform("Increasing stack size by one page.");
3565154Sgblack@eecs.umich.edu        };
3574434Ssaidi@eecs.umich.edu        return true;
3584434Ssaidi@eecs.umich.edu    }
3594434Ssaidi@eecs.umich.edu    return false;
3604434Ssaidi@eecs.umich.edu}
3614434Ssaidi@eecs.umich.edu
3627487Ssteve.reinhardt@amd.com// find all offsets for currently open files and save them
3635282Srstrong@cs.ucsd.eduvoid
3647487Ssteve.reinhardt@amd.comProcess::fix_file_offsets()
3657487Ssteve.reinhardt@amd.com{
3665282Srstrong@cs.ucsd.edu    Process::FdMap *fdo_stdin = &fd_map[STDIN_FILENO];
3675282Srstrong@cs.ucsd.edu    Process::FdMap *fdo_stdout = &fd_map[STDOUT_FILENO];
3685282Srstrong@cs.ucsd.edu    Process::FdMap *fdo_stderr = &fd_map[STDERR_FILENO];
3695282Srstrong@cs.ucsd.edu    string in = fdo_stdin->filename;
3705282Srstrong@cs.ucsd.edu    string out = fdo_stdout->filename;
3715514SMichael.Adler@intel.com    string err = fdo_stderr->filename;
3725282Srstrong@cs.ucsd.edu
3735282Srstrong@cs.ucsd.edu    // initialize file descriptors to default: same as simulator
3745282Srstrong@cs.ucsd.edu    int stdin_fd, stdout_fd, stderr_fd;
3755282Srstrong@cs.ucsd.edu
3765282Srstrong@cs.ucsd.edu    if (in == "stdin" || in == "cin")
3775282Srstrong@cs.ucsd.edu        stdin_fd = STDIN_FILENO;
3785282Srstrong@cs.ucsd.edu    else if (in == "None")
3795282Srstrong@cs.ucsd.edu        stdin_fd = -1;
3807487Ssteve.reinhardt@amd.com    else {
3817487Ssteve.reinhardt@amd.com        // open standard in and seek to the right location
3825282Srstrong@cs.ucsd.edu        stdin_fd = Process::openInputFile(in);
3835282Srstrong@cs.ucsd.edu        if (lseek(stdin_fd, fdo_stdin->fileOffset, SEEK_SET) < 0)
3845282Srstrong@cs.ucsd.edu            panic("Unable to seek to correct location in file: %s", in);
3855282Srstrong@cs.ucsd.edu    }
3865282Srstrong@cs.ucsd.edu
3875282Srstrong@cs.ucsd.edu    if (out == "stdout" || out == "cout")
3885282Srstrong@cs.ucsd.edu        stdout_fd = STDOUT_FILENO;
3895282Srstrong@cs.ucsd.edu    else if (out == "stderr" || out == "cerr")
3905282Srstrong@cs.ucsd.edu        stdout_fd = STDERR_FILENO;
3915282Srstrong@cs.ucsd.edu    else if (out == "None")
3925282Srstrong@cs.ucsd.edu        stdout_fd = -1;
3937487Ssteve.reinhardt@amd.com    else {
3945282Srstrong@cs.ucsd.edu        stdout_fd = Process::openOutputFile(out);
3955514SMichael.Adler@intel.com        if (lseek(stdout_fd, fdo_stdout->fileOffset, SEEK_SET) < 0)
3965514SMichael.Adler@intel.com            panic("Unable to seek to correct location in file: %s", out);
3975282Srstrong@cs.ucsd.edu    }
3985282Srstrong@cs.ucsd.edu
3995514SMichael.Adler@intel.com    if (err == "stdout" || err == "cout")
4005514SMichael.Adler@intel.com        stderr_fd = STDOUT_FILENO;
4015514SMichael.Adler@intel.com    else if (err == "stderr" || err == "cerr")
4025514SMichael.Adler@intel.com        stderr_fd = STDERR_FILENO;
4035514SMichael.Adler@intel.com    else if (err == "None")
4045514SMichael.Adler@intel.com        stderr_fd = -1;
4055514SMichael.Adler@intel.com    else if (err == out)
4065514SMichael.Adler@intel.com        stderr_fd = stdout_fd;
4075514SMichael.Adler@intel.com    else {
4085514SMichael.Adler@intel.com        stderr_fd = Process::openOutputFile(err);
4095514SMichael.Adler@intel.com        if (lseek(stderr_fd, fdo_stderr->fileOffset, SEEK_SET) < 0)
4105514SMichael.Adler@intel.com            panic("Unable to seek to correct location in file: %s", err);
4115514SMichael.Adler@intel.com    }
4125282Srstrong@cs.ucsd.edu
4135282Srstrong@cs.ucsd.edu    fdo_stdin->fd = stdin_fd;
4145282Srstrong@cs.ucsd.edu    fdo_stdout->fd = stdout_fd;
4155282Srstrong@cs.ucsd.edu    fdo_stderr->fd = stderr_fd;
4165282Srstrong@cs.ucsd.edu
4175282Srstrong@cs.ucsd.edu
4185282Srstrong@cs.ucsd.edu    for (int free_fd = 3; free_fd <= MAX_FD; ++free_fd) {
4195282Srstrong@cs.ucsd.edu        Process::FdMap *fdo = &fd_map[free_fd];
4205282Srstrong@cs.ucsd.edu        if (fdo->fd != -1) {
4215282Srstrong@cs.ucsd.edu            if (fdo->isPipe){
4225282Srstrong@cs.ucsd.edu                if (fdo->filename == "PIPE-WRITE")
4235282Srstrong@cs.ucsd.edu                    continue;
4245282Srstrong@cs.ucsd.edu                else {
4255282Srstrong@cs.ucsd.edu                    assert (fdo->filename == "PIPE-READ");
4265282Srstrong@cs.ucsd.edu                    //create a new pipe
4275282Srstrong@cs.ucsd.edu                    int fds[2];
4285282Srstrong@cs.ucsd.edu                    int pipe_retval = pipe(fds);
4295282Srstrong@cs.ucsd.edu
4305282Srstrong@cs.ucsd.edu                    if (pipe_retval < 0) {
4315282Srstrong@cs.ucsd.edu                        // error
4325282Srstrong@cs.ucsd.edu                        panic("Unable to create new pipe.");
4335282Srstrong@cs.ucsd.edu                    }
4345282Srstrong@cs.ucsd.edu                    fdo->fd = fds[0]; //set read pipe
4355282Srstrong@cs.ucsd.edu                    Process::FdMap *fdo_write = &fd_map[fdo->readPipeSource];
4365282Srstrong@cs.ucsd.edu                    if (fdo_write->filename != "PIPE-WRITE")
4375282Srstrong@cs.ucsd.edu                        panic ("Couldn't find write end of the pipe");
4385282Srstrong@cs.ucsd.edu
4395282Srstrong@cs.ucsd.edu                    fdo_write->fd = fds[1];//set write pipe
4405282Srstrong@cs.ucsd.edu               }
4415282Srstrong@cs.ucsd.edu            } else {
4425282Srstrong@cs.ucsd.edu                //Open file
4435282Srstrong@cs.ucsd.edu                int fd = open(fdo->filename.c_str(), fdo->flags, fdo->mode);
4445282Srstrong@cs.ucsd.edu
4455282Srstrong@cs.ucsd.edu                if (fd == -1)
4465282Srstrong@cs.ucsd.edu                    panic("Unable to open file: %s", fdo->filename);
4475282Srstrong@cs.ucsd.edu                fdo->fd = fd;
4485282Srstrong@cs.ucsd.edu
4495282Srstrong@cs.ucsd.edu                //Seek to correct location before checkpoint
4505282Srstrong@cs.ucsd.edu                if (lseek(fd,fdo->fileOffset, SEEK_SET) < 0)
4517487Ssteve.reinhardt@amd.com                    panic("Unable to seek to correct location in file: %s",
4527487Ssteve.reinhardt@amd.com                          fdo->filename);
4535282Srstrong@cs.ucsd.edu            }
4545282Srstrong@cs.ucsd.edu        }
4555282Srstrong@cs.ucsd.edu    }
4565282Srstrong@cs.ucsd.edu}
4577487Ssteve.reinhardt@amd.com
4585282Srstrong@cs.ucsd.eduvoid
4597487Ssteve.reinhardt@amd.comProcess::find_file_offsets()
4607487Ssteve.reinhardt@amd.com{
4615282Srstrong@cs.ucsd.edu    for (int free_fd = 0; free_fd <= MAX_FD; ++free_fd) {
4625282Srstrong@cs.ucsd.edu        Process::FdMap *fdo = &fd_map[free_fd];
4635282Srstrong@cs.ucsd.edu        if (fdo->fd != -1) {
4645282Srstrong@cs.ucsd.edu            fdo->fileOffset = lseek(fdo->fd, 0, SEEK_CUR);
4657487Ssteve.reinhardt@amd.com        } else {
4665282Srstrong@cs.ucsd.edu                fdo->filename = "NULL";
4675282Srstrong@cs.ucsd.edu                fdo->fileOffset = 0;
4685282Srstrong@cs.ucsd.edu        }
4695282Srstrong@cs.ucsd.edu    }
4705282Srstrong@cs.ucsd.edu}
4715282Srstrong@cs.ucsd.edu
4725282Srstrong@cs.ucsd.eduvoid
4737487Ssteve.reinhardt@amd.comProcess::setReadPipeSource(int read_pipe_fd, int source_fd)
4747487Ssteve.reinhardt@amd.com{
4755282Srstrong@cs.ucsd.edu    Process::FdMap *fdo = &fd_map[read_pipe_fd];
4765282Srstrong@cs.ucsd.edu    fdo->readPipeSource = source_fd;
4775282Srstrong@cs.ucsd.edu}
4785282Srstrong@cs.ucsd.edu
4795282Srstrong@cs.ucsd.eduvoid
4805282Srstrong@cs.ucsd.eduProcess::FdMap::serialize(std::ostream &os)
4815282Srstrong@cs.ucsd.edu{
4825282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(fd);
4835282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(isPipe);
4845282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(filename);
4855282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(flags);
4865282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(readPipeSource);
4875282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(fileOffset);
4885282Srstrong@cs.ucsd.edu}
4895282Srstrong@cs.ucsd.edu
4905282Srstrong@cs.ucsd.eduvoid
4915282Srstrong@cs.ucsd.eduProcess::FdMap::unserialize(Checkpoint *cp, const std::string &section)
4925282Srstrong@cs.ucsd.edu{
4935282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(fd);
4945282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(isPipe);
4955282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(filename);
4965282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(flags);
4975282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(readPipeSource);
4985282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(fileOffset);
4995282Srstrong@cs.ucsd.edu}
5005282Srstrong@cs.ucsd.edu
5013311Ssaidi@eecs.umich.eduvoid
5023311Ssaidi@eecs.umich.eduProcess::serialize(std::ostream &os)
5033311Ssaidi@eecs.umich.edu{
5043311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(brk_point);
5053311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(stack_base);
5063311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(stack_size);
5073311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(stack_min);
5083311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(next_thread_stack_base);
5093311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(mmap_start);
5103311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(mmap_end);
5113311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(nxm_start);
5123311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(nxm_end);
5135282Srstrong@cs.ucsd.edu    find_file_offsets();
5145282Srstrong@cs.ucsd.edu    pTable->serialize(os);
5155282Srstrong@cs.ucsd.edu    for (int x = 0; x <= MAX_FD; x++) {
5165282Srstrong@cs.ucsd.edu        nameOut(os, csprintf("%s.FdMap%d", name(), x));
5175282Srstrong@cs.ucsd.edu        fd_map[x].serialize(os);
5185282Srstrong@cs.ucsd.edu    }
5196820SLisa.Hsu@amd.com    SERIALIZE_SCALAR(M5_pid);
5203311Ssaidi@eecs.umich.edu
5213311Ssaidi@eecs.umich.edu}
5223311Ssaidi@eecs.umich.edu
5233311Ssaidi@eecs.umich.eduvoid
5243311Ssaidi@eecs.umich.eduProcess::unserialize(Checkpoint *cp, const std::string &section)
5253311Ssaidi@eecs.umich.edu{
5263311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(brk_point);
5273311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(stack_base);
5283311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(stack_size);
5293311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(stack_min);
5303311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(next_thread_stack_base);
5313311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(mmap_start);
5323311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(mmap_end);
5333311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(nxm_start);
5343311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(nxm_end);
5353311Ssaidi@eecs.umich.edu    pTable->unserialize(cp, section);
5365282Srstrong@cs.ucsd.edu    for (int x = 0; x <= MAX_FD; x++) {
5375282Srstrong@cs.ucsd.edu        fd_map[x].unserialize(cp, csprintf("%s.FdMap%d", section, x));
5387487Ssteve.reinhardt@amd.com    }
5395282Srstrong@cs.ucsd.edu    fix_file_offsets();
5406820SLisa.Hsu@amd.com    UNSERIALIZE_OPT_SCALAR(M5_pid);
5416820SLisa.Hsu@amd.com    // The above returns a bool so that you could do something if you don't
5426820SLisa.Hsu@amd.com    // find the param in the checkpoint if you wanted to, like set a default
5436820SLisa.Hsu@amd.com    // but in this case we'll just stick with the instantianted value if not
5446820SLisa.Hsu@amd.com    // found.
5453311Ssaidi@eecs.umich.edu}
5462SN/A
5472SN/A
5482SN/A////////////////////////////////////////////////////////////////////////
5492SN/A//
5502SN/A// LiveProcess member definitions
5512SN/A//
5522SN/A////////////////////////////////////////////////////////////////////////
5532SN/A
55412SN/A
5555154Sgblack@eecs.umich.eduLiveProcess::LiveProcess(LiveProcessParams * params, ObjectFile *_objFile)
5565154Sgblack@eecs.umich.edu    : Process(params), objFile(_objFile),
5575154Sgblack@eecs.umich.edu      argv(params->cmd), envp(params->env), cwd(params->cwd)
5582SN/A{
5595154Sgblack@eecs.umich.edu    __uid = params->uid;
5605154Sgblack@eecs.umich.edu    __euid = params->euid;
5615154Sgblack@eecs.umich.edu    __gid = params->gid;
5625154Sgblack@eecs.umich.edu    __egid = params->egid;
5635154Sgblack@eecs.umich.edu    __pid = params->pid;
5645154Sgblack@eecs.umich.edu    __ppid = params->ppid;
5653114Sgblack@eecs.umich.edu
5665154Sgblack@eecs.umich.edu    prog_fname = params->cmd[0];
56712SN/A
5681158SN/A    // load up symbols, if any... these may be used for debugging or
5691158SN/A    // profiling.
5701158SN/A    if (!debugSymbolTable) {
5711158SN/A        debugSymbolTable = new SymbolTable();
5721158SN/A        if (!objFile->loadGlobalSymbols(debugSymbolTable) ||
5731158SN/A            !objFile->loadLocalSymbols(debugSymbolTable)) {
5741158SN/A            // didn't load any symbols
5751158SN/A            delete debugSymbolTable;
5761158SN/A            debugSymbolTable = NULL;
5771158SN/A        }
5781158SN/A    }
5792378SN/A}
5801158SN/A
5812378SN/Avoid
5822680Sktlim@umich.eduLiveProcess::syscall(int64_t callnum, ThreadContext *tc)
5832093SN/A{
5842093SN/A    num_syscalls++;
5852093SN/A
5862093SN/A    SyscallDesc *desc = getDesc(callnum);
5872093SN/A    if (desc == NULL)
5882093SN/A        fatal("Syscall %d out of range", callnum);
5892093SN/A
5902680Sktlim@umich.edu    desc->doSyscall(callnum, this, tc);
5912093SN/A}
5922SN/A
5936701Sgblack@eecs.umich.eduIntReg
5946701Sgblack@eecs.umich.eduLiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width)
5956701Sgblack@eecs.umich.edu{
5966701Sgblack@eecs.umich.edu    return getSyscallArg(tc, i);
5976701Sgblack@eecs.umich.edu}
5986701Sgblack@eecs.umich.edu
5992715Sstever@eecs.umich.eduLiveProcess *
6005154Sgblack@eecs.umich.eduLiveProcess::create(LiveProcessParams * params)
6012715Sstever@eecs.umich.edu{
6022715Sstever@eecs.umich.edu    LiveProcess *process = NULL;
6032715Sstever@eecs.umich.edu
6045154Sgblack@eecs.umich.edu    string executable =
6055154Sgblack@eecs.umich.edu        params->executable == "" ? params->cmd[0] : params->executable;
6062715Sstever@eecs.umich.edu    ObjectFile *objFile = createObjectFile(executable);
6072715Sstever@eecs.umich.edu    if (objFile == NULL) {
6082715Sstever@eecs.umich.edu        fatal("Can't load object file %s", executable);
6092715Sstever@eecs.umich.edu    }
6102715Sstever@eecs.umich.edu
6113917Ssaidi@eecs.umich.edu    if (objFile->isDynamic())
6123917Ssaidi@eecs.umich.edu       fatal("Object file is a dynamic executable however only static "
6135070Ssaidi@eecs.umich.edu             "executables are supported!\n       Please recompile your "
6143917Ssaidi@eecs.umich.edu             "executable as a static binary and try again.\n");
6153917Ssaidi@eecs.umich.edu
6165089Sgblack@eecs.umich.edu#if THE_ISA == ALPHA_ISA
6175753Ssteve.reinhardt@amd.com    if (objFile->getArch() != ObjectFile::Alpha)
6185753Ssteve.reinhardt@amd.com        fatal("Object file architecture does not match compiled ISA (Alpha).");
6195753Ssteve.reinhardt@amd.com
6202715Sstever@eecs.umich.edu    switch (objFile->getOpSys()) {
6212715Sstever@eecs.umich.edu      case ObjectFile::Tru64:
6225154Sgblack@eecs.umich.edu        process = new AlphaTru64Process(params, objFile);
6232715Sstever@eecs.umich.edu        break;
6242715Sstever@eecs.umich.edu
6255753Ssteve.reinhardt@amd.com      case ObjectFile::UnknownOpSys:
6265753Ssteve.reinhardt@amd.com        warn("Unknown operating system; assuming Linux.");
6275753Ssteve.reinhardt@amd.com        // fall through
6282715Sstever@eecs.umich.edu      case ObjectFile::Linux:
6295154Sgblack@eecs.umich.edu        process = new AlphaLinuxProcess(params, objFile);
6302715Sstever@eecs.umich.edu        break;
6312715Sstever@eecs.umich.edu
6322715Sstever@eecs.umich.edu      default:
6332715Sstever@eecs.umich.edu        fatal("Unknown/unsupported operating system.");
6342715Sstever@eecs.umich.edu    }
6352715Sstever@eecs.umich.edu#elif THE_ISA == SPARC_ISA
6365753Ssteve.reinhardt@amd.com    if (objFile->getArch() != ObjectFile::SPARC64 &&
6375753Ssteve.reinhardt@amd.com        objFile->getArch() != ObjectFile::SPARC32)
6382715Sstever@eecs.umich.edu        fatal("Object file architecture does not match compiled ISA (SPARC).");
6392715Sstever@eecs.umich.edu    switch (objFile->getOpSys()) {
6405753Ssteve.reinhardt@amd.com      case ObjectFile::UnknownOpSys:
6415753Ssteve.reinhardt@amd.com        warn("Unknown operating system; assuming Linux.");
6425753Ssteve.reinhardt@amd.com        // fall through
6432715Sstever@eecs.umich.edu      case ObjectFile::Linux:
6444111Sgblack@eecs.umich.edu        if (objFile->getArch() == ObjectFile::SPARC64) {
6455154Sgblack@eecs.umich.edu            process = new Sparc64LinuxProcess(params, objFile);
6464111Sgblack@eecs.umich.edu        } else {
6475154Sgblack@eecs.umich.edu            process = new Sparc32LinuxProcess(params, objFile);
6484111Sgblack@eecs.umich.edu        }
6492715Sstever@eecs.umich.edu        break;
6502715Sstever@eecs.umich.edu
6512715Sstever@eecs.umich.edu
6522715Sstever@eecs.umich.edu      case ObjectFile::Solaris:
6535154Sgblack@eecs.umich.edu        process = new SparcSolarisProcess(params, objFile);
6542715Sstever@eecs.umich.edu        break;
6555753Ssteve.reinhardt@amd.com
6562715Sstever@eecs.umich.edu      default:
6572715Sstever@eecs.umich.edu        fatal("Unknown/unsupported operating system.");
6582715Sstever@eecs.umich.edu    }
6594157Sgblack@eecs.umich.edu#elif THE_ISA == X86_ISA
6605874Sgblack@eecs.umich.edu    if (objFile->getArch() != ObjectFile::X86_64 &&
6615874Sgblack@eecs.umich.edu        objFile->getArch() != ObjectFile::I386)
6624166Sgblack@eecs.umich.edu        fatal("Object file architecture does not match compiled ISA (x86).");
6634157Sgblack@eecs.umich.edu    switch (objFile->getOpSys()) {
6645753Ssteve.reinhardt@amd.com      case ObjectFile::UnknownOpSys:
6655753Ssteve.reinhardt@amd.com        warn("Unknown operating system; assuming Linux.");
6665753Ssteve.reinhardt@amd.com        // fall through
6674166Sgblack@eecs.umich.edu      case ObjectFile::Linux:
6685874Sgblack@eecs.umich.edu        if (objFile->getArch() == ObjectFile::X86_64) {
6695955Sgblack@eecs.umich.edu            process = new X86_64LinuxProcess(params, objFile);
6705874Sgblack@eecs.umich.edu        } else {
6715955Sgblack@eecs.umich.edu            process = new I386LinuxProcess(params, objFile);
6725874Sgblack@eecs.umich.edu        }
6734166Sgblack@eecs.umich.edu        break;
6745753Ssteve.reinhardt@amd.com
6754157Sgblack@eecs.umich.edu      default:
6764157Sgblack@eecs.umich.edu        fatal("Unknown/unsupported operating system.");
6774157Sgblack@eecs.umich.edu    }
6782715Sstever@eecs.umich.edu#elif THE_ISA == MIPS_ISA
6792715Sstever@eecs.umich.edu    if (objFile->getArch() != ObjectFile::Mips)
6802715Sstever@eecs.umich.edu        fatal("Object file architecture does not match compiled ISA (MIPS).");
6812715Sstever@eecs.umich.edu    switch (objFile->getOpSys()) {
6825753Ssteve.reinhardt@amd.com      case ObjectFile::UnknownOpSys:
6835753Ssteve.reinhardt@amd.com        warn("Unknown operating system; assuming Linux.");
6845753Ssteve.reinhardt@amd.com        // fall through
6852715Sstever@eecs.umich.edu      case ObjectFile::Linux:
6865154Sgblack@eecs.umich.edu        process = new MipsLinuxProcess(params, objFile);
6872715Sstever@eecs.umich.edu        break;
6882715Sstever@eecs.umich.edu
6892715Sstever@eecs.umich.edu      default:
6902715Sstever@eecs.umich.edu        fatal("Unknown/unsupported operating system.");
6912715Sstever@eecs.umich.edu    }
6925335Shines@cs.fsu.edu#elif THE_ISA == ARM_ISA
6937095Sgblack@eecs.umich.edu    if (objFile->getArch() != ObjectFile::Arm &&
6947095Sgblack@eecs.umich.edu        objFile->getArch() != ObjectFile::Thumb)
6955335Shines@cs.fsu.edu        fatal("Object file architecture does not match compiled ISA (ARM).");
6965335Shines@cs.fsu.edu    switch (objFile->getOpSys()) {
6975753Ssteve.reinhardt@amd.com      case ObjectFile::UnknownOpSys:
6985753Ssteve.reinhardt@amd.com        warn("Unknown operating system; assuming Linux.");
6995753Ssteve.reinhardt@amd.com        // fall through
7005335Shines@cs.fsu.edu      case ObjectFile::Linux:
7017096Sgblack@eecs.umich.edu        process = new ArmLinuxProcess(params, objFile, objFile->getArch());
7025335Shines@cs.fsu.edu        break;
7036392Ssaidi@eecs.umich.edu      case ObjectFile::LinuxArmOABI:
7046392Ssaidi@eecs.umich.edu        fatal("M5 does not support ARM OABI binaries. Please recompile with an"
7056392Ssaidi@eecs.umich.edu              " EABI compiler.");
7065335Shines@cs.fsu.edu      default:
7075335Shines@cs.fsu.edu        fatal("Unknown/unsupported operating system.");
7085335Shines@cs.fsu.edu    }
7096691Stjones1@inf.ed.ac.uk#elif THE_ISA == POWER_ISA
7106691Stjones1@inf.ed.ac.uk    if (objFile->getArch() != ObjectFile::Power)
7116691Stjones1@inf.ed.ac.uk        fatal("Object file architecture does not match compiled ISA (Power).");
7126691Stjones1@inf.ed.ac.uk    switch (objFile->getOpSys()) {
7136691Stjones1@inf.ed.ac.uk      case ObjectFile::UnknownOpSys:
7146691Stjones1@inf.ed.ac.uk        warn("Unknown operating system; assuming Linux.");
7156691Stjones1@inf.ed.ac.uk        // fall through
7166691Stjones1@inf.ed.ac.uk      case ObjectFile::Linux:
7176691Stjones1@inf.ed.ac.uk        process = new PowerLinuxProcess(params, objFile);
7186691Stjones1@inf.ed.ac.uk        break;
7196691Stjones1@inf.ed.ac.uk
7206691Stjones1@inf.ed.ac.uk      default:
7216691Stjones1@inf.ed.ac.uk        fatal("Unknown/unsupported operating system.");
7226691Stjones1@inf.ed.ac.uk    }
7232715Sstever@eecs.umich.edu#else
7242715Sstever@eecs.umich.edu#error "THE_ISA not set"
7252715Sstever@eecs.umich.edu#endif
7262715Sstever@eecs.umich.edu
7272715Sstever@eecs.umich.edu    if (process == NULL)
7282715Sstever@eecs.umich.edu        fatal("Unknown error creating process object.");
7292715Sstever@eecs.umich.edu    return process;
7302715Sstever@eecs.umich.edu}
7312715Sstever@eecs.umich.edu
7324762Snate@binkert.orgLiveProcess *
7334762Snate@binkert.orgLiveProcessParams::create()
7342715Sstever@eecs.umich.edu{
7355154Sgblack@eecs.umich.edu    return LiveProcess::create(this);
7362715Sstever@eecs.umich.edu}
737