process.hh revision 11877
12207SN/A/* 22207SN/A * Copyright (c) 2003-2004 The Regents of The University of Michigan 32207SN/A * All rights reserved. 42207SN/A * 52207SN/A * Redistribution and use in source and binary forms, with or without 62207SN/A * modification, are permitted provided that the following conditions are 72207SN/A * met: redistributions of source code must retain the above copyright 82207SN/A * notice, this list of conditions and the following disclaimer; 92207SN/A * redistributions in binary form must reproduce the above copyright 102207SN/A * notice, this list of conditions and the following disclaimer in the 112207SN/A * documentation and/or other materials provided with the distribution; 122207SN/A * neither the name of the copyright holders nor the names of its 132207SN/A * contributors may be used to endorse or promote products derived from 142207SN/A * this software without specific prior written permission. 152207SN/A * 162207SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172207SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182207SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192207SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202207SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212207SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222207SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232207SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242207SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252207SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262207SN/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 302207SN/A */ 312207SN/A 322207SN/A#ifndef __SPARC_PROCESS_HH__ 332207SN/A#define __SPARC_PROCESS_HH__ 342207SN/A 352454SN/A#include <string> 362454SN/A#include <vector> 378229Snate@binkert.org 3811800Sbrandon.potter@amd.com#include "mem/page_table.hh" 395285Sgblack@eecs.umich.edu#include "sim/byteswap.hh" 402474SN/A#include "sim/process.hh" 412454SN/A 422454SN/Aclass ObjectFile; 432207SN/A 4411851Sbrandon.potter@amd.comclass SparcProcess : public Process 452207SN/A{ 462474SN/A protected: 472561SN/A 485285Sgblack@eecs.umich.edu const Addr StackBias; 495285Sgblack@eecs.umich.edu 507741Sgblack@eecs.umich.edu // The locations of the fill and spill handlers 513415Sgblack@eecs.umich.edu Addr fillStart, spillStart; 523415Sgblack@eecs.umich.edu 5311851Sbrandon.potter@amd.com SparcProcess(ProcessParams * params, ObjectFile *objFile, 5411851Sbrandon.potter@amd.com Addr _StackBias); 555285Sgblack@eecs.umich.edu 567532Ssteve.reinhardt@amd.com void initState(); 575285Sgblack@eecs.umich.edu 585285Sgblack@eecs.umich.edu template<class IntType> 595285Sgblack@eecs.umich.edu void argsInit(int pageSize); 602207SN/A 612474SN/A public: 622474SN/A 637741Sgblack@eecs.umich.edu // Handles traps which request services from the operating system 6411877Sbrandon.potter@amd.com virtual void handleTrap(int trapNum, ThreadContext *tc, Fault *fault); 652561SN/A 667741Sgblack@eecs.umich.edu Addr readFillStart() { return fillStart; } 677741Sgblack@eecs.umich.edu Addr readSpillStart() { return spillStart; } 683415Sgblack@eecs.umich.edu 695128Sgblack@eecs.umich.edu virtual void flushWindows(ThreadContext *tc) = 0; 705958Sgblack@eecs.umich.edu void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value); 712474SN/A}; 722207SN/A 7311851Sbrandon.potter@amd.comclass Sparc32Process : public SparcProcess 744111Sgblack@eecs.umich.edu{ 754111Sgblack@eecs.umich.edu protected: 764111Sgblack@eecs.umich.edu 7711851Sbrandon.potter@amd.com Sparc32Process(ProcessParams * params, ObjectFile *objFile) 7811851Sbrandon.potter@amd.com : SparcProcess(params, objFile, 0) 794111Sgblack@eecs.umich.edu { 804111Sgblack@eecs.umich.edu // Set up stack. On SPARC Linux, stack goes from the top of memory 814111Sgblack@eecs.umich.edu // downward, less the hole for the kernel address space. 824111Sgblack@eecs.umich.edu stack_base = (Addr)0xf0000000ULL; 834111Sgblack@eecs.umich.edu 844111Sgblack@eecs.umich.edu // Set up region for mmaps. 8511386Ssteve.reinhardt@amd.com mmap_end = 0x70000000; 864111Sgblack@eecs.umich.edu } 874111Sgblack@eecs.umich.edu 887532Ssteve.reinhardt@amd.com void initState(); 894111Sgblack@eecs.umich.edu 904111Sgblack@eecs.umich.edu public: 914111Sgblack@eecs.umich.edu 924111Sgblack@eecs.umich.edu void argsInit(int intSize, int pageSize); 934111Sgblack@eecs.umich.edu 945128Sgblack@eecs.umich.edu void flushWindows(ThreadContext *tc); 955958Sgblack@eecs.umich.edu 966701Sgblack@eecs.umich.edu SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i); 979552Sandreas.hansson@arm.com /// Explicitly import the otherwise hidden getSyscallArg 9811851Sbrandon.potter@amd.com using Process::getSyscallArg; 999552Sandreas.hansson@arm.com 1005958Sgblack@eecs.umich.edu void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val); 1014111Sgblack@eecs.umich.edu}; 1024111Sgblack@eecs.umich.edu 10311851Sbrandon.potter@amd.comclass Sparc64Process : public SparcProcess 1044111Sgblack@eecs.umich.edu{ 1054111Sgblack@eecs.umich.edu protected: 1064111Sgblack@eecs.umich.edu 10711851Sbrandon.potter@amd.com Sparc64Process(ProcessParams * params, ObjectFile *objFile) 10811851Sbrandon.potter@amd.com : SparcProcess(params, objFile, 2047) 1094111Sgblack@eecs.umich.edu { 1104111Sgblack@eecs.umich.edu // Set up stack. On SPARC Linux, stack goes from the top of memory 1114111Sgblack@eecs.umich.edu // downward, less the hole for the kernel address space. 1124111Sgblack@eecs.umich.edu stack_base = (Addr)0x80000000000ULL; 1134111Sgblack@eecs.umich.edu 11411386Ssteve.reinhardt@amd.com // Set up region for mmaps. 11511386Ssteve.reinhardt@amd.com mmap_end = 0xfffff80000000000ULL; 1164111Sgblack@eecs.umich.edu } 1174111Sgblack@eecs.umich.edu 1187532Ssteve.reinhardt@amd.com void initState(); 1194111Sgblack@eecs.umich.edu 1204111Sgblack@eecs.umich.edu public: 1214111Sgblack@eecs.umich.edu 1224111Sgblack@eecs.umich.edu void argsInit(int intSize, int pageSize); 1234111Sgblack@eecs.umich.edu 1245128Sgblack@eecs.umich.edu void flushWindows(ThreadContext *tc); 1255958Sgblack@eecs.umich.edu 1266701Sgblack@eecs.umich.edu SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i); 1279552Sandreas.hansson@arm.com /// Explicitly import the otherwise hidden getSyscallArg 12811851Sbrandon.potter@amd.com using Process::getSyscallArg; 1299552Sandreas.hansson@arm.com 1305958Sgblack@eecs.umich.edu void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val); 1314111Sgblack@eecs.umich.edu}; 1324111Sgblack@eecs.umich.edu 13310299Salexandru.dutu@amd.com/* No architectural page table defined for this ISA */ 13410299Salexandru.dutu@amd.comtypedef NoArchPageTable ArchPageTable; 13510299Salexandru.dutu@amd.com 1362207SN/A#endif // __SPARC_PROCESS_HH__ 137