process.hh revision 5128
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> 372474SN/A#include "sim/process.hh" 382454SN/A 392454SN/Aclass ObjectFile; 402454SN/Aclass System; 412207SN/A 422474SN/Aclass SparcLiveProcess : public LiveProcess 432207SN/A{ 442474SN/A protected: 452561SN/A 463415Sgblack@eecs.umich.edu //The locations of the fill and spill handlers 473415Sgblack@eecs.umich.edu Addr fillStart, spillStart; 483415Sgblack@eecs.umich.edu 492474SN/A SparcLiveProcess(const std::string &nm, ObjectFile *objFile, 502474SN/A System *_system, int stdin_fd, int stdout_fd, int stderr_fd, 512474SN/A std::vector<std::string> &argv, 523114Sgblack@eecs.umich.edu std::vector<std::string> &envp, 533669Sbinkertn@umich.edu const std::string &cwd, 543114Sgblack@eecs.umich.edu uint64_t _uid, uint64_t _euid, 553114Sgblack@eecs.umich.edu uint64_t _gid, uint64_t _egid, 563114Sgblack@eecs.umich.edu uint64_t _pid, uint64_t _ppid); 572207SN/A 582474SN/A public: 592474SN/A 604111Sgblack@eecs.umich.edu //Handles traps which request services from the operating system 614111Sgblack@eecs.umich.edu virtual void handleTrap(int trapNum, ThreadContext *tc); 622561SN/A 633415Sgblack@eecs.umich.edu Addr readFillStart() 643415Sgblack@eecs.umich.edu { return fillStart; } 653415Sgblack@eecs.umich.edu 663415Sgblack@eecs.umich.edu Addr readSpillStart() 673415Sgblack@eecs.umich.edu { return spillStart; } 683415Sgblack@eecs.umich.edu 695128Sgblack@eecs.umich.edu virtual void flushWindows(ThreadContext *tc) = 0; 702474SN/A}; 712207SN/A 724111Sgblack@eecs.umich.edustruct M5_32_auxv_t 734111Sgblack@eecs.umich.edu{ 744111Sgblack@eecs.umich.edu int32_t a_type; 754111Sgblack@eecs.umich.edu union { 764111Sgblack@eecs.umich.edu int32_t a_val; 774111Sgblack@eecs.umich.edu int32_t a_ptr; 784111Sgblack@eecs.umich.edu int32_t a_fcn; 794111Sgblack@eecs.umich.edu }; 804111Sgblack@eecs.umich.edu 814111Sgblack@eecs.umich.edu M5_32_auxv_t() 824111Sgblack@eecs.umich.edu {} 834111Sgblack@eecs.umich.edu 844111Sgblack@eecs.umich.edu M5_32_auxv_t(int32_t type, int32_t val); 854111Sgblack@eecs.umich.edu}; 864111Sgblack@eecs.umich.edu 874111Sgblack@eecs.umich.educlass Sparc32LiveProcess : public SparcLiveProcess 884111Sgblack@eecs.umich.edu{ 894111Sgblack@eecs.umich.edu protected: 904111Sgblack@eecs.umich.edu 914111Sgblack@eecs.umich.edu std::vector<M5_32_auxv_t> auxv; 924111Sgblack@eecs.umich.edu 934111Sgblack@eecs.umich.edu Sparc32LiveProcess(const std::string &nm, ObjectFile *objFile, 944111Sgblack@eecs.umich.edu System *_system, int stdin_fd, int stdout_fd, int stderr_fd, 954111Sgblack@eecs.umich.edu std::vector<std::string> &argv, 964111Sgblack@eecs.umich.edu std::vector<std::string> &envp, 974111Sgblack@eecs.umich.edu const std::string &cwd, 984111Sgblack@eecs.umich.edu uint64_t _uid, uint64_t _euid, 994111Sgblack@eecs.umich.edu uint64_t _gid, uint64_t _egid, 1004111Sgblack@eecs.umich.edu uint64_t _pid, uint64_t _ppid) : 1014111Sgblack@eecs.umich.edu SparcLiveProcess(nm, objFile, _system, 1024111Sgblack@eecs.umich.edu stdin_fd, stdout_fd, stderr_fd, 1034111Sgblack@eecs.umich.edu argv, envp, cwd, 1044111Sgblack@eecs.umich.edu _uid, _euid, _gid, _egid, _pid, _ppid) 1054111Sgblack@eecs.umich.edu { 1064111Sgblack@eecs.umich.edu // Set up stack. On SPARC Linux, stack goes from the top of memory 1074111Sgblack@eecs.umich.edu // downward, less the hole for the kernel address space. 1084111Sgblack@eecs.umich.edu stack_base = (Addr)0xf0000000ULL; 1094111Sgblack@eecs.umich.edu 1104111Sgblack@eecs.umich.edu // Set up region for mmaps. 1114111Sgblack@eecs.umich.edu mmap_start = mmap_end = 0x70000000; 1124111Sgblack@eecs.umich.edu } 1134111Sgblack@eecs.umich.edu 1144111Sgblack@eecs.umich.edu void startup(); 1154111Sgblack@eecs.umich.edu 1164111Sgblack@eecs.umich.edu public: 1174111Sgblack@eecs.umich.edu 1184111Sgblack@eecs.umich.edu void argsInit(int intSize, int pageSize); 1194111Sgblack@eecs.umich.edu 1205128Sgblack@eecs.umich.edu void flushWindows(ThreadContext *tc); 1214111Sgblack@eecs.umich.edu}; 1224111Sgblack@eecs.umich.edu 1234111Sgblack@eecs.umich.edustruct M5_64_auxv_t 1244111Sgblack@eecs.umich.edu{ 1254111Sgblack@eecs.umich.edu int64_t a_type; 1264111Sgblack@eecs.umich.edu union { 1274111Sgblack@eecs.umich.edu int64_t a_val; 1284111Sgblack@eecs.umich.edu int64_t a_ptr; 1294111Sgblack@eecs.umich.edu int64_t a_fcn; 1304111Sgblack@eecs.umich.edu }; 1314111Sgblack@eecs.umich.edu 1324111Sgblack@eecs.umich.edu M5_64_auxv_t() 1334111Sgblack@eecs.umich.edu {} 1344111Sgblack@eecs.umich.edu 1354111Sgblack@eecs.umich.edu M5_64_auxv_t(int64_t type, int64_t val); 1364111Sgblack@eecs.umich.edu}; 1374111Sgblack@eecs.umich.edu 1384111Sgblack@eecs.umich.educlass Sparc64LiveProcess : public SparcLiveProcess 1394111Sgblack@eecs.umich.edu{ 1404111Sgblack@eecs.umich.edu protected: 1414111Sgblack@eecs.umich.edu 1424111Sgblack@eecs.umich.edu static const Addr StackBias = 2047; 1434111Sgblack@eecs.umich.edu 1444111Sgblack@eecs.umich.edu std::vector<M5_64_auxv_t> auxv; 1454111Sgblack@eecs.umich.edu 1464111Sgblack@eecs.umich.edu Sparc64LiveProcess(const std::string &nm, ObjectFile *objFile, 1474111Sgblack@eecs.umich.edu System *_system, int stdin_fd, int stdout_fd, int stderr_fd, 1484111Sgblack@eecs.umich.edu std::vector<std::string> &argv, 1494111Sgblack@eecs.umich.edu std::vector<std::string> &envp, 1504111Sgblack@eecs.umich.edu const std::string &cwd, 1514111Sgblack@eecs.umich.edu uint64_t _uid, uint64_t _euid, 1524111Sgblack@eecs.umich.edu uint64_t _gid, uint64_t _egid, 1534111Sgblack@eecs.umich.edu uint64_t _pid, uint64_t _ppid) : 1544111Sgblack@eecs.umich.edu SparcLiveProcess(nm, objFile, _system, 1554111Sgblack@eecs.umich.edu stdin_fd, stdout_fd, stderr_fd, 1564111Sgblack@eecs.umich.edu argv, envp, cwd, 1574111Sgblack@eecs.umich.edu _uid, _euid, _gid, _egid, _pid, _ppid) 1584111Sgblack@eecs.umich.edu { 1594111Sgblack@eecs.umich.edu // Set up stack. On SPARC Linux, stack goes from the top of memory 1604111Sgblack@eecs.umich.edu // downward, less the hole for the kernel address space. 1614111Sgblack@eecs.umich.edu stack_base = (Addr)0x80000000000ULL; 1624111Sgblack@eecs.umich.edu 1634111Sgblack@eecs.umich.edu // Set up region for mmaps. Tru64 seems to start just above 0 and 1644111Sgblack@eecs.umich.edu // grow up from there. 1654111Sgblack@eecs.umich.edu mmap_start = mmap_end = 0xfffff80000000000ULL; 1664111Sgblack@eecs.umich.edu } 1674111Sgblack@eecs.umich.edu 1684111Sgblack@eecs.umich.edu void startup(); 1694111Sgblack@eecs.umich.edu 1704111Sgblack@eecs.umich.edu public: 1714111Sgblack@eecs.umich.edu 1724111Sgblack@eecs.umich.edu void argsInit(int intSize, int pageSize); 1734111Sgblack@eecs.umich.edu 1745128Sgblack@eecs.umich.edu void flushWindows(ThreadContext *tc); 1754111Sgblack@eecs.umich.edu}; 1764111Sgblack@eecs.umich.edu 1772207SN/A#endif // __SPARC_PROCESS_HH__ 178