process.cc revision 4188
12SN/A/*
21762SN/A * Copyright (c) 2003-2004 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: Gabe Black
292665Ssaidi@eecs.umich.edu *          Ali Saidi
302665Ssaidi@eecs.umich.edu */
312665Ssaidi@eecs.umich.edu
322SN/A#include "arch/alpha/isa_traits.hh"
332SN/A#include "arch/alpha/process.hh"
344265Sgblack@eecs.umich.edu#include "base/loader/object_file.hh"
352SN/A#include "base/misc.hh"
362SN/A#include "cpu/thread_context.hh"
373506Ssaidi@eecs.umich.edu#include "sim/system.hh"
383506Ssaidi@eecs.umich.edu
392SN/A
404266Sgblack@eecs.umich.eduusing namespace AlphaISA;
412973Sgblack@eecs.umich.eduusing namespace std;
423584Ssaidi@eecs.umich.edu
4356SN/AAlphaLiveProcess::AlphaLiveProcess(const std::string &nm, ObjectFile *objFile,
444265Sgblack@eecs.umich.edu        System *_system, int stdin_fd, int stdout_fd, int stderr_fd,
453614Sgblack@eecs.umich.edu        std::vector<std::string> &argv, std::vector<std::string> &envp,
461717SN/A        const std::string &cwd,
472518SN/A        uint64_t _uid, uint64_t _euid, uint64_t _gid, uint64_t _egid,
4856SN/A        uint64_t _pid, uint64_t _ppid)
494762Snate@binkert.org    : LiveProcess(nm, objFile, _system, stdin_fd, stdout_fd, stderr_fd,
502518SN/A        argv, envp, cwd, _uid, _euid, _gid, _egid, _pid, _ppid)
512SN/A{
523614Sgblack@eecs.umich.edu    brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize();
533614Sgblack@eecs.umich.edu    brk_point = roundUp(brk_point, VMPageSize);
543614Sgblack@eecs.umich.edu
553614Sgblack@eecs.umich.edu    // Set up stack.  On Alpha, stack goes below text section.  This
563065Sgblack@eecs.umich.edu    // code should get moved to some architecture-specific spot.
573065Sgblack@eecs.umich.edu    stack_base = objFile->textBase() - (409600+4096);
583506Ssaidi@eecs.umich.edu
593065Sgblack@eecs.umich.edu    // Set up region for mmaps.  Tru64 seems to start just above 0 and
602SN/A    // grow up from there.
612973Sgblack@eecs.umich.edu    mmap_start = mmap_end = 0x10000;
622SN/A
633840Shsul@eecs.umich.edu    // Set pointer for next thread stack.  Reserve 8M for main stack.
643825Ssaidi@eecs.umich.edu    next_thread_stack_base = stack_base - (8 * 1024 * 1024);
653903Ssaidi@eecs.umich.edu
663840Shsul@eecs.umich.edu}
673825Ssaidi@eecs.umich.edu
683506Ssaidi@eecs.umich.eduvoid
693506Ssaidi@eecs.umich.eduAlphaLiveProcess::startup()
704265Sgblack@eecs.umich.edu{
714054Sbinkertn@umich.edu    argsInit(MachineBytes, VMPageSize);
724054Sbinkertn@umich.edu
734054Sbinkertn@umich.edu    threadContexts[0]->setIntReg(GlobalPointerReg, objFile->globalPointer());
744054Sbinkertn@umich.edu}
754054Sbinkertn@umich.edu
764054Sbinkertn@umich.edu
774054Sbinkertn@umich.edu