linux.hh revision 9146:a61fdbbc1d45
1955SN/A/* 2955SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan 312230Sgiacomo.travaglini@arm.com * All rights reserved. 49812Sandreas.hansson@arm.com * 59812Sandreas.hansson@arm.com * Redistribution and use in source and binary forms, with or without 69812Sandreas.hansson@arm.com * modification, are permitted provided that the following conditions are 79812Sandreas.hansson@arm.com * met: redistributions of source code must retain the above copyright 89812Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer; 99812Sandreas.hansson@arm.com * redistributions in binary form must reproduce the above copyright 109812Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer in the 119812Sandreas.hansson@arm.com * documentation and/or other materials provided with the distribution; 129812Sandreas.hansson@arm.com * neither the name of the copyright holders nor the names of its 139812Sandreas.hansson@arm.com * contributors may be used to endorse or promote products derived from 149812Sandreas.hansson@arm.com * this software without specific prior written permission. 157816Ssteve.reinhardt@amd.com * 165871Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 171762SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18955SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19955SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20955SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21955SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22955SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23955SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24955SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25955SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26955SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27955SN/A * 28955SN/A * Authors: Korey Sewell 29955SN/A */ 30955SN/A 31955SN/A#ifndef __ALPHA_ALPHA_LINUX_LINUX_HH__ 32955SN/A#define __ALPHA_ALPHA_LINUX_LINUX_HH__ 33955SN/A 34955SN/A#include "kern/linux/linux.hh" 35955SN/A 36955SN/A/* AlphaLinux class contains static constants/definitions/misc. 37955SN/A * structures which are specific to the Linux OS AND the Alpha 38955SN/A * architecture 39955SN/A */ 40955SN/Aclass AlphaLinux : public Linux 41955SN/A{ 422665Ssaidi@eecs.umich.edu public: 432665Ssaidi@eecs.umich.edu 445863Snate@binkert.org /// This table maps the target open() flags to the corresponding 45955SN/A /// host open() flags. 46955SN/A static OpenFlagTransTable openFlagTable[]; 47955SN/A 48955SN/A /// Number of entries in openFlagTable[]. 49955SN/A static const int NUM_OPEN_FLAGS; 508878Ssteve.reinhardt@amd.com 512632Sstever@eecs.umich.edu //@{ 528878Ssteve.reinhardt@amd.com /// open(2) flag values. 532632Sstever@eecs.umich.edu static const int TGT_O_RDONLY = 00000000; //!< O_RDONLY 54955SN/A static const int TGT_O_WRONLY = 00000001; //!< O_WRONLY 558878Ssteve.reinhardt@amd.com static const int TGT_O_RDWR = 00000002; //!< O_RDWR 562632Sstever@eecs.umich.edu static const int TGT_O_NONBLOCK = 00000004; //!< O_NONBLOCK 572761Sstever@eecs.umich.edu static const int TGT_O_APPEND = 00000010; //!< O_APPEND 582632Sstever@eecs.umich.edu static const int TGT_O_CREAT = 00001000; //!< O_CREAT 592632Sstever@eecs.umich.edu static const int TGT_O_TRUNC = 00002000; //!< O_TRUNC 602632Sstever@eecs.umich.edu static const int TGT_O_EXCL = 00004000; //!< O_EXCL 612761Sstever@eecs.umich.edu static const int TGT_O_NOCTTY = 00010000; //!< O_NOCTTY 622761Sstever@eecs.umich.edu static const int TGT_O_SYNC = 00040000; //!< O_SYNC 632761Sstever@eecs.umich.edu static const int TGT_O_DRD = 00100000; //!< O_DRD 648878Ssteve.reinhardt@amd.com static const int TGT_O_DIRECTIO = 00200000; //!< O_DIRECTIO 658878Ssteve.reinhardt@amd.com static const int TGT_O_CACHE = 00400000; //!< O_CACHE 662761Sstever@eecs.umich.edu static const int TGT_O_DSYNC = 02000000; //!< O_DSYNC 672761Sstever@eecs.umich.edu static const int TGT_O_RSYNC = 04000000; //!< O_RSYNC 682761Sstever@eecs.umich.edu //@} 692761Sstever@eecs.umich.edu 702761Sstever@eecs.umich.edu /// For mmap(). 718878Ssteve.reinhardt@amd.com static const unsigned TGT_MAP_ANONYMOUS = 0x10; 728878Ssteve.reinhardt@amd.com static const unsigned TGT_MAP_FIXED = 0x100; 732632Sstever@eecs.umich.edu 742632Sstever@eecs.umich.edu //@{ 758878Ssteve.reinhardt@amd.com /// For getsysinfo(). 768878Ssteve.reinhardt@amd.com static const unsigned GSI_PLATFORM_NAME = 103; //!< platform name as string 772632Sstever@eecs.umich.edu static const unsigned GSI_CPU_INFO = 59; //!< CPU information 78955SN/A static const unsigned GSI_PROC_TYPE = 60; //!< get proc_type 79955SN/A static const unsigned GSI_MAX_CPU = 30; //!< max # CPUs on machine 80955SN/A static const unsigned GSI_CPUS_IN_BOX = 55; //!< number of CPUs in system 8112563Sgabeblack@google.com static const unsigned GSI_PHYSMEM = 19; //!< Physical memory in KB 8212563Sgabeblack@google.com static const unsigned GSI_CLK_TCK = 42; //!< clock freq in Hz 836654Snate@binkert.org static const unsigned GSI_IEEE_FP_CONTROL = 45; 8410196SCurtis.Dunham@arm.com //@} 85955SN/A 865396Ssaidi@eecs.umich.edu //@{ 8711401Sandreas.sandberg@arm.com /// For setsysinfo(). 885863Snate@binkert.org static const unsigned SSI_IEEE_FP_CONTROL = 14; //!< ieee_set_fp_control() 895863Snate@binkert.org //@} 904202Sbinkertn@umich.edu 915863Snate@binkert.org //@{ 925863Snate@binkert.org /// ioctl() command codes. 935863Snate@binkert.org static const unsigned TGT_TIOCGETP = 0x40067408; 945863Snate@binkert.org static const unsigned TGT_TIOCSETP = 0x80067409; 9513541Sandrea.mondelli@ucf.edu static const unsigned TGT_TIOCSETN = 0x8006740a; 96955SN/A static const unsigned TGT_TIOCSETC = 0x80067411; 976654Snate@binkert.org static const unsigned TGT_TIOCGETC = 0x40067412; 985273Sstever@gmail.com static const unsigned TGT_FIONREAD = 0x4004667f; 995871Snate@binkert.org static const unsigned TGT_TCGETS = 0x402c7413; 1005273Sstever@gmail.com static const unsigned TGT_TCGETA = 0x40127417; 1016654Snate@binkert.org static const unsigned TGT_TCSETAW = 0x80147419; // 2.6.15 kernel 1025396Ssaidi@eecs.umich.edu //@} 1038120Sgblack@eecs.umich.edu 1048120Sgblack@eecs.umich.edu static bool 1058120Sgblack@eecs.umich.edu isTtyReq(unsigned req) 1068120Sgblack@eecs.umich.edu { 1078120Sgblack@eecs.umich.edu switch (req) { 1088120Sgblack@eecs.umich.edu case TGT_TIOCGETP: 1098120Sgblack@eecs.umich.edu case TGT_TIOCSETP: 1108120Sgblack@eecs.umich.edu case TGT_TIOCSETN: 1118879Ssteve.reinhardt@amd.com case TGT_TIOCSETC: 1128879Ssteve.reinhardt@amd.com case TGT_TIOCGETC: 1138879Ssteve.reinhardt@amd.com case TGT_TCGETS: 1148879Ssteve.reinhardt@amd.com case TGT_TCGETA: 1158879Ssteve.reinhardt@amd.com case TGT_TCSETAW: 1168879Ssteve.reinhardt@amd.com return true; 1178879Ssteve.reinhardt@amd.com default: 1188879Ssteve.reinhardt@amd.com return false; 1198879Ssteve.reinhardt@amd.com } 1208879Ssteve.reinhardt@amd.com } 1218879Ssteve.reinhardt@amd.com 1228879Ssteve.reinhardt@amd.com /// For table(). 1238879Ssteve.reinhardt@amd.com static const int TBL_SYSINFO = 12; 1248120Sgblack@eecs.umich.edu 1258120Sgblack@eecs.umich.edu /// Resource constants for getrlimit() (overide some generics). 1268120Sgblack@eecs.umich.edu static const unsigned TGT_RLIMIT_NPROC = 8; 1278120Sgblack@eecs.umich.edu static const unsigned TGT_RLIMIT_AS = 7; 1288120Sgblack@eecs.umich.edu static const unsigned TGT_RLIMIT_NOFILE = 6; 1298120Sgblack@eecs.umich.edu static const unsigned TGT_RLIMIT_MEMLOCK = 9; 1308120Sgblack@eecs.umich.edu 1318120Sgblack@eecs.umich.edu typedef struct { 1328120Sgblack@eecs.umich.edu int64_t uptime; /* Seconds since boot */ 1338120Sgblack@eecs.umich.edu uint64_t loads[3]; /* 1, 5, and 15 minute load averages */ 1348120Sgblack@eecs.umich.edu uint64_t totalram; /* Total usable main memory size */ 1358120Sgblack@eecs.umich.edu uint64_t freeram; /* Available memory size */ 1368120Sgblack@eecs.umich.edu uint64_t sharedram; /* Amount of shared memory */ 1378120Sgblack@eecs.umich.edu uint64_t bufferram; /* Memory used by buffers */ 1388879Ssteve.reinhardt@amd.com uint64_t totalswap; /* Total swap space size */ 1398879Ssteve.reinhardt@amd.com uint64_t freeswap; /* swap space still available */ 1408879Ssteve.reinhardt@amd.com uint16_t procs; /* Number of current processes */ 1418879Ssteve.reinhardt@amd.com uint64_t totalhigh; /* Total high memory size */ 14210458Sandreas.hansson@arm.com uint64_t freehigh; /* Available high memory size */ 14310458Sandreas.hansson@arm.com uint64_t mem_unit; /* Memory unit size in bytes */ 14410458Sandreas.hansson@arm.com } tgt_sysinfo; 1458879Ssteve.reinhardt@amd.com 1468879Ssteve.reinhardt@amd.com // For futex system call 1478879Ssteve.reinhardt@amd.com static const unsigned TGT_EAGAIN = 35; 1488879Ssteve.reinhardt@amd.com static const unsigned TGT_EWOULDBLOCK = TGT_EAGAIN; 14913421Sciro.santilli@arm.com}; 15013421Sciro.santilli@arm.com 1519227Sandreas.hansson@arm.com#endif // __ALPHA_ALPHA_LINUX_LINUX_HH__ 1529227Sandreas.hansson@arm.com