process.hh revision 7073
19793Sakash.bagdia@arm.com/* 27586SAli.Saidi@arm.com * Copyright (c) 2007 The Hewlett-Packard Development Company 37586SAli.Saidi@arm.com * All rights reserved. 47586SAli.Saidi@arm.com * 57586SAli.Saidi@arm.com * Redistribution and use of this software in source and binary forms, 67586SAli.Saidi@arm.com * with or without modification, are permitted provided that the 77586SAli.Saidi@arm.com * following conditions are met: 87586SAli.Saidi@arm.com * 97586SAli.Saidi@arm.com * The software must be used only for Non-Commercial Use which means any 107586SAli.Saidi@arm.com * use which is NOT directed to receiving any direct monetary 117586SAli.Saidi@arm.com * compensation for, or commercial advantage from such use. Illustrative 127586SAli.Saidi@arm.com * examples of non-commercial use are academic research, personal study, 1310118Snilay@cs.wisc.edu * teaching, education and corporate research & development. 1410118Snilay@cs.wisc.edu * Illustrative examples of commercial use are distributing products for 153970Sgblack@eecs.umich.edu * commercial advantage and providing services using the software for 163005Sstever@eecs.umich.edu * commercial advantage. 173005Sstever@eecs.umich.edu * 183005Sstever@eecs.umich.edu * If you wish to use this software or functionality therein that may be 193005Sstever@eecs.umich.edu * covered by patents for commercial use, please contact: 203005Sstever@eecs.umich.edu * Director of Intellectual Property Licensing 213005Sstever@eecs.umich.edu * Office of Strategy and Technology 223005Sstever@eecs.umich.edu * Hewlett-Packard Company 233005Sstever@eecs.umich.edu * 1501 Page Mill Road 243005Sstever@eecs.umich.edu * Palo Alto, California 94304 253005Sstever@eecs.umich.edu * 263005Sstever@eecs.umich.edu * Redistributions of source code must retain the above copyright notice, 273005Sstever@eecs.umich.edu * this list of conditions and the following disclaimer. Redistributions 283005Sstever@eecs.umich.edu * in binary form must reproduce the above copyright notice, this list of 293005Sstever@eecs.umich.edu * conditions and the following disclaimer in the documentation and/or 303005Sstever@eecs.umich.edu * other materials provided with the distribution. Neither the name of 313005Sstever@eecs.umich.edu * the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 323005Sstever@eecs.umich.edu * contributors may be used to endorse or promote products derived from 333005Sstever@eecs.umich.edu * this software without specific prior written permission. No right of 343005Sstever@eecs.umich.edu * sublicense is granted herewith. Derivatives of the software and 353005Sstever@eecs.umich.edu * output created using the software may be prepared, but only for 363005Sstever@eecs.umich.edu * Non-Commercial Uses. Derivatives of the software may be shared with 373005Sstever@eecs.umich.edu * others provided: (i) the others agree to abide by the list of 383005Sstever@eecs.umich.edu * conditions herein which includes the Non-Commercial Use restrictions; 393005Sstever@eecs.umich.edu * and (ii) such Derivatives of the software include the above copyright 403005Sstever@eecs.umich.edu * notice to acknowledge the contribution from this software where 413005Sstever@eecs.umich.edu * applicable, this list of conditions and the disclaimer below. 4210118Snilay@cs.wisc.edu * 433005Sstever@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 446654Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 456654Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 462889SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 472710SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 486654Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 496654Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 506654Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 515457Ssaidi@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 526654Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 5310118Snilay@cs.wisc.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 5410118Snilay@cs.wisc.edu * 5510118Snilay@cs.wisc.edu * Authors: Gabe Black 566654Snate@binkert.org */ 572934SN/A 582549SN/A#ifndef __ARCH_X86_PROCESS_HH__ 592995SN/A#define __ARCH_X86_PROCESS_HH__ 603395Shsul@eecs.umich.edu 616981SLisa.Hsu@amd.com#include <string> 629836Sandreas.hansson@arm.com#include <vector> 633448Shsul@eecs.umich.edu#include "sim/process.hh" 648920Snilay@cs.wisc.edu 653444Sktlim@umich.educlass SyscallDesc; 663304Sstever@eecs.umich.edu 679653SAndreas.Sandberg@ARM.comnamespace X86ISA 689653SAndreas.Sandberg@ARM.com{ 699653SAndreas.Sandberg@ARM.com enum X86AuxiliaryVectorTypes { 709653SAndreas.Sandberg@ARM.com M5_AT_SYSINFO = 32, 719653SAndreas.Sandberg@ARM.com M5_AT_SYSINFO_EHDR = 33 729653SAndreas.Sandberg@ARM.com }; 739653SAndreas.Sandberg@ARM.com 7410594Sgabeblack@google.com class X86LiveProcess : public LiveProcess 7510594Sgabeblack@google.com { 7610594Sgabeblack@google.com protected: 7710594Sgabeblack@google.com Addr _gdtStart; 7810594Sgabeblack@google.com Addr _gdtSize; 7910594Sgabeblack@google.com 8010594Sgabeblack@google.com SyscallDesc *syscallDescs; 8110594Sgabeblack@google.com const int numSyscallDescs; 8210594Sgabeblack@google.com 8310594Sgabeblack@google.com X86LiveProcess(LiveProcessParams * params, ObjectFile *objFile, 8410594Sgabeblack@google.com SyscallDesc *_syscallDescs, int _numSyscallDescs); 8510119Snilay@cs.wisc.edu 8610594Sgabeblack@google.com template<class IntType> 8710119Snilay@cs.wisc.edu void argsInit(int pageSize, 8810594Sgabeblack@google.com std::vector<AuxVector<IntType> > extraAuxvs); 8910594Sgabeblack@google.com 9010119Snilay@cs.wisc.edu public: 9110594Sgabeblack@google.com Addr gdtStart() 9210119Snilay@cs.wisc.edu { return _gdtStart; } 9310594Sgabeblack@google.com 9410119Snilay@cs.wisc.edu Addr gdtSize() 9510119Snilay@cs.wisc.edu { return _gdtSize; } 9610594Sgabeblack@google.com 9710119Snilay@cs.wisc.edu SyscallDesc* getDesc(int callnum); 9810512SAli.Saidi@ARM.com 9910512SAli.Saidi@ARM.com void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value); 10010594Sgabeblack@google.com }; 10110780SCurtis.Dunham@arm.com 10210780SCurtis.Dunham@arm.com class X86_64LiveProcess : public X86LiveProcess 10310119Snilay@cs.wisc.edu { 10410119Snilay@cs.wisc.edu protected: 10510119Snilay@cs.wisc.edu X86_64LiveProcess(LiveProcessParams *params, ObjectFile *objFile, 10610119Snilay@cs.wisc.edu SyscallDesc *_syscallDescs, int _numSyscallDescs); 1072566SN/A 10810119Snilay@cs.wisc.edu class VSyscallPage 10910119Snilay@cs.wisc.edu { 1109665Sandreas.hansson@arm.com public: 11110119Snilay@cs.wisc.edu Addr base; 11210119Snilay@cs.wisc.edu Addr size; 11310119Snilay@cs.wisc.edu Addr vtimeOffset; 11410119Snilay@cs.wisc.edu Addr vgettimeofdayOffset; 11510119Snilay@cs.wisc.edu }; 11610119Snilay@cs.wisc.edu VSyscallPage vsyscallPage; 11710119Snilay@cs.wisc.edu 11810119Snilay@cs.wisc.edu public: 11910119Snilay@cs.wisc.edu void argsInit(int intSize, int pageSize); 12010119Snilay@cs.wisc.edu void startup(); 12110119Snilay@cs.wisc.edu 12210119Snilay@cs.wisc.edu X86ISA::IntReg getSyscallArg(ThreadContext *tc, int &i); 12310119Snilay@cs.wisc.edu void setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val); 12410119Snilay@cs.wisc.edu }; 12510119Snilay@cs.wisc.edu 12610119Snilay@cs.wisc.edu class I386LiveProcess : public X86LiveProcess 12710119Snilay@cs.wisc.edu { 12810119Snilay@cs.wisc.edu protected: 12910119Snilay@cs.wisc.edu I386LiveProcess(LiveProcessParams *params, ObjectFile *objFile, 13010119Snilay@cs.wisc.edu SyscallDesc *_syscallDescs, int _numSyscallDescs); 13110119Snilay@cs.wisc.edu 13210119Snilay@cs.wisc.edu class VSyscallPage 13310119Snilay@cs.wisc.edu { 13410119Snilay@cs.wisc.edu public: 13510119Snilay@cs.wisc.edu Addr base; 13610119Snilay@cs.wisc.edu Addr size; 13710119Snilay@cs.wisc.edu Addr vsyscallOffset; 13810119Snilay@cs.wisc.edu Addr vsysexitOffset; 13910119Snilay@cs.wisc.edu }; 14010119Snilay@cs.wisc.edu VSyscallPage vsyscallPage; 14110119Snilay@cs.wisc.edu 14210119Snilay@cs.wisc.edu public: 14310119Snilay@cs.wisc.edu void argsInit(int intSize, int pageSize); 14410119Snilay@cs.wisc.edu void startup(); 14510119Snilay@cs.wisc.edu 14610119Snilay@cs.wisc.edu void syscall(int64_t callnum, ThreadContext *tc); 14710119Snilay@cs.wisc.edu X86ISA::IntReg getSyscallArg(ThreadContext *tc, int &i); 14810119Snilay@cs.wisc.edu X86ISA::IntReg getSyscallArg(ThreadContext *tc, int &i, int width); 14910119Snilay@cs.wisc.edu void setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val); 15010119Snilay@cs.wisc.edu }; 15110119Snilay@cs.wisc.edu} 15210119Snilay@cs.wisc.edu 15310519Snilay@cs.wisc.edu#endif // __ARCH_X86_PROCESS_HH__ 15410519Snilay@cs.wisc.edu