process.cc revision 5254
12207SN/A/* 25254Sksewell@umich.edu * Copyright (c) 2004-2005 The Regents of The University of Michigan 35254Sksewell@umich.edu * All rights reserved. 42207SN/A * 55254Sksewell@umich.edu * Redistribution and use in source and binary forms, with or without 65254Sksewell@umich.edu * modification, are permitted provided that the following conditions are 75254Sksewell@umich.edu * met: redistributions of source code must retain the above copyright 85254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer; 95254Sksewell@umich.edu * redistributions in binary form must reproduce the above copyright 105254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer in the 115254Sksewell@umich.edu * documentation and/or other materials provided with the distribution; 125254Sksewell@umich.edu * neither the name of the copyright holders nor the names of its 135254Sksewell@umich.edu * contributors may be used to endorse or promote products derived from 145254Sksewell@umich.edu * this software without specific prior written permission. 152207SN/A * 165254Sksewell@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 175254Sksewell@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 185254Sksewell@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 195254Sksewell@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 205254Sksewell@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 215254Sksewell@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 225254Sksewell@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 235254Sksewell@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 245254Sksewell@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 255254Sksewell@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 265254Sksewell@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 285254Sksewell@umich.edu * Authors: Gabe Black 295254Sksewell@umich.edu * Ali Saidi 305254Sksewell@umich.edu * Korey Sewell 312207SN/A */ 322207SN/A 332474SN/A#include "arch/mips/isa_traits.hh" 342207SN/A#include "arch/mips/process.hh" 352454SN/A#include "base/loader/object_file.hh" 362454SN/A#include "base/misc.hh" 372680Sktlim@umich.edu#include "cpu/thread_context.hh" 382474SN/A#include "sim/system.hh" 392207SN/A 402447SN/Ausing namespace std; 412474SN/Ausing namespace MipsISA; 422447SN/A 435154Sgblack@eecs.umich.eduMipsLiveProcess::MipsLiveProcess(LiveProcessParams * params, 445154Sgblack@eecs.umich.edu ObjectFile *objFile) 455154Sgblack@eecs.umich.edu : LiveProcess(params, objFile) 462474SN/A{ 472686Sksewell@umich.edu // Set up stack. On MIPS, stack starts at the top of kuseg 482686Sksewell@umich.edu // user address space. MIPS stack grows down from here 492935Sksewell@umich.edu stack_base = 0x7FFFFFFF; 502474SN/A 512474SN/A // Set pointer for next thread stack. Reserve 8M for main stack. 522474SN/A next_thread_stack_base = stack_base - (8 * 1024 * 1024); 532474SN/A 542686Sksewell@umich.edu // Set up break point (Top of Heap) 552686Sksewell@umich.edu brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize(); 562686Sksewell@umich.edu brk_point = roundUp(brk_point, VMPageSize); 572686Sksewell@umich.edu 582686Sksewell@umich.edu // Set up region for mmaps. For now, start at bottom of kuseg space. 592686Sksewell@umich.edu mmap_start = mmap_end = 0x10000; 602474SN/A} 612474SN/A 622474SN/Avoid 632474SN/AMipsLiveProcess::startup() 642474SN/A{ 652474SN/A argsInit(MachineBytes, VMPageSize); 662474SN/A} 67