process.cc revision 5183
14134Sgblack@eecs.umich.edu/* 24134Sgblack@eecs.umich.edu * Copyright (c) 2003-2004 The Regents of The University of Michigan 34134Sgblack@eecs.umich.edu * All rights reserved. 44134Sgblack@eecs.umich.edu * 54134Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 64134Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 74134Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 84134Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 94134Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 104134Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 114134Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 124134Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 134134Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 144134Sgblack@eecs.umich.edu * this software without specific prior written permission. 154134Sgblack@eecs.umich.edu * 164134Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 174134Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 184134Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 194134Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 204134Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 214134Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 224134Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 234134Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 244134Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 254134Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 264134Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 274134Sgblack@eecs.umich.edu * 284134Sgblack@eecs.umich.edu * Authors: Gabe Black 294134Sgblack@eecs.umich.edu * Ali Saidi 304134Sgblack@eecs.umich.edu */ 314134Sgblack@eecs.umich.edu 324134Sgblack@eecs.umich.edu#include "arch/alpha/isa_traits.hh" 334134Sgblack@eecs.umich.edu#include "arch/alpha/process.hh" 344134Sgblack@eecs.umich.edu#include "base/loader/object_file.hh" 354134Sgblack@eecs.umich.edu#include "base/misc.hh" 364134Sgblack@eecs.umich.edu#include "cpu/thread_context.hh" 374134Sgblack@eecs.umich.edu#include "sim/system.hh" 384134Sgblack@eecs.umich.edu 394134Sgblack@eecs.umich.edu 404134Sgblack@eecs.umich.eduusing namespace AlphaISA; 414134Sgblack@eecs.umich.eduusing namespace std; 424134Sgblack@eecs.umich.edu 434134Sgblack@eecs.umich.eduAlphaLiveProcess::AlphaLiveProcess(LiveProcessParams * params, 444134Sgblack@eecs.umich.edu ObjectFile *objFile) 454134Sgblack@eecs.umich.edu : LiveProcess(params, objFile) 464134Sgblack@eecs.umich.edu{ 474134Sgblack@eecs.umich.edu brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize(); 484134Sgblack@eecs.umich.edu brk_point = roundUp(brk_point, VMPageSize); 494134Sgblack@eecs.umich.edu 504134Sgblack@eecs.umich.edu // Set up stack. On Alpha, stack goes below text section. This 514134Sgblack@eecs.umich.edu // code should get moved to some architecture-specific spot. 524134Sgblack@eecs.umich.edu stack_base = objFile->textBase() - (409600+4096); 534134Sgblack@eecs.umich.edu 544134Sgblack@eecs.umich.edu // Set up region for mmaps. Tru64 seems to start just above 0 and 554134Sgblack@eecs.umich.edu // grow up from there. 564134Sgblack@eecs.umich.edu mmap_start = mmap_end = 0x10000; 574134Sgblack@eecs.umich.edu 584134Sgblack@eecs.umich.edu // Set pointer for next thread stack. Reserve 8M for main stack. 594134Sgblack@eecs.umich.edu next_thread_stack_base = stack_base - (8 * 1024 * 1024); 604134Sgblack@eecs.umich.edu 614134Sgblack@eecs.umich.edu} 624134Sgblack@eecs.umich.edu 634578Sgblack@eecs.umich.eduvoid 644134Sgblack@eecs.umich.eduAlphaLiveProcess::startup() 654134Sgblack@eecs.umich.edu{ 664134Sgblack@eecs.umich.edu if (checkpointRestored) 674134Sgblack@eecs.umich.edu return; 684134Sgblack@eecs.umich.edu 694134Sgblack@eecs.umich.edu argsInit(MachineBytes, VMPageSize); 70 71 threadContexts[0]->setIntReg(GlobalPointerReg, objFile->globalPointer()); 72 //Opperate in user mode 73 threadContexts[0]->setMiscRegNoEffect(IPR_ICM, 0x18); 74 //No super page mapping 75 threadContexts[0]->setMiscRegNoEffect(IPR_MCSR, 0); 76 //Set this to 0 for now, but it should be unique for each process 77 threadContexts[0]->setMiscRegNoEffect(IPR_DTB_ASN, M5_pid << 57); 78} 79 80 81