process.hh revision 12074:4cd00c12d641
11689SN/A/* 210333Smitch.hayenga@arm.com * Copyright (c) 2007 The Hewlett-Packard Development Company 39920Syasuko.eckert@amd.com * All rights reserved. 47944SGiacomo.Gabrielli@arm.com * 57944SGiacomo.Gabrielli@arm.com * The license below extends only to copyright in the software and shall 67944SGiacomo.Gabrielli@arm.com * not be construed as granting a license to any other intellectual 77944SGiacomo.Gabrielli@arm.com * property including but not limited to intellectual property relating 87944SGiacomo.Gabrielli@arm.com * to a hardware implementation of the functionality of the software 97944SGiacomo.Gabrielli@arm.com * licensed hereunder. You may use the software subject to the license 107944SGiacomo.Gabrielli@arm.com * terms below provided that you ensure that this notice is replicated 117944SGiacomo.Gabrielli@arm.com * unmodified and in its entirety in all distributions of the software, 127944SGiacomo.Gabrielli@arm.com * modified or unmodified, in source code or in binary form. 137944SGiacomo.Gabrielli@arm.com * 147944SGiacomo.Gabrielli@arm.com * Redistribution and use in source and binary forms, with or without 152326SN/A * modification, are permitted provided that the following conditions are 161689SN/A * met: redistributions of source code must retain the above copyright 171689SN/A * notice, this list of conditions and the following disclaimer; 181689SN/A * redistributions in binary form must reproduce the above copyright 191689SN/A * notice, this list of conditions and the following disclaimer in the 201689SN/A * documentation and/or other materials provided with the distribution; 211689SN/A * neither the name of the copyright holders nor the names of its 221689SN/A * contributors may be used to endorse or promote products derived from 231689SN/A * this software without specific prior written permission. 241689SN/A * 251689SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 261689SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 271689SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 281689SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 291689SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 301689SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 311689SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 321689SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 331689SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 341689SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 351689SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 361689SN/A * 371689SN/A * Authors: Gabe Black 381689SN/A */ 391689SN/A 402665Ssaidi@eecs.umich.edu#ifndef __ARCH_X86_PROCESS_HH__ 412665Ssaidi@eecs.umich.edu#define __ARCH_X86_PROCESS_HH__ 422831Sksewell@umich.edu 431689SN/A#include <string> 441689SN/A#include <vector> 459944Smatt.horsnell@ARM.com 469944Smatt.horsnell@ARM.com#include "mem/multi_level_page_table.hh" 479944Smatt.horsnell@ARM.com#include "sim/aux_vector.hh" 482064SN/A#include "sim/process.hh" 491060SN/A 501060SN/Aclass SyscallDesc; 512292SN/A 521717SN/Anamespace X86ISA 538232Snate@binkert.org{ 544762Snate@binkert.org enum X86AuxiliaryVectorTypes { 556221Snate@binkert.org M5_AT_SYSINFO = 32, 564762Snate@binkert.org M5_AT_SYSINFO_EHDR = 33 571060SN/A }; 588737Skoansin.tan@gmail.com 598737Skoansin.tan@gmail.com class X86Process : public Process 608737Skoansin.tan@gmail.com { 615529Snate@binkert.org protected: 621061SN/A Addr _gdtStart; 632292SN/A Addr _gdtSize; 645606Snate@binkert.org 658581Ssteve.reinhardt@amd.com SyscallDesc *syscallDescs; 668581Ssteve.reinhardt@amd.com const int numSyscallDescs; 671060SN/A 682292SN/A X86Process(ProcessParams * params, ObjectFile *objFile, 692292SN/A SyscallDesc *_syscallDescs, int _numSyscallDescs); 702292SN/A 712292SN/A template<class IntType> 722292SN/A void argsInit(int pageSize, 732292SN/A std::vector<AuxVector<IntType> > extraAuxvs); 742326SN/A 752292SN/A public: 762292SN/A Addr gdtStart() 772292SN/A { return _gdtStart; } 782292SN/A 792292SN/A Addr gdtSize() 802292SN/A { return _gdtSize; } 815336Shines@cs.fsu.edu 822292SN/A SyscallDesc* getDesc(int callnum) override; 834873Sstever@eecs.umich.edu 842292SN/A void setSyscallReturn(ThreadContext *tc, 852292SN/A SyscallReturn return_value) override; 862292SN/A void clone(ThreadContext *old_tc, ThreadContext *new_tc, 874329Sktlim@umich.edu Process *process, TheISA::IntReg flags); 885529Snate@binkert.org 894329Sktlim@umich.edu X86Process & 904329Sktlim@umich.edu operator=(const X86Process &in) 914329Sktlim@umich.edu { 922292SN/A if (this == &in) 932292SN/A return *this; 942292SN/A 952292SN/A _gdtStart = in._gdtStart; 962292SN/A _gdtSize = in._gdtSize; 972292SN/A syscallDescs = in.syscallDescs; 985529Snate@binkert.org 991060SN/A return *this; 1009920Syasuko.eckert@amd.com } 10112109SRekai.GonzalezAlberquilla@arm.com }; 1029920Syasuko.eckert@amd.com 10312109SRekai.GonzalezAlberquilla@arm.com class X86_64Process : public X86Process 10412109SRekai.GonzalezAlberquilla@arm.com { 10512109SRekai.GonzalezAlberquilla@arm.com protected: 1061060SN/A X86_64Process(ProcessParams *params, ObjectFile *objFile, 1071060SN/A SyscallDesc *_syscallDescs, int _numSyscallDescs); 1081060SN/A 1092326SN/A class VSyscallPage 1101060SN/A { 1111060SN/A public: 1121060SN/A Addr base; 1131060SN/A Addr size; 1142292SN/A Addr vtimeOffset; 1156221Snate@binkert.org Addr vgettimeofdayOffset; 1166221Snate@binkert.org 1176221Snate@binkert.org VSyscallPage & 1181060SN/A operator=(const VSyscallPage &in) 1191060SN/A { 1202307SN/A if (this == &in) 1212292SN/A return *this; 1222980Sgblack@eecs.umich.edu 1232292SN/A base = in.base; 1242292SN/A size = in.size; 1252292SN/A vtimeOffset = in.vtimeOffset; 1262292SN/A vgettimeofdayOffset = in.vgettimeofdayOffset; 1272292SN/A 1282292SN/A return *this; 1292292SN/A } 1302292SN/A }; 1312292SN/A VSyscallPage vsyscallPage; 1322292SN/A 1336221Snate@binkert.org public: 1346221Snate@binkert.org void argsInit(int pageSize); 1352292SN/A void initState() override; 1362292SN/A 1372292SN/A X86ISA::IntReg getSyscallArg(ThreadContext *tc, int &i) override; 1382292SN/A /// Explicitly import the otherwise hidden getSyscallArg 1392292SN/A using Process::getSyscallArg; 1402292SN/A void setSyscallArg(ThreadContext *tc, int i, 1412292SN/A X86ISA::IntReg val) override; 1422292SN/A void clone(ThreadContext *old_tc, ThreadContext *new_tc, 1432292SN/A Process *process, TheISA::IntReg flags); 1446221Snate@binkert.org }; 1456221Snate@binkert.org 1462292SN/A class I386Process : public X86Process 1472292SN/A { 1482831Sksewell@umich.edu protected: 1492292SN/A I386Process(ProcessParams *params, ObjectFile *objFile, 1502292SN/A SyscallDesc *_syscallDescs, int _numSyscallDescs); 1512292SN/A 1522292SN/A class VSyscallPage 1532292SN/A { 1542292SN/A public: 1552292SN/A Addr base; 1562292SN/A Addr size; 1572292SN/A Addr vsyscallOffset; 1586221Snate@binkert.org Addr vsysexitOffset; 1596221Snate@binkert.org 1602292SN/A VSyscallPage & 1612292SN/A operator=(const VSyscallPage &in) 1622831Sksewell@umich.edu { 1632292SN/A if (this == &in) 1642292SN/A return *this; 1652292SN/A 1662292SN/A base = in.base; 1672292SN/A size = in.size; 1682292SN/A vsyscallOffset = in.vsyscallOffset; 1692292SN/A vsysexitOffset = in.vsysexitOffset; 1702292SN/A 1712292SN/A return *this; 1722292SN/A } 1732326SN/A }; 1742348SN/A VSyscallPage vsyscallPage; 1752326SN/A 1762326SN/A public: 1772348SN/A void argsInit(int pageSize); 1782292SN/A void initState() override; 1792292SN/A 1802292SN/A void syscall(int64_t callnum, ThreadContext *tc, 1812292SN/A Fault *fault) override; 1822292SN/A X86ISA::IntReg getSyscallArg(ThreadContext *tc, 1832292SN/A int &i) override; 1842292SN/A X86ISA::IntReg getSyscallArg(ThreadContext *tc, int &i, 1851060SN/A int width) override; 1861060SN/A void setSyscallArg(ThreadContext *tc, int i, 1871061SN/A X86ISA::IntReg val) override; 1881060SN/A void clone(ThreadContext *old_tc, ThreadContext *new_tc, 1891062SN/A Process *process, TheISA::IntReg flags); 1901062SN/A }; 1912301SN/A 1921062SN/A /** 1931062SN/A * Declaration of architectural page table for x86. 1941062SN/A * 1951062SN/A * These page tables are stored in system memory and respect x86 1961062SN/A * specification. 1971062SN/A */ 1981062SN/A typedef MultiLevelPageTable<PageTableOps> ArchPageTable; 1991062SN/A 2001062SN/A} 2011062SN/A 2022301SN/A#endif // __ARCH_X86_PROCESS_HH__ 2032301SN/A