linux.hh revision 9146
12553SN/A/* 22553SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan 32553SN/A * All rights reserved. 42553SN/A * 52553SN/A * Redistribution and use in source and binary forms, with or without 62553SN/A * modification, are permitted provided that the following conditions are 72553SN/A * met: redistributions of source code must retain the above copyright 82553SN/A * notice, this list of conditions and the following disclaimer; 92553SN/A * redistributions in binary form must reproduce the above copyright 102553SN/A * notice, this list of conditions and the following disclaimer in the 112553SN/A * documentation and/or other materials provided with the distribution; 122553SN/A * neither the name of the copyright holders nor the names of its 132553SN/A * contributors may be used to endorse or promote products derived from 142553SN/A * this software without specific prior written permission. 152553SN/A * 162553SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172553SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182553SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192553SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202553SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212553SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222553SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232553SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242553SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252553SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262553SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Korey Sewell 292553SN/A */ 302553SN/A 315569Snate@binkert.org#ifndef __ALPHA_ALPHA_LINUX_LINUX_HH__ 325569Snate@binkert.org#define __ALPHA_ALPHA_LINUX_LINUX_HH__ 332553SN/A 342553SN/A#include "kern/linux/linux.hh" 352553SN/A 362553SN/A/* AlphaLinux class contains static constants/definitions/misc. 372553SN/A * structures which are specific to the Linux OS AND the Alpha 382553SN/A * architecture 392553SN/A */ 402553SN/Aclass AlphaLinux : public Linux 412553SN/A{ 422553SN/A public: 432553SN/A 442553SN/A /// This table maps the target open() flags to the corresponding 452553SN/A /// host open() flags. 462553SN/A static OpenFlagTransTable openFlagTable[]; 472553SN/A 482553SN/A /// Number of entries in openFlagTable[]. 492553SN/A static const int NUM_OPEN_FLAGS; 502553SN/A 512553SN/A //@{ 522553SN/A /// open(2) flag values. 535543Ssaidi@eecs.umich.edu static const int TGT_O_RDONLY = 00000000; //!< O_RDONLY 545543Ssaidi@eecs.umich.edu static const int TGT_O_WRONLY = 00000001; //!< O_WRONLY 555543Ssaidi@eecs.umich.edu static const int TGT_O_RDWR = 00000002; //!< O_RDWR 565543Ssaidi@eecs.umich.edu static const int TGT_O_NONBLOCK = 00000004; //!< O_NONBLOCK 575543Ssaidi@eecs.umich.edu static const int TGT_O_APPEND = 00000010; //!< O_APPEND 585543Ssaidi@eecs.umich.edu static const int TGT_O_CREAT = 00001000; //!< O_CREAT 595543Ssaidi@eecs.umich.edu static const int TGT_O_TRUNC = 00002000; //!< O_TRUNC 605543Ssaidi@eecs.umich.edu static const int TGT_O_EXCL = 00004000; //!< O_EXCL 615543Ssaidi@eecs.umich.edu static const int TGT_O_NOCTTY = 00010000; //!< O_NOCTTY 625543Ssaidi@eecs.umich.edu static const int TGT_O_SYNC = 00040000; //!< O_SYNC 635543Ssaidi@eecs.umich.edu static const int TGT_O_DRD = 00100000; //!< O_DRD 645543Ssaidi@eecs.umich.edu static const int TGT_O_DIRECTIO = 00200000; //!< O_DIRECTIO 655543Ssaidi@eecs.umich.edu static const int TGT_O_CACHE = 00400000; //!< O_CACHE 665543Ssaidi@eecs.umich.edu static const int TGT_O_DSYNC = 02000000; //!< O_DSYNC 675543Ssaidi@eecs.umich.edu static const int TGT_O_RSYNC = 04000000; //!< O_RSYNC 682553SN/A //@} 692553SN/A 702553SN/A /// For mmap(). 712553SN/A static const unsigned TGT_MAP_ANONYMOUS = 0x10; 728600Ssteve.reinhardt@amd.com static const unsigned TGT_MAP_FIXED = 0x100; 732553SN/A 742553SN/A //@{ 752553SN/A /// For getsysinfo(). 765569Snate@binkert.org static const unsigned GSI_PLATFORM_NAME = 103; //!< platform name as string 775569Snate@binkert.org static const unsigned GSI_CPU_INFO = 59; //!< CPU information 785569Snate@binkert.org static const unsigned GSI_PROC_TYPE = 60; //!< get proc_type 795569Snate@binkert.org static const unsigned GSI_MAX_CPU = 30; //!< max # CPUs on machine 805569Snate@binkert.org static const unsigned GSI_CPUS_IN_BOX = 55; //!< number of CPUs in system 815569Snate@binkert.org static const unsigned GSI_PHYSMEM = 19; //!< Physical memory in KB 825569Snate@binkert.org static const unsigned GSI_CLK_TCK = 42; //!< clock freq in Hz 832555SN/A static const unsigned GSI_IEEE_FP_CONTROL = 45; 842553SN/A //@} 852553SN/A 862553SN/A //@{ 872553SN/A /// For setsysinfo(). 882553SN/A static const unsigned SSI_IEEE_FP_CONTROL = 14; //!< ieee_set_fp_control() 892553SN/A //@} 902553SN/A 912553SN/A //@{ 922553SN/A /// ioctl() command codes. 939141Smarc.orr@gmail.com static const unsigned TGT_TIOCGETP = 0x40067408; 949141Smarc.orr@gmail.com static const unsigned TGT_TIOCSETP = 0x80067409; 959141Smarc.orr@gmail.com static const unsigned TGT_TIOCSETN = 0x8006740a; 969141Smarc.orr@gmail.com static const unsigned TGT_TIOCSETC = 0x80067411; 979141Smarc.orr@gmail.com static const unsigned TGT_TIOCGETC = 0x40067412; 989141Smarc.orr@gmail.com static const unsigned TGT_FIONREAD = 0x4004667f; 999141Smarc.orr@gmail.com static const unsigned TGT_TCGETS = 0x402c7413; 1009141Smarc.orr@gmail.com static const unsigned TGT_TCGETA = 0x40127417; 1019141Smarc.orr@gmail.com static const unsigned TGT_TCSETAW = 0x80147419; // 2.6.15 kernel 1022553SN/A //@} 1032553SN/A 1049141Smarc.orr@gmail.com static bool 1059141Smarc.orr@gmail.com isTtyReq(unsigned req) 1069141Smarc.orr@gmail.com { 1079141Smarc.orr@gmail.com switch (req) { 1089141Smarc.orr@gmail.com case TGT_TIOCGETP: 1099141Smarc.orr@gmail.com case TGT_TIOCSETP: 1109141Smarc.orr@gmail.com case TGT_TIOCSETN: 1119141Smarc.orr@gmail.com case TGT_TIOCSETC: 1129141Smarc.orr@gmail.com case TGT_TIOCGETC: 1139141Smarc.orr@gmail.com case TGT_TCGETS: 1149141Smarc.orr@gmail.com case TGT_TCGETA: 1159141Smarc.orr@gmail.com case TGT_TCSETAW: 1169141Smarc.orr@gmail.com return true; 1179141Smarc.orr@gmail.com default: 1189141Smarc.orr@gmail.com return false; 1199141Smarc.orr@gmail.com } 1209141Smarc.orr@gmail.com } 1219141Smarc.orr@gmail.com 1222553SN/A /// For table(). 1232553SN/A static const int TBL_SYSINFO = 12; 1242555SN/A 1259146Smarc.orr@gmail.com /// Resource constants for getrlimit() (overide some generics). 1269146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_NPROC = 8; 1279146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_AS = 7; 1289146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_NOFILE = 6; 1299146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_MEMLOCK = 9; 1306640Svince@csl.cornell.edu 1316640Svince@csl.cornell.edu typedef struct { 1326640Svince@csl.cornell.edu int64_t uptime; /* Seconds since boot */ 1336640Svince@csl.cornell.edu uint64_t loads[3]; /* 1, 5, and 15 minute load averages */ 1346640Svince@csl.cornell.edu uint64_t totalram; /* Total usable main memory size */ 1356640Svince@csl.cornell.edu uint64_t freeram; /* Available memory size */ 1366640Svince@csl.cornell.edu uint64_t sharedram; /* Amount of shared memory */ 1376640Svince@csl.cornell.edu uint64_t bufferram; /* Memory used by buffers */ 1386640Svince@csl.cornell.edu uint64_t totalswap; /* Total swap space size */ 1396640Svince@csl.cornell.edu uint64_t freeswap; /* swap space still available */ 1406640Svince@csl.cornell.edu uint16_t procs; /* Number of current processes */ 1416640Svince@csl.cornell.edu uint64_t totalhigh; /* Total high memory size */ 1426640Svince@csl.cornell.edu uint64_t freehigh; /* Available high memory size */ 1436640Svince@csl.cornell.edu uint64_t mem_unit; /* Memory unit size in bytes */ 1446640Svince@csl.cornell.edu } tgt_sysinfo; 1459112Smarc.orr@gmail.com 1469112Smarc.orr@gmail.com // For futex system call 1479112Smarc.orr@gmail.com static const unsigned TGT_EAGAIN = 35; 1489112Smarc.orr@gmail.com static const unsigned TGT_EWOULDBLOCK = TGT_EAGAIN; 1492553SN/A}; 1502553SN/A 1515569Snate@binkert.org#endif // __ALPHA_ALPHA_LINUX_LINUX_HH__ 152