process.cc revision 8601
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
338229Snate@binkert.org#include <fcntl.h>
342SN/A#include <unistd.h>
356712Snate@binkert.org
366712Snate@binkert.org#include <cstdio>
372SN/A#include <string>
382SN/A
3956SN/A#include "base/loader/object_file.hh"
401158SN/A#include "base/loader/symtab.hh"
418229Snate@binkert.org#include "base/intmath.hh"
42146SN/A#include "base/statistics.hh"
431858SN/A#include "config/full_system.hh"
446658Snate@binkert.org#include "config/the_isa.hh"
452680Sktlim@umich.edu#include "cpu/thread_context.hh"
462378SN/A#include "mem/page_table.hh"
472522SN/A#include "mem/physical.hh"
482401SN/A#include "mem/translating_port.hh"
498229Snate@binkert.org#include "params/LiveProcess.hh"
505154Sgblack@eecs.umich.edu#include "params/Process.hh"
515512SMichael.Adler@intel.com#include "sim/debug.hh"
52360SN/A#include "sim/process.hh"
534434Ssaidi@eecs.umich.edu#include "sim/process_impl.hh"
54695SN/A#include "sim/stats.hh"
552093SN/A#include "sim/syscall_emul.hh"
562378SN/A#include "sim/system.hh"
572SN/A
582715Sstever@eecs.umich.edu#if THE_ISA == ALPHA_ISA
592715Sstever@eecs.umich.edu#include "arch/alpha/linux/process.hh"
602715Sstever@eecs.umich.edu#include "arch/alpha/tru64/process.hh"
612715Sstever@eecs.umich.edu#elif THE_ISA == SPARC_ISA
622715Sstever@eecs.umich.edu#include "arch/sparc/linux/process.hh"
632715Sstever@eecs.umich.edu#include "arch/sparc/solaris/process.hh"
642715Sstever@eecs.umich.edu#elif THE_ISA == MIPS_ISA
652715Sstever@eecs.umich.edu#include "arch/mips/linux/process.hh"
665335Shines@cs.fsu.edu#elif THE_ISA == ARM_ISA
675335Shines@cs.fsu.edu#include "arch/arm/linux/process.hh"
684157Sgblack@eecs.umich.edu#elif THE_ISA == X86_ISA
694166Sgblack@eecs.umich.edu#include "arch/x86/linux/process.hh"
706691Stjones1@inf.ed.ac.uk#elif THE_ISA == POWER_ISA
716691Stjones1@inf.ed.ac.uk#include "arch/power/linux/process.hh"
722715Sstever@eecs.umich.edu#else
732715Sstever@eecs.umich.edu#error "THE_ISA not set"
742715Sstever@eecs.umich.edu#endif
752715Sstever@eecs.umich.edu
762715Sstever@eecs.umich.edu
772SN/Ausing namespace std;
782107SN/Ausing namespace TheISA;
792SN/A
802SN/A//
812SN/A// The purpose of this code is to fake the loader & syscall mechanism
822SN/A// when there's no OS: thus there's no resone to use it in FULL_SYSTEM
832SN/A// mode when we do have an OS
842SN/A//
851858SN/A#if FULL_SYSTEM
86360SN/A#error "process.cc not compatible with FULL_SYSTEM"
872SN/A#endif
882SN/A
892SN/A// current number of allocated processes
902SN/Aint num_processes = 0;
912SN/A
925758Shsul@eecs.umich.edutemplate<class IntType>
935771Shsul@eecs.umich.eduAuxVector<IntType>::AuxVector(IntType type, IntType val)
945758Shsul@eecs.umich.edu{
955758Shsul@eecs.umich.edu    a_type = TheISA::htog(type);
965758Shsul@eecs.umich.edu    a_val = TheISA::htog(val);
975758Shsul@eecs.umich.edu}
985758Shsul@eecs.umich.edu
995771Shsul@eecs.umich.edutemplate class AuxVector<uint32_t>;
1005771Shsul@eecs.umich.edutemplate class AuxVector<uint64_t>;
1015758Shsul@eecs.umich.edu
1025154Sgblack@eecs.umich.eduProcess::Process(ProcessParams * params)
1037532Ssteve.reinhardt@amd.com    : SimObject(params), system(params->system),
1047532Ssteve.reinhardt@amd.com      max_stack_size(params->max_stack_size)
1052SN/A{
1065154Sgblack@eecs.umich.edu    string in = params->input;
1075154Sgblack@eecs.umich.edu    string out = params->output;
1085514SMichael.Adler@intel.com    string err = params->errout;
1095154Sgblack@eecs.umich.edu
1105154Sgblack@eecs.umich.edu    // initialize file descriptors to default: same as simulator
1115154Sgblack@eecs.umich.edu    int stdin_fd, stdout_fd, stderr_fd;
1125154Sgblack@eecs.umich.edu
1135154Sgblack@eecs.umich.edu    if (in == "stdin" || in == "cin")
1145154Sgblack@eecs.umich.edu        stdin_fd = STDIN_FILENO;
1155154Sgblack@eecs.umich.edu    else if (in == "None")
1165154Sgblack@eecs.umich.edu        stdin_fd = -1;
1175154Sgblack@eecs.umich.edu    else
1185154Sgblack@eecs.umich.edu        stdin_fd = Process::openInputFile(in);
1195154Sgblack@eecs.umich.edu
1205154Sgblack@eecs.umich.edu    if (out == "stdout" || out == "cout")
1215154Sgblack@eecs.umich.edu        stdout_fd = STDOUT_FILENO;
1225154Sgblack@eecs.umich.edu    else if (out == "stderr" || out == "cerr")
1235154Sgblack@eecs.umich.edu        stdout_fd = STDERR_FILENO;
1245154Sgblack@eecs.umich.edu    else if (out == "None")
1255154Sgblack@eecs.umich.edu        stdout_fd = -1;
1265154Sgblack@eecs.umich.edu    else
1275154Sgblack@eecs.umich.edu        stdout_fd = Process::openOutputFile(out);
1285154Sgblack@eecs.umich.edu
1295514SMichael.Adler@intel.com    if (err == "stdout" || err == "cout")
1305514SMichael.Adler@intel.com        stderr_fd = STDOUT_FILENO;
1315514SMichael.Adler@intel.com    else if (err == "stderr" || err == "cerr")
1325514SMichael.Adler@intel.com        stderr_fd = STDERR_FILENO;
1335514SMichael.Adler@intel.com    else if (err == "None")
1345514SMichael.Adler@intel.com        stderr_fd = -1;
1355514SMichael.Adler@intel.com    else if (err == out)
1365514SMichael.Adler@intel.com        stderr_fd = stdout_fd;
1375514SMichael.Adler@intel.com    else
1385514SMichael.Adler@intel.com        stderr_fd = Process::openOutputFile(err);
1395154Sgblack@eecs.umich.edu
1404997Sgblack@eecs.umich.edu    M5_pid = system->allocatePID();
1412SN/A    // initialize first 3 fds (stdin, stdout, stderr)
1425282Srstrong@cs.ucsd.edu    Process::FdMap *fdo = &fd_map[STDIN_FILENO];
1435282Srstrong@cs.ucsd.edu    fdo->fd = stdin_fd;
1445282Srstrong@cs.ucsd.edu    fdo->filename = in;
1455282Srstrong@cs.ucsd.edu    fdo->flags = O_RDONLY;
1465282Srstrong@cs.ucsd.edu    fdo->mode = -1;
1475282Srstrong@cs.ucsd.edu    fdo->fileOffset = 0;
1485282Srstrong@cs.ucsd.edu
1495282Srstrong@cs.ucsd.edu    fdo =  &fd_map[STDOUT_FILENO];
1505282Srstrong@cs.ucsd.edu    fdo->fd = stdout_fd;
1515282Srstrong@cs.ucsd.edu    fdo->filename = out;
1525282Srstrong@cs.ucsd.edu    fdo->flags =  O_WRONLY | O_CREAT | O_TRUNC;
1535282Srstrong@cs.ucsd.edu    fdo->mode = 0774;
1545282Srstrong@cs.ucsd.edu    fdo->fileOffset = 0;
1555282Srstrong@cs.ucsd.edu
1565282Srstrong@cs.ucsd.edu    fdo = &fd_map[STDERR_FILENO];
1575282Srstrong@cs.ucsd.edu    fdo->fd = stderr_fd;
1585514SMichael.Adler@intel.com    fdo->filename = err;
1595282Srstrong@cs.ucsd.edu    fdo->flags = O_WRONLY;
1605282Srstrong@cs.ucsd.edu    fdo->mode = -1;
1615282Srstrong@cs.ucsd.edu    fdo->fileOffset = 0;
1625282Srstrong@cs.ucsd.edu
1632SN/A
1642SN/A    // mark remaining fds as free
1652SN/A    for (int i = 3; i <= MAX_FD; ++i) {
1665282Srstrong@cs.ucsd.edu        Process::FdMap *fdo = &fd_map[i];
1675282Srstrong@cs.ucsd.edu        fdo->fd = -1;
1682SN/A    }
1692SN/A
1701450SN/A    mmap_start = mmap_end = 0;
1711514SN/A    nxm_start = nxm_end = 0;
1728601Ssteve.reinhardt@amd.com    pTable = new PageTable(name(), M5_pid);
1732SN/A    // other parameters will be initialized when the program is loaded
1742SN/A}
1752SN/A
1762378SN/A
1772SN/Avoid
1782SN/AProcess::regStats()
1792SN/A{
180729SN/A    using namespace Stats;
1812SN/A
1822SN/A    num_syscalls
1838240Snate@binkert.org        .name(name() + ".num_syscalls")
1842SN/A        .desc("Number of system calls")
1852SN/A        ;
1862SN/A}
1872SN/A
1882SN/A//
1892SN/A// static helper functions
1902SN/A//
1912SN/Aint
1922SN/AProcess::openInputFile(const string &filename)
1932SN/A{
1942SN/A    int fd = open(filename.c_str(), O_RDONLY);
1952SN/A
1962SN/A    if (fd == -1) {
1972SN/A        perror(NULL);
1982SN/A        cerr << "unable to open \"" << filename << "\" for reading\n";
1992SN/A        fatal("can't open input file");
2002SN/A    }
2012SN/A
2022SN/A    return fd;
2032SN/A}
2042SN/A
2052SN/A
2062SN/Aint
2072SN/AProcess::openOutputFile(const string &filename)
2082SN/A{
2095514SMichael.Adler@intel.com    int fd = open(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0664);
2102SN/A
2112SN/A    if (fd == -1) {
2122SN/A        perror(NULL);
2132SN/A        cerr << "unable to open \"" << filename << "\" for writing\n";
2142SN/A        fatal("can't open output file");
2152SN/A    }
2162SN/A
2172SN/A    return fd;
2182SN/A}
2192SN/A
2205713Shsul@eecs.umich.eduThreadContext *
2215713Shsul@eecs.umich.eduProcess::findFreeContext()
2222SN/A{
2235713Shsul@eecs.umich.edu    int size = contextIds.size();
2245713Shsul@eecs.umich.edu    ThreadContext *tc;
2255713Shsul@eecs.umich.edu    for (int i = 0; i < size; ++i) {
2265713Shsul@eecs.umich.edu        tc = system->getThreadContext(contextIds[i]);
2276029Ssteve.reinhardt@amd.com        if (tc->status() == ThreadContext::Halted) {
2285713Shsul@eecs.umich.edu            // inactive context, free to use
2295713Shsul@eecs.umich.edu            return tc;
2305713Shsul@eecs.umich.edu        }
2315512SMichael.Adler@intel.com    }
2325713Shsul@eecs.umich.edu    return NULL;
2332SN/A}
2342SN/A
2351395SN/Avoid
2367532Ssteve.reinhardt@amd.comProcess::initState()
2371395SN/A{
2385713Shsul@eecs.umich.edu    if (contextIds.empty())
2395713Shsul@eecs.umich.edu        fatal("Process %s is not associated with any HW contexts!\n", name());
2402378SN/A
2412680Sktlim@umich.edu    // first thread context for this process... initialize & enable
2425713Shsul@eecs.umich.edu    ThreadContext *tc = system->getThreadContext(contextIds[0]);
2431395SN/A
2441634SN/A    // mark this context as active so it will start ticking.
2452680Sktlim@umich.edu    tc->activate(0);
2462462SN/A
2472519SN/A    Port *mem_port;
2482519SN/A    mem_port = system->physmem->getPort("functional");
2494434Ssaidi@eecs.umich.edu    initVirtMem = new TranslatingPort("process init port", this,
2504434Ssaidi@eecs.umich.edu            TranslatingPort::Always);
2512519SN/A    mem_port->setPeer(initVirtMem);
2522519SN/A    initVirtMem->setPeer(mem_port);
2531395SN/A}
2542SN/A
2552SN/A// map simulator fd sim_fd to target fd tgt_fd
2562SN/Avoid
2572SN/AProcess::dup_fd(int sim_fd, int tgt_fd)
2582SN/A{
2592SN/A    if (tgt_fd < 0 || tgt_fd > MAX_FD)
2602SN/A        panic("Process::dup_fd tried to dup past MAX_FD (%d)", tgt_fd);
2612SN/A
2625282Srstrong@cs.ucsd.edu    Process::FdMap *fdo = &fd_map[tgt_fd];
2635282Srstrong@cs.ucsd.edu    fdo->fd = sim_fd;
2642SN/A}
2652SN/A
2662SN/A
2672SN/A// generate new target fd for sim_fd
2682SN/Aint
2695282Srstrong@cs.ucsd.eduProcess::alloc_fd(int sim_fd, string filename, int flags, int mode, bool pipe)
2702SN/A{
2712SN/A    // in case open() returns an error, don't allocate a new fd
2722SN/A    if (sim_fd == -1)
2732SN/A        return -1;
2742SN/A
2752SN/A    // find first free target fd
2765282Srstrong@cs.ucsd.edu    for (int free_fd = 0; free_fd <= MAX_FD; ++free_fd) {
2775282Srstrong@cs.ucsd.edu        Process::FdMap *fdo = &fd_map[free_fd];
2785282Srstrong@cs.ucsd.edu        if (fdo->fd == -1) {
2795282Srstrong@cs.ucsd.edu            fdo->fd = sim_fd;
2805282Srstrong@cs.ucsd.edu            fdo->filename = filename;
2815282Srstrong@cs.ucsd.edu            fdo->mode = mode;
2825282Srstrong@cs.ucsd.edu            fdo->fileOffset = 0;
2835282Srstrong@cs.ucsd.edu            fdo->flags = flags;
2845282Srstrong@cs.ucsd.edu            fdo->isPipe = pipe;
2855282Srstrong@cs.ucsd.edu            fdo->readPipeSource = 0;
2861970SN/A            return free_fd;
2871970SN/A        }
2882SN/A    }
2892SN/A
2901970SN/A    panic("Process::alloc_fd: out of file descriptors!");
2911970SN/A}
2922SN/A
2931970SN/A
2941970SN/A// free target fd (e.g., after close)
2951970SN/Avoid
2961970SN/AProcess::free_fd(int tgt_fd)
2971970SN/A{
2985282Srstrong@cs.ucsd.edu    Process::FdMap *fdo = &fd_map[tgt_fd];
2995282Srstrong@cs.ucsd.edu    if (fdo->fd == -1)
3001970SN/A        warn("Process::free_fd: request to free unused fd %d", tgt_fd);
3011970SN/A
3025282Srstrong@cs.ucsd.edu    fdo->fd = -1;
3035282Srstrong@cs.ucsd.edu    fdo->filename = "NULL";
3045282Srstrong@cs.ucsd.edu    fdo->mode = 0;
3055282Srstrong@cs.ucsd.edu    fdo->fileOffset = 0;
3065282Srstrong@cs.ucsd.edu    fdo->flags = 0;
3075282Srstrong@cs.ucsd.edu    fdo->isPipe = false;
3085282Srstrong@cs.ucsd.edu    fdo->readPipeSource = 0;
3092SN/A}
3102SN/A
3112SN/A
3122SN/A// look up simulator fd for given target fd
3132SN/Aint
3142SN/AProcess::sim_fd(int tgt_fd)
3152SN/A{
3168324Ssteve.reinhardt@amd.com    if (tgt_fd < 0 || tgt_fd > MAX_FD)
3172SN/A        return -1;
3182SN/A
3195282Srstrong@cs.ucsd.edu    return fd_map[tgt_fd].fd;
3202SN/A}
3212SN/A
3225282Srstrong@cs.ucsd.eduProcess::FdMap *
3235282Srstrong@cs.ucsd.eduProcess::sim_fd_obj(int tgt_fd)
3245282Srstrong@cs.ucsd.edu{
3258324Ssteve.reinhardt@amd.com    if (tgt_fd < 0 || tgt_fd > MAX_FD)
3268324Ssteve.reinhardt@amd.com        return NULL;
3275282Srstrong@cs.ucsd.edu
3285282Srstrong@cs.ucsd.edu    return &fd_map[tgt_fd];
3295282Srstrong@cs.ucsd.edu}
3307487Ssteve.reinhardt@amd.com
3318601Ssteve.reinhardt@amd.comvoid
3328601Ssteve.reinhardt@amd.comProcess::allocateMem(Addr vaddr, int64_t size, bool clobber)
3338601Ssteve.reinhardt@amd.com{
3348601Ssteve.reinhardt@amd.com    int npages = divCeil(size, (int64_t)VMPageSize);
3358601Ssteve.reinhardt@amd.com    Addr paddr = system->allocPhysPages(npages);
3368601Ssteve.reinhardt@amd.com    pTable->map(vaddr, paddr, size, clobber);
3378601Ssteve.reinhardt@amd.com}
3388601Ssteve.reinhardt@amd.com
3394434Ssaidi@eecs.umich.edubool
3408539Sgblack@eecs.umich.eduProcess::fixupStackFault(Addr vaddr)
3414434Ssaidi@eecs.umich.edu{
3428539Sgblack@eecs.umich.edu    // Check if this is already on the stack and there's just no page there
3438539Sgblack@eecs.umich.edu    // yet.
3444434Ssaidi@eecs.umich.edu    if (vaddr >= stack_min && vaddr < stack_base) {
3458601Ssteve.reinhardt@amd.com        allocateMem(roundDown(vaddr, VMPageSize), VMPageSize);
3464434Ssaidi@eecs.umich.edu        return true;
3474434Ssaidi@eecs.umich.edu    }
3484434Ssaidi@eecs.umich.edu
3498539Sgblack@eecs.umich.edu    // We've accessed the next page of the stack, so extend it to include
3508539Sgblack@eecs.umich.edu    // this address.
3515154Sgblack@eecs.umich.edu    if (vaddr < stack_min && vaddr >= stack_base - max_stack_size) {
3525154Sgblack@eecs.umich.edu        while (vaddr < stack_min) {
3535154Sgblack@eecs.umich.edu            stack_min -= TheISA::PageBytes;
3548539Sgblack@eecs.umich.edu            if (stack_base - stack_min > max_stack_size)
3555154Sgblack@eecs.umich.edu                fatal("Maximum stack size exceeded\n");
3568539Sgblack@eecs.umich.edu            if (stack_base - stack_min > 8 * 1024 * 1024)
3575154Sgblack@eecs.umich.edu                fatal("Over max stack size for one thread\n");
3588601Ssteve.reinhardt@amd.com            allocateMem(stack_min, TheISA::PageBytes);
3595823Ssaidi@eecs.umich.edu            inform("Increasing stack size by one page.");
3605154Sgblack@eecs.umich.edu        };
3614434Ssaidi@eecs.umich.edu        return true;
3624434Ssaidi@eecs.umich.edu    }
3638539Sgblack@eecs.umich.edu    warn("Not extending stack: address %#x isn't at the end of the stack.",
3648539Sgblack@eecs.umich.edu        vaddr);
3654434Ssaidi@eecs.umich.edu    return false;
3664434Ssaidi@eecs.umich.edu}
3674434Ssaidi@eecs.umich.edu
3687487Ssteve.reinhardt@amd.com// find all offsets for currently open files and save them
3695282Srstrong@cs.ucsd.eduvoid
3707487Ssteve.reinhardt@amd.comProcess::fix_file_offsets()
3717487Ssteve.reinhardt@amd.com{
3725282Srstrong@cs.ucsd.edu    Process::FdMap *fdo_stdin = &fd_map[STDIN_FILENO];
3735282Srstrong@cs.ucsd.edu    Process::FdMap *fdo_stdout = &fd_map[STDOUT_FILENO];
3745282Srstrong@cs.ucsd.edu    Process::FdMap *fdo_stderr = &fd_map[STDERR_FILENO];
3755282Srstrong@cs.ucsd.edu    string in = fdo_stdin->filename;
3765282Srstrong@cs.ucsd.edu    string out = fdo_stdout->filename;
3775514SMichael.Adler@intel.com    string err = fdo_stderr->filename;
3785282Srstrong@cs.ucsd.edu
3795282Srstrong@cs.ucsd.edu    // initialize file descriptors to default: same as simulator
3805282Srstrong@cs.ucsd.edu    int stdin_fd, stdout_fd, stderr_fd;
3815282Srstrong@cs.ucsd.edu
3825282Srstrong@cs.ucsd.edu    if (in == "stdin" || in == "cin")
3835282Srstrong@cs.ucsd.edu        stdin_fd = STDIN_FILENO;
3845282Srstrong@cs.ucsd.edu    else if (in == "None")
3855282Srstrong@cs.ucsd.edu        stdin_fd = -1;
3867487Ssteve.reinhardt@amd.com    else {
3877487Ssteve.reinhardt@amd.com        // open standard in and seek to the right location
3885282Srstrong@cs.ucsd.edu        stdin_fd = Process::openInputFile(in);
3895282Srstrong@cs.ucsd.edu        if (lseek(stdin_fd, fdo_stdin->fileOffset, SEEK_SET) < 0)
3905282Srstrong@cs.ucsd.edu            panic("Unable to seek to correct location in file: %s", in);
3915282Srstrong@cs.ucsd.edu    }
3925282Srstrong@cs.ucsd.edu
3935282Srstrong@cs.ucsd.edu    if (out == "stdout" || out == "cout")
3945282Srstrong@cs.ucsd.edu        stdout_fd = STDOUT_FILENO;
3955282Srstrong@cs.ucsd.edu    else if (out == "stderr" || out == "cerr")
3965282Srstrong@cs.ucsd.edu        stdout_fd = STDERR_FILENO;
3975282Srstrong@cs.ucsd.edu    else if (out == "None")
3985282Srstrong@cs.ucsd.edu        stdout_fd = -1;
3997487Ssteve.reinhardt@amd.com    else {
4005282Srstrong@cs.ucsd.edu        stdout_fd = Process::openOutputFile(out);
4015514SMichael.Adler@intel.com        if (lseek(stdout_fd, fdo_stdout->fileOffset, SEEK_SET) < 0)
4025514SMichael.Adler@intel.com            panic("Unable to seek to correct location in file: %s", out);
4035282Srstrong@cs.ucsd.edu    }
4045282Srstrong@cs.ucsd.edu
4055514SMichael.Adler@intel.com    if (err == "stdout" || err == "cout")
4065514SMichael.Adler@intel.com        stderr_fd = STDOUT_FILENO;
4075514SMichael.Adler@intel.com    else if (err == "stderr" || err == "cerr")
4085514SMichael.Adler@intel.com        stderr_fd = STDERR_FILENO;
4095514SMichael.Adler@intel.com    else if (err == "None")
4105514SMichael.Adler@intel.com        stderr_fd = -1;
4115514SMichael.Adler@intel.com    else if (err == out)
4125514SMichael.Adler@intel.com        stderr_fd = stdout_fd;
4135514SMichael.Adler@intel.com    else {
4145514SMichael.Adler@intel.com        stderr_fd = Process::openOutputFile(err);
4155514SMichael.Adler@intel.com        if (lseek(stderr_fd, fdo_stderr->fileOffset, SEEK_SET) < 0)
4165514SMichael.Adler@intel.com            panic("Unable to seek to correct location in file: %s", err);
4175514SMichael.Adler@intel.com    }
4185282Srstrong@cs.ucsd.edu
4195282Srstrong@cs.ucsd.edu    fdo_stdin->fd = stdin_fd;
4205282Srstrong@cs.ucsd.edu    fdo_stdout->fd = stdout_fd;
4215282Srstrong@cs.ucsd.edu    fdo_stderr->fd = stderr_fd;
4225282Srstrong@cs.ucsd.edu
4235282Srstrong@cs.ucsd.edu
4245282Srstrong@cs.ucsd.edu    for (int free_fd = 3; free_fd <= MAX_FD; ++free_fd) {
4255282Srstrong@cs.ucsd.edu        Process::FdMap *fdo = &fd_map[free_fd];
4265282Srstrong@cs.ucsd.edu        if (fdo->fd != -1) {
4275282Srstrong@cs.ucsd.edu            if (fdo->isPipe){
4285282Srstrong@cs.ucsd.edu                if (fdo->filename == "PIPE-WRITE")
4295282Srstrong@cs.ucsd.edu                    continue;
4305282Srstrong@cs.ucsd.edu                else {
4315282Srstrong@cs.ucsd.edu                    assert (fdo->filename == "PIPE-READ");
4325282Srstrong@cs.ucsd.edu                    //create a new pipe
4335282Srstrong@cs.ucsd.edu                    int fds[2];
4345282Srstrong@cs.ucsd.edu                    int pipe_retval = pipe(fds);
4355282Srstrong@cs.ucsd.edu
4365282Srstrong@cs.ucsd.edu                    if (pipe_retval < 0) {
4375282Srstrong@cs.ucsd.edu                        // error
4385282Srstrong@cs.ucsd.edu                        panic("Unable to create new pipe.");
4395282Srstrong@cs.ucsd.edu                    }
4405282Srstrong@cs.ucsd.edu                    fdo->fd = fds[0]; //set read pipe
4415282Srstrong@cs.ucsd.edu                    Process::FdMap *fdo_write = &fd_map[fdo->readPipeSource];
4425282Srstrong@cs.ucsd.edu                    if (fdo_write->filename != "PIPE-WRITE")
4435282Srstrong@cs.ucsd.edu                        panic ("Couldn't find write end of the pipe");
4445282Srstrong@cs.ucsd.edu
4455282Srstrong@cs.ucsd.edu                    fdo_write->fd = fds[1];//set write pipe
4465282Srstrong@cs.ucsd.edu               }
4475282Srstrong@cs.ucsd.edu            } else {
4485282Srstrong@cs.ucsd.edu                //Open file
4495282Srstrong@cs.ucsd.edu                int fd = open(fdo->filename.c_str(), fdo->flags, fdo->mode);
4505282Srstrong@cs.ucsd.edu
4515282Srstrong@cs.ucsd.edu                if (fd == -1)
4525282Srstrong@cs.ucsd.edu                    panic("Unable to open file: %s", fdo->filename);
4535282Srstrong@cs.ucsd.edu                fdo->fd = fd;
4545282Srstrong@cs.ucsd.edu
4555282Srstrong@cs.ucsd.edu                //Seek to correct location before checkpoint
4565282Srstrong@cs.ucsd.edu                if (lseek(fd,fdo->fileOffset, SEEK_SET) < 0)
4577487Ssteve.reinhardt@amd.com                    panic("Unable to seek to correct location in file: %s",
4587487Ssteve.reinhardt@amd.com                          fdo->filename);
4595282Srstrong@cs.ucsd.edu            }
4605282Srstrong@cs.ucsd.edu        }
4615282Srstrong@cs.ucsd.edu    }
4625282Srstrong@cs.ucsd.edu}
4637487Ssteve.reinhardt@amd.com
4645282Srstrong@cs.ucsd.eduvoid
4657487Ssteve.reinhardt@amd.comProcess::find_file_offsets()
4667487Ssteve.reinhardt@amd.com{
4675282Srstrong@cs.ucsd.edu    for (int free_fd = 0; free_fd <= MAX_FD; ++free_fd) {
4685282Srstrong@cs.ucsd.edu        Process::FdMap *fdo = &fd_map[free_fd];
4695282Srstrong@cs.ucsd.edu        if (fdo->fd != -1) {
4705282Srstrong@cs.ucsd.edu            fdo->fileOffset = lseek(fdo->fd, 0, SEEK_CUR);
4717487Ssteve.reinhardt@amd.com        } else {
4725282Srstrong@cs.ucsd.edu                fdo->filename = "NULL";
4735282Srstrong@cs.ucsd.edu                fdo->fileOffset = 0;
4745282Srstrong@cs.ucsd.edu        }
4755282Srstrong@cs.ucsd.edu    }
4765282Srstrong@cs.ucsd.edu}
4775282Srstrong@cs.ucsd.edu
4785282Srstrong@cs.ucsd.eduvoid
4797487Ssteve.reinhardt@amd.comProcess::setReadPipeSource(int read_pipe_fd, int source_fd)
4807487Ssteve.reinhardt@amd.com{
4815282Srstrong@cs.ucsd.edu    Process::FdMap *fdo = &fd_map[read_pipe_fd];
4825282Srstrong@cs.ucsd.edu    fdo->readPipeSource = source_fd;
4835282Srstrong@cs.ucsd.edu}
4845282Srstrong@cs.ucsd.edu
4855282Srstrong@cs.ucsd.eduvoid
4865282Srstrong@cs.ucsd.eduProcess::FdMap::serialize(std::ostream &os)
4875282Srstrong@cs.ucsd.edu{
4885282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(fd);
4895282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(isPipe);
4905282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(filename);
4915282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(flags);
4925282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(readPipeSource);
4935282Srstrong@cs.ucsd.edu    SERIALIZE_SCALAR(fileOffset);
4945282Srstrong@cs.ucsd.edu}
4955282Srstrong@cs.ucsd.edu
4965282Srstrong@cs.ucsd.eduvoid
4975282Srstrong@cs.ucsd.eduProcess::FdMap::unserialize(Checkpoint *cp, const std::string &section)
4985282Srstrong@cs.ucsd.edu{
4995282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(fd);
5005282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(isPipe);
5015282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(filename);
5025282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(flags);
5035282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(readPipeSource);
5045282Srstrong@cs.ucsd.edu    UNSERIALIZE_SCALAR(fileOffset);
5055282Srstrong@cs.ucsd.edu}
5065282Srstrong@cs.ucsd.edu
5073311Ssaidi@eecs.umich.eduvoid
5083311Ssaidi@eecs.umich.eduProcess::serialize(std::ostream &os)
5093311Ssaidi@eecs.umich.edu{
5103311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(brk_point);
5113311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(stack_base);
5123311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(stack_size);
5133311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(stack_min);
5143311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(next_thread_stack_base);
5153311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(mmap_start);
5163311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(mmap_end);
5173311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(nxm_start);
5183311Ssaidi@eecs.umich.edu    SERIALIZE_SCALAR(nxm_end);
5195282Srstrong@cs.ucsd.edu    find_file_offsets();
5205282Srstrong@cs.ucsd.edu    pTable->serialize(os);
5215282Srstrong@cs.ucsd.edu    for (int x = 0; x <= MAX_FD; x++) {
5225282Srstrong@cs.ucsd.edu        nameOut(os, csprintf("%s.FdMap%d", name(), x));
5235282Srstrong@cs.ucsd.edu        fd_map[x].serialize(os);
5245282Srstrong@cs.ucsd.edu    }
5256820SLisa.Hsu@amd.com    SERIALIZE_SCALAR(M5_pid);
5263311Ssaidi@eecs.umich.edu
5273311Ssaidi@eecs.umich.edu}
5283311Ssaidi@eecs.umich.edu
5293311Ssaidi@eecs.umich.eduvoid
5303311Ssaidi@eecs.umich.eduProcess::unserialize(Checkpoint *cp, const std::string &section)
5313311Ssaidi@eecs.umich.edu{
5323311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(brk_point);
5333311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(stack_base);
5343311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(stack_size);
5353311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(stack_min);
5363311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(next_thread_stack_base);
5373311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(mmap_start);
5383311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(mmap_end);
5393311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(nxm_start);
5403311Ssaidi@eecs.umich.edu    UNSERIALIZE_SCALAR(nxm_end);
5413311Ssaidi@eecs.umich.edu    pTable->unserialize(cp, section);
5425282Srstrong@cs.ucsd.edu    for (int x = 0; x <= MAX_FD; x++) {
5435282Srstrong@cs.ucsd.edu        fd_map[x].unserialize(cp, csprintf("%s.FdMap%d", section, x));
5447487Ssteve.reinhardt@amd.com    }
5455282Srstrong@cs.ucsd.edu    fix_file_offsets();
5466820SLisa.Hsu@amd.com    UNSERIALIZE_OPT_SCALAR(M5_pid);
5476820SLisa.Hsu@amd.com    // The above returns a bool so that you could do something if you don't
5486820SLisa.Hsu@amd.com    // find the param in the checkpoint if you wanted to, like set a default
5496820SLisa.Hsu@amd.com    // but in this case we'll just stick with the instantianted value if not
5506820SLisa.Hsu@amd.com    // found.
5513311Ssaidi@eecs.umich.edu}
5522SN/A
5532SN/A
5542SN/A////////////////////////////////////////////////////////////////////////
5552SN/A//
5562SN/A// LiveProcess member definitions
5572SN/A//
5582SN/A////////////////////////////////////////////////////////////////////////
5592SN/A
56012SN/A
5615154Sgblack@eecs.umich.eduLiveProcess::LiveProcess(LiveProcessParams * params, ObjectFile *_objFile)
5625154Sgblack@eecs.umich.edu    : Process(params), objFile(_objFile),
5635154Sgblack@eecs.umich.edu      argv(params->cmd), envp(params->env), cwd(params->cwd)
5642SN/A{
5655154Sgblack@eecs.umich.edu    __uid = params->uid;
5665154Sgblack@eecs.umich.edu    __euid = params->euid;
5675154Sgblack@eecs.umich.edu    __gid = params->gid;
5685154Sgblack@eecs.umich.edu    __egid = params->egid;
5695154Sgblack@eecs.umich.edu    __pid = params->pid;
5705154Sgblack@eecs.umich.edu    __ppid = params->ppid;
5713114Sgblack@eecs.umich.edu
5725154Sgblack@eecs.umich.edu    prog_fname = params->cmd[0];
57312SN/A
5741158SN/A    // load up symbols, if any... these may be used for debugging or
5751158SN/A    // profiling.
5761158SN/A    if (!debugSymbolTable) {
5771158SN/A        debugSymbolTable = new SymbolTable();
5781158SN/A        if (!objFile->loadGlobalSymbols(debugSymbolTable) ||
5791158SN/A            !objFile->loadLocalSymbols(debugSymbolTable)) {
5801158SN/A            // didn't load any symbols
5811158SN/A            delete debugSymbolTable;
5821158SN/A            debugSymbolTable = NULL;
5831158SN/A        }
5841158SN/A    }
5852378SN/A}
5861158SN/A
5872378SN/Avoid
5882680Sktlim@umich.eduLiveProcess::syscall(int64_t callnum, ThreadContext *tc)
5892093SN/A{
5902093SN/A    num_syscalls++;
5912093SN/A
5922093SN/A    SyscallDesc *desc = getDesc(callnum);
5932093SN/A    if (desc == NULL)
5942093SN/A        fatal("Syscall %d out of range", callnum);
5952093SN/A
5962680Sktlim@umich.edu    desc->doSyscall(callnum, this, tc);
5972093SN/A}
5982SN/A
5996701Sgblack@eecs.umich.eduIntReg
6006701Sgblack@eecs.umich.eduLiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width)
6016701Sgblack@eecs.umich.edu{
6026701Sgblack@eecs.umich.edu    return getSyscallArg(tc, i);
6036701Sgblack@eecs.umich.edu}
6046701Sgblack@eecs.umich.edu
6052715Sstever@eecs.umich.eduLiveProcess *
6065154Sgblack@eecs.umich.eduLiveProcess::create(LiveProcessParams * params)
6072715Sstever@eecs.umich.edu{
6082715Sstever@eecs.umich.edu    LiveProcess *process = NULL;
6092715Sstever@eecs.umich.edu
6105154Sgblack@eecs.umich.edu    string executable =
6115154Sgblack@eecs.umich.edu        params->executable == "" ? params->cmd[0] : params->executable;
6122715Sstever@eecs.umich.edu    ObjectFile *objFile = createObjectFile(executable);
6132715Sstever@eecs.umich.edu    if (objFile == NULL) {
6142715Sstever@eecs.umich.edu        fatal("Can't load object file %s", executable);
6152715Sstever@eecs.umich.edu    }
6162715Sstever@eecs.umich.edu
6173917Ssaidi@eecs.umich.edu    if (objFile->isDynamic())
6183917Ssaidi@eecs.umich.edu       fatal("Object file is a dynamic executable however only static "
6195070Ssaidi@eecs.umich.edu             "executables are supported!\n       Please recompile your "
6203917Ssaidi@eecs.umich.edu             "executable as a static binary and try again.\n");
6213917Ssaidi@eecs.umich.edu
6225089Sgblack@eecs.umich.edu#if THE_ISA == ALPHA_ISA
6235753Ssteve.reinhardt@amd.com    if (objFile->getArch() != ObjectFile::Alpha)
6245753Ssteve.reinhardt@amd.com        fatal("Object file architecture does not match compiled ISA (Alpha).");
6255753Ssteve.reinhardt@amd.com
6262715Sstever@eecs.umich.edu    switch (objFile->getOpSys()) {
6272715Sstever@eecs.umich.edu      case ObjectFile::Tru64:
6285154Sgblack@eecs.umich.edu        process = new AlphaTru64Process(params, objFile);
6292715Sstever@eecs.umich.edu        break;
6302715Sstever@eecs.umich.edu
6315753Ssteve.reinhardt@amd.com      case ObjectFile::UnknownOpSys:
6325753Ssteve.reinhardt@amd.com        warn("Unknown operating system; assuming Linux.");
6335753Ssteve.reinhardt@amd.com        // fall through
6342715Sstever@eecs.umich.edu      case ObjectFile::Linux:
6355154Sgblack@eecs.umich.edu        process = new AlphaLinuxProcess(params, objFile);
6362715Sstever@eecs.umich.edu        break;
6372715Sstever@eecs.umich.edu
6382715Sstever@eecs.umich.edu      default:
6392715Sstever@eecs.umich.edu        fatal("Unknown/unsupported operating system.");
6402715Sstever@eecs.umich.edu    }
6412715Sstever@eecs.umich.edu#elif THE_ISA == SPARC_ISA
6425753Ssteve.reinhardt@amd.com    if (objFile->getArch() != ObjectFile::SPARC64 &&
6435753Ssteve.reinhardt@amd.com        objFile->getArch() != ObjectFile::SPARC32)
6442715Sstever@eecs.umich.edu        fatal("Object file architecture does not match compiled ISA (SPARC).");
6452715Sstever@eecs.umich.edu    switch (objFile->getOpSys()) {
6465753Ssteve.reinhardt@amd.com      case ObjectFile::UnknownOpSys:
6475753Ssteve.reinhardt@amd.com        warn("Unknown operating system; assuming Linux.");
6485753Ssteve.reinhardt@amd.com        // fall through
6492715Sstever@eecs.umich.edu      case ObjectFile::Linux:
6504111Sgblack@eecs.umich.edu        if (objFile->getArch() == ObjectFile::SPARC64) {
6515154Sgblack@eecs.umich.edu            process = new Sparc64LinuxProcess(params, objFile);
6524111Sgblack@eecs.umich.edu        } else {
6535154Sgblack@eecs.umich.edu            process = new Sparc32LinuxProcess(params, objFile);
6544111Sgblack@eecs.umich.edu        }
6552715Sstever@eecs.umich.edu        break;
6562715Sstever@eecs.umich.edu
6572715Sstever@eecs.umich.edu
6582715Sstever@eecs.umich.edu      case ObjectFile::Solaris:
6595154Sgblack@eecs.umich.edu        process = new SparcSolarisProcess(params, objFile);
6602715Sstever@eecs.umich.edu        break;
6615753Ssteve.reinhardt@amd.com
6622715Sstever@eecs.umich.edu      default:
6632715Sstever@eecs.umich.edu        fatal("Unknown/unsupported operating system.");
6642715Sstever@eecs.umich.edu    }
6654157Sgblack@eecs.umich.edu#elif THE_ISA == X86_ISA
6665874Sgblack@eecs.umich.edu    if (objFile->getArch() != ObjectFile::X86_64 &&
6675874Sgblack@eecs.umich.edu        objFile->getArch() != ObjectFile::I386)
6684166Sgblack@eecs.umich.edu        fatal("Object file architecture does not match compiled ISA (x86).");
6694157Sgblack@eecs.umich.edu    switch (objFile->getOpSys()) {
6705753Ssteve.reinhardt@amd.com      case ObjectFile::UnknownOpSys:
6715753Ssteve.reinhardt@amd.com        warn("Unknown operating system; assuming Linux.");
6725753Ssteve.reinhardt@amd.com        // fall through
6734166Sgblack@eecs.umich.edu      case ObjectFile::Linux:
6745874Sgblack@eecs.umich.edu        if (objFile->getArch() == ObjectFile::X86_64) {
6755955Sgblack@eecs.umich.edu            process = new X86_64LinuxProcess(params, objFile);
6765874Sgblack@eecs.umich.edu        } else {
6775955Sgblack@eecs.umich.edu            process = new I386LinuxProcess(params, objFile);
6785874Sgblack@eecs.umich.edu        }
6794166Sgblack@eecs.umich.edu        break;
6805753Ssteve.reinhardt@amd.com
6814157Sgblack@eecs.umich.edu      default:
6824157Sgblack@eecs.umich.edu        fatal("Unknown/unsupported operating system.");
6834157Sgblack@eecs.umich.edu    }
6842715Sstever@eecs.umich.edu#elif THE_ISA == MIPS_ISA
6852715Sstever@eecs.umich.edu    if (objFile->getArch() != ObjectFile::Mips)
6862715Sstever@eecs.umich.edu        fatal("Object file architecture does not match compiled ISA (MIPS).");
6872715Sstever@eecs.umich.edu    switch (objFile->getOpSys()) {
6885753Ssteve.reinhardt@amd.com      case ObjectFile::UnknownOpSys:
6895753Ssteve.reinhardt@amd.com        warn("Unknown operating system; assuming Linux.");
6905753Ssteve.reinhardt@amd.com        // fall through
6912715Sstever@eecs.umich.edu      case ObjectFile::Linux:
6925154Sgblack@eecs.umich.edu        process = new MipsLinuxProcess(params, objFile);
6932715Sstever@eecs.umich.edu        break;
6942715Sstever@eecs.umich.edu
6952715Sstever@eecs.umich.edu      default:
6962715Sstever@eecs.umich.edu        fatal("Unknown/unsupported operating system.");
6972715Sstever@eecs.umich.edu    }
6985335Shines@cs.fsu.edu#elif THE_ISA == ARM_ISA
6997095Sgblack@eecs.umich.edu    if (objFile->getArch() != ObjectFile::Arm &&
7007095Sgblack@eecs.umich.edu        objFile->getArch() != ObjectFile::Thumb)
7015335Shines@cs.fsu.edu        fatal("Object file architecture does not match compiled ISA (ARM).");
7025335Shines@cs.fsu.edu    switch (objFile->getOpSys()) {
7035753Ssteve.reinhardt@amd.com      case ObjectFile::UnknownOpSys:
7045753Ssteve.reinhardt@amd.com        warn("Unknown operating system; assuming Linux.");
7055753Ssteve.reinhardt@amd.com        // fall through
7065335Shines@cs.fsu.edu      case ObjectFile::Linux:
7077096Sgblack@eecs.umich.edu        process = new ArmLinuxProcess(params, objFile, objFile->getArch());
7085335Shines@cs.fsu.edu        break;
7096392Ssaidi@eecs.umich.edu      case ObjectFile::LinuxArmOABI:
7106392Ssaidi@eecs.umich.edu        fatal("M5 does not support ARM OABI binaries. Please recompile with an"
7116392Ssaidi@eecs.umich.edu              " EABI compiler.");
7125335Shines@cs.fsu.edu      default:
7135335Shines@cs.fsu.edu        fatal("Unknown/unsupported operating system.");
7145335Shines@cs.fsu.edu    }
7156691Stjones1@inf.ed.ac.uk#elif THE_ISA == POWER_ISA
7166691Stjones1@inf.ed.ac.uk    if (objFile->getArch() != ObjectFile::Power)
7176691Stjones1@inf.ed.ac.uk        fatal("Object file architecture does not match compiled ISA (Power).");
7186691Stjones1@inf.ed.ac.uk    switch (objFile->getOpSys()) {
7196691Stjones1@inf.ed.ac.uk      case ObjectFile::UnknownOpSys:
7206691Stjones1@inf.ed.ac.uk        warn("Unknown operating system; assuming Linux.");
7216691Stjones1@inf.ed.ac.uk        // fall through
7226691Stjones1@inf.ed.ac.uk      case ObjectFile::Linux:
7236691Stjones1@inf.ed.ac.uk        process = new PowerLinuxProcess(params, objFile);
7246691Stjones1@inf.ed.ac.uk        break;
7256691Stjones1@inf.ed.ac.uk
7266691Stjones1@inf.ed.ac.uk      default:
7276691Stjones1@inf.ed.ac.uk        fatal("Unknown/unsupported operating system.");
7286691Stjones1@inf.ed.ac.uk    }
7292715Sstever@eecs.umich.edu#else
7302715Sstever@eecs.umich.edu#error "THE_ISA not set"
7312715Sstever@eecs.umich.edu#endif
7322715Sstever@eecs.umich.edu
7332715Sstever@eecs.umich.edu
7342715Sstever@eecs.umich.edu    if (process == NULL)
7352715Sstever@eecs.umich.edu        fatal("Unknown error creating process object.");
7362715Sstever@eecs.umich.edu    return process;
7372715Sstever@eecs.umich.edu}
7382715Sstever@eecs.umich.edu
7394762Snate@binkert.orgLiveProcess *
7404762Snate@binkert.orgLiveProcessParams::create()
7412715Sstever@eecs.umich.edu{
7425154Sgblack@eecs.umich.edu    return LiveProcess::create(this);
7432715Sstever@eecs.umich.edu}
744