process.cc revision 2935
12754Sksewell@umich.edu 22207SN/A/* 32207SN/A * Copyright (c) 2003-2004 The Regents of The University of Michigan 42207SN/A * All rights reserved. 52207SN/A * 62207SN/A * Redistribution and use in source and binary forms, with or without 72207SN/A * modification, are permitted provided that the following conditions are 82207SN/A * met: redistributions of source code must retain the above copyright 92207SN/A * notice, this list of conditions and the following disclaimer; 102207SN/A * redistributions in binary form must reproduce the above copyright 112207SN/A * notice, this list of conditions and the following disclaimer in the 122207SN/A * documentation and/or other materials provided with the distribution; 132207SN/A * neither the name of the copyright holders nor the names of its 142207SN/A * contributors may be used to endorse or promote products derived from 152207SN/A * this software without specific prior written permission. 162207SN/A * 172207SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 182207SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 192207SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 202207SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 212207SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 222207SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 232207SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 242207SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 252207SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262207SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272207SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282665Ssaidi@eecs.umich.edu * 292665Ssaidi@eecs.umich.edu * Authors: Gabe Black 302665Ssaidi@eecs.umich.edu * Ali Saidi 312686Sksewell@umich.edu * Korey Sewell 322207SN/A */ 332207SN/A 342474SN/A#include "arch/mips/isa_traits.hh" 352207SN/A#include "arch/mips/process.hh" 362454SN/A#include "base/loader/object_file.hh" 372454SN/A#include "base/misc.hh" 382680Sktlim@umich.edu#include "cpu/thread_context.hh" 392474SN/A#include "sim/system.hh" 402207SN/A 412447SN/Ausing namespace std; 422474SN/Ausing namespace MipsISA; 432447SN/A 442474SN/AMipsLiveProcess::MipsLiveProcess(const std::string &nm, ObjectFile *objFile, 452474SN/A System *_system, int stdin_fd, int stdout_fd, int stderr_fd, 462474SN/A std::vector<std::string> &argv, std::vector<std::string> &envp) 472474SN/A : LiveProcess(nm, objFile, _system, stdin_fd, stdout_fd, stderr_fd, 482474SN/A argv, envp) 492474SN/A{ 502686Sksewell@umich.edu // Set up stack. On MIPS, stack starts at the top of kuseg 512686Sksewell@umich.edu // user address space. MIPS stack grows down from here 522935Sksewell@umich.edu stack_base = 0x7FFFFFFF; 532474SN/A 542474SN/A // Set pointer for next thread stack. Reserve 8M for main stack. 552474SN/A next_thread_stack_base = stack_base - (8 * 1024 * 1024); 562474SN/A 572686Sksewell@umich.edu // Set up break point (Top of Heap) 582686Sksewell@umich.edu brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize(); 592686Sksewell@umich.edu brk_point = roundUp(brk_point, VMPageSize); 602686Sksewell@umich.edu 612686Sksewell@umich.edu // Set up region for mmaps. For now, start at bottom of kuseg space. 622686Sksewell@umich.edu mmap_start = mmap_end = 0x10000; 632474SN/A} 642474SN/A 652474SN/Avoid 662474SN/AMipsLiveProcess::startup() 672474SN/A{ 682474SN/A argsInit(MachineBytes, VMPageSize); 692474SN/A} 70