process.hh revision 9552
112837Sgabeblack@google.com/* 212837Sgabeblack@google.com * Copyright (c) 2003-2004 The Regents of The University of Michigan 312837Sgabeblack@google.com * All rights reserved. 412837Sgabeblack@google.com * 512837Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 612837Sgabeblack@google.com * modification, are permitted provided that the following conditions are 712837Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 812837Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 912837Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 1012837Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1112837Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1212837Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1312837Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1412837Sgabeblack@google.com * this software without specific prior written permission. 1512837Sgabeblack@google.com * 1612837Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1712837Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1812837Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1912837Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2012837Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2112837Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2212837Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2312837Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2412837Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2512837Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2612837Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2712837Sgabeblack@google.com * 2812837Sgabeblack@google.com * Authors: Gabe Black 2912837Sgabeblack@google.com * Ali Saidi 3012837Sgabeblack@google.com */ 3112837Sgabeblack@google.com 3212837Sgabeblack@google.com#ifndef __SPARC_PROCESS_HH__ 3313051Sgabeblack@google.com#define __SPARC_PROCESS_HH__ 3412955Sgabeblack@google.com 3512837Sgabeblack@google.com#include <string> 3612837Sgabeblack@google.com#include <vector> 3713051Sgabeblack@google.com 3812837Sgabeblack@google.com#include "sim/byteswap.hh" 3912837Sgabeblack@google.com#include "sim/process.hh" 4012955Sgabeblack@google.com 4112955Sgabeblack@google.comclass ObjectFile; 4212955Sgabeblack@google.comclass System; 4312955Sgabeblack@google.com 4413206Sgabeblack@google.comclass SparcLiveProcess : public LiveProcess 4513206Sgabeblack@google.com{ 4612955Sgabeblack@google.com protected: 4712955Sgabeblack@google.com 4812955Sgabeblack@google.com const Addr StackBias; 4912837Sgabeblack@google.com 5012837Sgabeblack@google.com // The locations of the fill and spill handlers 5112837Sgabeblack@google.com Addr fillStart, spillStart; 5212837Sgabeblack@google.com 5312837Sgabeblack@google.com SparcLiveProcess(LiveProcessParams * params, 5412837Sgabeblack@google.com ObjectFile *objFile, Addr _StackBias); 5512924Sgabeblack@google.com 5612837Sgabeblack@google.com void initState(); 5712837Sgabeblack@google.com 5812837Sgabeblack@google.com template<class IntType> 5912837Sgabeblack@google.com void argsInit(int pageSize); 6012837Sgabeblack@google.com 6112837Sgabeblack@google.com public: 6213051Sgabeblack@google.com 6312924Sgabeblack@google.com // Handles traps which request services from the operating system 6412924Sgabeblack@google.com virtual void handleTrap(int trapNum, ThreadContext *tc); 6512924Sgabeblack@google.com 6612924Sgabeblack@google.com Addr readFillStart() { return fillStart; } 6713132Sgabeblack@google.com Addr readSpillStart() { return spillStart; } 6812837Sgabeblack@google.com 6912837Sgabeblack@google.com virtual void flushWindows(ThreadContext *tc) = 0; 7012837Sgabeblack@google.com void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value); 7112837Sgabeblack@google.com}; 7212837Sgabeblack@google.com 7312837Sgabeblack@google.comclass Sparc32LiveProcess : public SparcLiveProcess 7413051Sgabeblack@google.com{ 7513051Sgabeblack@google.com protected: 7613051Sgabeblack@google.com 7712837Sgabeblack@google.com Sparc32LiveProcess(LiveProcessParams * params, ObjectFile *objFile) : 7813051Sgabeblack@google.com SparcLiveProcess(params, objFile, 0) 7913051Sgabeblack@google.com { 8012837Sgabeblack@google.com // Set up stack. On SPARC Linux, stack goes from the top of memory 8112924Sgabeblack@google.com // downward, less the hole for the kernel address space. 8213051Sgabeblack@google.com stack_base = (Addr)0xf0000000ULL; 8313051Sgabeblack@google.com 8413132Sgabeblack@google.com // Set up region for mmaps. 8513132Sgabeblack@google.com mmap_start = mmap_end = 0x70000000; 8612924Sgabeblack@google.com } 8712924Sgabeblack@google.com 8812924Sgabeblack@google.com void initState(); 8913051Sgabeblack@google.com 9013051Sgabeblack@google.com public: 9113051Sgabeblack@google.com 9212924Sgabeblack@google.com void argsInit(int intSize, int pageSize); 9313051Sgabeblack@google.com 9413051Sgabeblack@google.com void flushWindows(ThreadContext *tc); 9513051Sgabeblack@google.com 9613051Sgabeblack@google.com SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i); 9712837Sgabeblack@google.com /// Explicitly import the otherwise hidden getSyscallArg 9812837Sgabeblack@google.com using LiveProcess::getSyscallArg; 9912837Sgabeblack@google.com 10012837Sgabeblack@google.com void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val); 10112837Sgabeblack@google.com}; 10212837Sgabeblack@google.com 10312837Sgabeblack@google.comclass Sparc64LiveProcess : public SparcLiveProcess 10412837Sgabeblack@google.com{ 10512837Sgabeblack@google.com protected: 10612955Sgabeblack@google.com 10712837Sgabeblack@google.com Sparc64LiveProcess(LiveProcessParams * params, ObjectFile *objFile) : 10812837Sgabeblack@google.com SparcLiveProcess(params, objFile, 2047) 10912837Sgabeblack@google.com { 11012837Sgabeblack@google.com // Set up stack. On SPARC Linux, stack goes from the top of memory 11112837Sgabeblack@google.com // downward, less the hole for the kernel address space. 11212837Sgabeblack@google.com stack_base = (Addr)0x80000000000ULL; 11312837Sgabeblack@google.com 11412837Sgabeblack@google.com // Set up region for mmaps. Tru64 seems to start just above 0 and 11512837Sgabeblack@google.com // grow up from there. 11612955Sgabeblack@google.com mmap_start = mmap_end = 0xfffff80000000000ULL; 11712955Sgabeblack@google.com } 11812955Sgabeblack@google.com 11913206Sgabeblack@google.com void initState(); 12012955Sgabeblack@google.com 12112955Sgabeblack@google.com public: 12212955Sgabeblack@google.com 12312955Sgabeblack@google.com void argsInit(int intSize, int pageSize); 12412955Sgabeblack@google.com 12512955Sgabeblack@google.com void flushWindows(ThreadContext *tc); 12612955Sgabeblack@google.com 12712955Sgabeblack@google.com SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i); 12812955Sgabeblack@google.com /// Explicitly import the otherwise hidden getSyscallArg 12912837Sgabeblack@google.com using LiveProcess::getSyscallArg; 13012837Sgabeblack@google.com 13112837Sgabeblack@google.com void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val); 13212837Sgabeblack@google.com}; 13312837Sgabeblack@google.com 13412837Sgabeblack@google.com#endif // __SPARC_PROCESS_HH__ 13512837Sgabeblack@google.com