process.hh revision 4188
12199SN/A/* 22199SN/A * Copyright (c) 2003-2004 The Regents of The University of Michigan 32199SN/A * All rights reserved. 42199SN/A * 52199SN/A * Redistribution and use in source and binary forms, with or without 62199SN/A * modification, are permitted provided that the following conditions are 72199SN/A * met: redistributions of source code must retain the above copyright 82199SN/A * notice, this list of conditions and the following disclaimer; 92199SN/A * redistributions in binary form must reproduce the above copyright 102199SN/A * notice, this list of conditions and the following disclaimer in the 112199SN/A * documentation and/or other materials provided with the distribution; 122199SN/A * neither the name of the copyright holders nor the names of its 132199SN/A * contributors may be used to endorse or promote products derived from 142199SN/A * this software without specific prior written permission. 152199SN/A * 162199SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172199SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182199SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192199SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202199SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212199SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222199SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232199SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242199SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252199SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262199SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Steve Reinhardt 292199SN/A */ 302199SN/A 312202SN/A#ifndef __SPARC_LINUX_PROCESS_HH__ 322202SN/A#define __SPARC_LINUX_PROCESS_HH__ 332199SN/A 342584SN/A#include "arch/sparc/linux/linux.hh" 352980Sgblack@eecs.umich.edu#include "arch/sparc/syscallreturn.hh" 362474SN/A#include "arch/sparc/process.hh" 372199SN/A#include "sim/process.hh" 382199SN/A 392474SN/Anamespace SparcISA { 402199SN/A 414111Sgblack@eecs.umich.edu//This contains all of the common elements of a SPARC Linux process which 424111Sgblack@eecs.umich.edu//are not shared by other operating systems. The rest come from the common 434111Sgblack@eecs.umich.edu//SPARC process class. 444111Sgblack@eecs.umich.educlass SparcLinuxProcess 454111Sgblack@eecs.umich.edu{ 464111Sgblack@eecs.umich.edu public: 474111Sgblack@eecs.umich.edu SparcLinuxProcess(); 484111Sgblack@eecs.umich.edu 494111Sgblack@eecs.umich.edu /// Array of syscall descriptors, indexed by call number. 504111Sgblack@eecs.umich.edu static SyscallDesc syscallDescs[]; 514111Sgblack@eecs.umich.edu 524188Sgblack@eecs.umich.edu /// Array of 32 bit compatibility syscall descriptors, 534188Sgblack@eecs.umich.edu /// indexed by call number. 544188Sgblack@eecs.umich.edu static SyscallDesc syscall32Descs[]; 554188Sgblack@eecs.umich.edu 564111Sgblack@eecs.umich.edu SyscallDesc* getDesc(int callnum); 574188Sgblack@eecs.umich.edu SyscallDesc* getDesc32(int callnum); 584111Sgblack@eecs.umich.edu 594111Sgblack@eecs.umich.edu const int Num_Syscall_Descs; 604188Sgblack@eecs.umich.edu const int Num_Syscall32_Descs; 614111Sgblack@eecs.umich.edu}; 624111Sgblack@eecs.umich.edu 632202SN/A/// A process with emulated SPARC/Linux syscalls. 644111Sgblack@eecs.umich.educlass Sparc32LinuxProcess : public SparcLinuxProcess, public Sparc32LiveProcess 652199SN/A{ 662199SN/A public: 672199SN/A /// Constructor. 684111Sgblack@eecs.umich.edu Sparc32LinuxProcess(const std::string &name, 692199SN/A ObjectFile *objFile, 702458SN/A System * system, 712199SN/A int stdin_fd, int stdout_fd, int stderr_fd, 722199SN/A std::vector<std::string> &argv, 733114Sgblack@eecs.umich.edu std::vector<std::string> &envp, 743669Sbinkertn@umich.edu const std::string &cwd, 753114Sgblack@eecs.umich.edu uint64_t _uid, uint64_t _euid, 763114Sgblack@eecs.umich.edu uint64_t _gid, uint64_t _egid, 773114Sgblack@eecs.umich.edu uint64_t _pid, uint64_t _ppid); 782199SN/A 794111Sgblack@eecs.umich.edu SyscallDesc* getDesc(int callnum) 804111Sgblack@eecs.umich.edu { 814188Sgblack@eecs.umich.edu return SparcLinuxProcess::getDesc32(callnum); 824111Sgblack@eecs.umich.edu } 832199SN/A 844111Sgblack@eecs.umich.edu void handleTrap(int trapNum, ThreadContext *tc); 854111Sgblack@eecs.umich.edu}; 862199SN/A 874111Sgblack@eecs.umich.edu/// A process with emulated 32 bit SPARC/Linux syscalls. 884111Sgblack@eecs.umich.educlass Sparc64LinuxProcess : public SparcLinuxProcess, public Sparc64LiveProcess 894111Sgblack@eecs.umich.edu{ 904111Sgblack@eecs.umich.edu public: 914111Sgblack@eecs.umich.edu /// Constructor. 924111Sgblack@eecs.umich.edu Sparc64LinuxProcess(const std::string &name, 934111Sgblack@eecs.umich.edu ObjectFile *objFile, 944111Sgblack@eecs.umich.edu System * system, 954111Sgblack@eecs.umich.edu int stdin_fd, int stdout_fd, int stderr_fd, 964111Sgblack@eecs.umich.edu std::vector<std::string> &argv, 974111Sgblack@eecs.umich.edu std::vector<std::string> &envp, 984111Sgblack@eecs.umich.edu const std::string &cwd, 994111Sgblack@eecs.umich.edu uint64_t _uid, uint64_t _euid, 1004111Sgblack@eecs.umich.edu uint64_t _gid, uint64_t _egid, 1014111Sgblack@eecs.umich.edu uint64_t _pid, uint64_t _ppid); 1022199SN/A 1034111Sgblack@eecs.umich.edu SyscallDesc* getDesc(int callnum) 1044111Sgblack@eecs.umich.edu { 1054111Sgblack@eecs.umich.edu return SparcLinuxProcess::getDesc(callnum); 1064111Sgblack@eecs.umich.edu } 1074111Sgblack@eecs.umich.edu 1084111Sgblack@eecs.umich.edu void handleTrap(int trapNum, ThreadContext *tc); 1092199SN/A}; 1102199SN/A 1112561SN/ASyscallReturn getresuidFunc(SyscallDesc *desc, int num, 1123114Sgblack@eecs.umich.edu LiveProcess *p, ThreadContext *tc); 1132561SN/A 1142474SN/A} // namespace SparcISA 1154111Sgblack@eecs.umich.edu#endif // __SPARC_LINUX_PROCESS_HH__ 116