process.hh revision 7741:340b6f01d69b
16145Snate@binkert.org/* 26145Snate@binkert.org * Copyright (c) 2003-2004 The Regents of The University of Michigan 36145Snate@binkert.org * All rights reserved. 46145Snate@binkert.org * 56145Snate@binkert.org * Redistribution and use in source and binary forms, with or without 66145Snate@binkert.org * modification, are permitted provided that the following conditions are 76145Snate@binkert.org * met: redistributions of source code must retain the above copyright 86145Snate@binkert.org * notice, this list of conditions and the following disclaimer; 96145Snate@binkert.org * redistributions in binary form must reproduce the above copyright 106145Snate@binkert.org * notice, this list of conditions and the following disclaimer in the 116145Snate@binkert.org * documentation and/or other materials provided with the distribution; 126145Snate@binkert.org * neither the name of the copyright holders nor the names of its 136145Snate@binkert.org * contributors may be used to endorse or promote products derived from 146145Snate@binkert.org * this software without specific prior written permission. 156145Snate@binkert.org * 166145Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 176145Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 186145Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 196145Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 206145Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 216145Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 226145Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 236145Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 246145Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 256145Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 266145Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 276145Snate@binkert.org * 286145Snate@binkert.org * Authors: Gabe Black 297454Snate@binkert.org * Ali Saidi 307454Snate@binkert.org */ 318645Snilay@cs.wisc.edu 327454Snate@binkert.org#ifndef __SPARC_PROCESS_HH__ 337054Snate@binkert.org#define __SPARC_PROCESS_HH__ 347054Snate@binkert.org 357054Snate@binkert.org#include <string> 368259SBrad.Beckmann@amd.com#include <vector> 376154Snate@binkert.org#include "sim/byteswap.hh" 386154Snate@binkert.org#include "sim/process.hh" 396145Snate@binkert.org 407055Snate@binkert.orgclass ObjectFile; 417454Snate@binkert.orgclass System; 427454Snate@binkert.org 437055Snate@binkert.orgclass SparcLiveProcess : public LiveProcess 449274Snilay@cs.wisc.edu{ 456145Snate@binkert.org protected: 469858Snilay@cs.wisc.edu 479863Snilay@cs.wisc.edu const Addr StackBias; 489863Snilay@cs.wisc.edu 496145Snate@binkert.org // The locations of the fill and spill handlers 506145Snate@binkert.org Addr fillStart, spillStart; 516145Snate@binkert.org 526145Snate@binkert.org SparcLiveProcess(LiveProcessParams * params, 539858Snilay@cs.wisc.edu ObjectFile *objFile, Addr _StackBias); 546145Snate@binkert.org 557054Snate@binkert.org void initState(); 567454Snate@binkert.org 576145Snate@binkert.org template<class IntType> 587054Snate@binkert.org void argsInit(int pageSize); 597454Snate@binkert.org 606145Snate@binkert.org public: 616145Snate@binkert.org 627054Snate@binkert.org // Handles traps which request services from the operating system 639274Snilay@cs.wisc.edu virtual void handleTrap(int trapNum, ThreadContext *tc); 649274Snilay@cs.wisc.edu 659274Snilay@cs.wisc.edu Addr readFillStart() { return fillStart; } 669858Snilay@cs.wisc.edu Addr readSpillStart() { return spillStart; } 679274Snilay@cs.wisc.edu 689274Snilay@cs.wisc.edu virtual void flushWindows(ThreadContext *tc) = 0; 699274Snilay@cs.wisc.edu void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value); 707454Snate@binkert.org}; 716145Snate@binkert.org 729858Snilay@cs.wisc.educlass Sparc32LiveProcess : public SparcLiveProcess 739508Snilay@cs.wisc.edu{ 749508Snilay@cs.wisc.edu protected: 759508Snilay@cs.wisc.edu 769508Snilay@cs.wisc.edu Sparc32LiveProcess(LiveProcessParams * params, ObjectFile *objFile) : 776145Snate@binkert.org SparcLiveProcess(params, objFile, 0) 786145Snate@binkert.org { 797054Snate@binkert.org // Set up stack. On SPARC Linux, stack goes from the top of memory 807454Snate@binkert.org // downward, less the hole for the kernel address space. 819499Snilay@cs.wisc.edu stack_base = (Addr)0xf0000000ULL; 826145Snate@binkert.org 837054Snate@binkert.org // Set up region for mmaps. 849274Snilay@cs.wisc.edu mmap_start = mmap_end = 0x70000000; 859499Snilay@cs.wisc.edu } 869499Snilay@cs.wisc.edu 877454Snate@binkert.org void initState(); 886145Snate@binkert.org 897054Snate@binkert.org public: 907454Snate@binkert.org 917054Snate@binkert.org void argsInit(int intSize, int pageSize); 929508Snilay@cs.wisc.edu 939508Snilay@cs.wisc.edu void flushWindows(ThreadContext *tc); 947054Snate@binkert.org 957054Snate@binkert.org SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i); 967054Snate@binkert.org void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val); 979274Snilay@cs.wisc.edu}; 989274Snilay@cs.wisc.edu 997054Snate@binkert.orgclass Sparc64LiveProcess : public SparcLiveProcess 1009508Snilay@cs.wisc.edu{ 1017454Snate@binkert.org protected: 1027454Snate@binkert.org 1039508Snilay@cs.wisc.edu Sparc64LiveProcess(LiveProcessParams * params, ObjectFile *objFile) : 1049508Snilay@cs.wisc.edu SparcLiveProcess(params, objFile, 2047) 1059508Snilay@cs.wisc.edu { 1069274Snilay@cs.wisc.edu // Set up stack. On SPARC Linux, stack goes from the top of memory 1076145Snate@binkert.org // downward, less the hole for the kernel address space. 1087054Snate@binkert.org stack_base = (Addr)0x80000000000ULL; 1099858Snilay@cs.wisc.edu 1106145Snate@binkert.org // Set up region for mmaps. Tru64 seems to start just above 0 and 1117054Snate@binkert.org // grow up from there. 1129508Snilay@cs.wisc.edu mmap_start = mmap_end = 0xfffff80000000000ULL; 1136145Snate@binkert.org } 1146145Snate@binkert.org 1157054Snate@binkert.org void initState(); 1167054Snate@binkert.org 1176145Snate@binkert.org public: 1187054Snate@binkert.org 1197054Snate@binkert.org void argsInit(int intSize, int pageSize); 1206145Snate@binkert.org 1216145Snate@binkert.org void flushWindows(ThreadContext *tc); 1227454Snate@binkert.org 1237054Snate@binkert.org SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i); 1246145Snate@binkert.org void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val); 1257054Snate@binkert.org}; 1266145Snate@binkert.org 1276145Snate@binkert.org#endif // __SPARC_PROCESS_HH__ 1287054Snate@binkert.org