process.hh revision 5973:07444c3d0a07
11689SN/A/*
29783Sandreas.hansson@arm.com * Copyright (c) 2007 The Hewlett-Packard Development Company
310239Sbinhpham@cs.rutgers.edu * All rights reserved.
47598Sminkyu.jeong@arm.com *
57598Sminkyu.jeong@arm.com * Redistribution and use of this software in source and binary forms,
67598Sminkyu.jeong@arm.com * with or without modification, are permitted provided that the
77598Sminkyu.jeong@arm.com * following conditions are met:
87598Sminkyu.jeong@arm.com *
97598Sminkyu.jeong@arm.com * The software must be used only for Non-Commercial Use which means any
107598Sminkyu.jeong@arm.com * use which is NOT directed to receiving any direct monetary
117598Sminkyu.jeong@arm.com * compensation for, or commercial advantage from such use.  Illustrative
127598Sminkyu.jeong@arm.com * examples of non-commercial use are academic research, personal study,
137598Sminkyu.jeong@arm.com * teaching, education and corporate research & development.
147598Sminkyu.jeong@arm.com * Illustrative examples of commercial use are distributing products for
152326SN/A * commercial advantage and providing services using the software for
161689SN/A * commercial advantage.
171689SN/A *
181689SN/A * If you wish to use this software or functionality therein that may be
191689SN/A * covered by patents for commercial use, please contact:
201689SN/A *     Director of Intellectual Property Licensing
211689SN/A *     Office of Strategy and Technology
221689SN/A *     Hewlett-Packard Company
231689SN/A *     1501 Page Mill Road
241689SN/A *     Palo Alto, California  94304
251689SN/A *
261689SN/A * Redistributions of source code must retain the above copyright notice,
271689SN/A * this list of conditions and the following disclaimer.  Redistributions
281689SN/A * in binary form must reproduce the above copyright notice, this list of
291689SN/A * conditions and the following disclaimer in the documentation and/or
301689SN/A * other materials provided with the distribution.  Neither the name of
311689SN/A * the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
321689SN/A * contributors may be used to endorse or promote products derived from
331689SN/A * this software without specific prior written permission.  No right of
341689SN/A * sublicense is granted herewith.  Derivatives of the software and
351689SN/A * output created using the software may be prepared, but only for
361689SN/A * Non-Commercial Uses.  Derivatives of the software may be shared with
371689SN/A * others provided: (i) the others agree to abide by the list of
381689SN/A * conditions herein which includes the Non-Commercial Use restrictions;
391689SN/A * and (ii) such Derivatives of the software include the above copyright
402665Ssaidi@eecs.umich.edu * notice to acknowledge the contribution from this software where
412665Ssaidi@eecs.umich.edu * applicable, this list of conditions and the disclaimer below.
421689SN/A *
431689SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
449944Smatt.horsnell@ARM.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
459944Smatt.horsnell@ARM.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
469944Smatt.horsnell@ARM.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
471060SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
481060SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
491689SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
501060SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
511060SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
521060SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
538230Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
546658Snate@binkert.org *
558887Sgeoffrey.blake@arm.com * Authors: Gabe Black
562292SN/A */
571717SN/A
588229Snate@binkert.org#ifndef __ARCH_X86_PROCESS_HH__
598232Snate@binkert.org#define __ARCH_X86_PROCESS_HH__
609444SAndreas.Sandberg@ARM.com
618232Snate@binkert.org#include <string>
629527SMatt.Horsnell@arm.com#include <vector>
635529Snate@binkert.org#include "sim/process.hh"
641060SN/A
656221Snate@binkert.orgclass SyscallDesc;
666221Snate@binkert.org
671681SN/Anamespace X86ISA
685529Snate@binkert.org{
692873Sktlim@umich.edu
704329Sktlim@umich.edu    class X86LiveProcess : public LiveProcess
714329Sktlim@umich.edu    {
724329Sktlim@umich.edu      protected:
732292SN/A        Addr _gdtStart;
742292SN/A        Addr _gdtSize;
752292SN/A
762292SN/A        SyscallDesc *syscallDescs;
772820Sktlim@umich.edu        const int numSyscallDescs;
782292SN/A
792820Sktlim@umich.edu        X86LiveProcess(LiveProcessParams * params, ObjectFile *objFile,
809444SAndreas.Sandberg@ARM.com                SyscallDesc *_syscallDescs, int _numSyscallDescs);
811060SN/A
8210172Sdam.sunwoo@arm.com        template<class IntType>
8310172Sdam.sunwoo@arm.com        void argsInit(int pageSize,
8410172Sdam.sunwoo@arm.com                std::vector<AuxVector<IntType> > extraAuxvs);
8510172Sdam.sunwoo@arm.com
8610172Sdam.sunwoo@arm.com      public:
8710172Sdam.sunwoo@arm.com        Addr gdtStart()
8810172Sdam.sunwoo@arm.com        { return _gdtStart; }
8910172Sdam.sunwoo@arm.com
9010172Sdam.sunwoo@arm.com        Addr gdtSize()
9110172Sdam.sunwoo@arm.com        { return _gdtSize; }
9210172Sdam.sunwoo@arm.com
9310172Sdam.sunwoo@arm.com        SyscallDesc* getDesc(int callnum);
9410172Sdam.sunwoo@arm.com
952292SN/A        void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
962292SN/A    };
972292SN/A
981060SN/A    class X86_64LiveProcess : public X86LiveProcess
991060SN/A    {
1001060SN/A      protected:
1011060SN/A        X86_64LiveProcess(LiveProcessParams *params, ObjectFile *objFile,
1021060SN/A                SyscallDesc *_syscallDescs, int _numSyscallDescs);
1031060SN/A
1041681SN/A      public:
1056221Snate@binkert.org        void argsInit(int intSize, int pageSize);
1066221Snate@binkert.org        void startup();
1076221Snate@binkert.org
1082292SN/A        X86ISA::IntReg getSyscallArg(ThreadContext *tc, int i);
1092292SN/A        void setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val);
1102292SN/A    };
1112292SN/A
11210328Smitch.hayenga@arm.com    class I386LiveProcess : public X86LiveProcess
1132292SN/A    {
1142292SN/A      protected:
1152292SN/A        I386LiveProcess(LiveProcessParams *params, ObjectFile *objFile,
1162292SN/A                SyscallDesc *_syscallDescs, int _numSyscallDescs);
1172292SN/A
1182292SN/A        class VSyscallPage
1192292SN/A        {
1201060SN/A          public:
1211060SN/A            Addr base;
1221681SN/A            Addr size;
1231062SN/A            Addr vsyscallOffset;
12410023Smatt.horsnell@ARM.com            Addr vsysexitOffset;
12510023Smatt.horsnell@ARM.com        };
12610023Smatt.horsnell@ARM.com        VSyscallPage vsyscallPage;
12710023Smatt.horsnell@ARM.com
12810023Smatt.horsnell@ARM.com      public:
12910023Smatt.horsnell@ARM.com        void argsInit(int intSize, int pageSize);
13010023Smatt.horsnell@ARM.com        void startup();
13110023Smatt.horsnell@ARM.com
1322292SN/A        void syscall(int64_t callnum, ThreadContext *tc);
1331062SN/A        X86ISA::IntReg getSyscallArg(ThreadContext *tc, int i);
1342301SN/A        void setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val);
1352301SN/A    };
1361062SN/A}
1372727Sktlim@umich.edu
1381062SN/A#endif // __ARCH_X86_PROCESS_HH__
1391062SN/A