linux.hh revision 11382
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 4411382Sbrandon.potter@amd.com static const int TGT_SIGHUP = 0x000001; 4511382Sbrandon.potter@amd.com static const int TGT_SIGINT = 0x000002; 4611382Sbrandon.potter@amd.com static const int TGT_SIGQUIT = 0x000003; 4711382Sbrandon.potter@amd.com static const int TGT_SIGILL = 0x000004; 4811382Sbrandon.potter@amd.com static const int TGT_SIGTRAP = 0x000005; 4911382Sbrandon.potter@amd.com static const int TGT_SIGABRT = 0x000006; 5011382Sbrandon.potter@amd.com static const int TGT_SIGEMT = 0x000007; 5111382Sbrandon.potter@amd.com static const int TGT_SIGFPE = 0x000008; 5211382Sbrandon.potter@amd.com static const int TGT_SIGKILL = 0x000009; 5311382Sbrandon.potter@amd.com static const int TGT_SIGBUS = 0x00000a; 5411382Sbrandon.potter@amd.com static const int TGT_SIGSEGV = 0x00000b; 5511382Sbrandon.potter@amd.com static const int TGT_SIGSYS = 0x00000c; 5611382Sbrandon.potter@amd.com static const int TGT_SIGPIPE = 0x00000d; 5711382Sbrandon.potter@amd.com static const int TGT_SIGALRM = 0x00000e; 5811382Sbrandon.potter@amd.com static const int TGT_SIGTERM = 0x00000f; 5911382Sbrandon.potter@amd.com static const int TGT_SIGURG = 0x000010; 6011382Sbrandon.potter@amd.com static const int TGT_SIGSTOP = 0x000011; 6111382Sbrandon.potter@amd.com static const int TGT_SIGTSTP = 0x000012; 6211382Sbrandon.potter@amd.com static const int TGT_SIGCONT = 0x000013; 6311382Sbrandon.potter@amd.com static const int TGT_SIGCHLD = 0x000014; 6411382Sbrandon.potter@amd.com static const int TGT_SIGTTIN = 0x000015; 6511382Sbrandon.potter@amd.com static const int TGT_SIGTTOU = 0x000016; 6611382Sbrandon.potter@amd.com static const int TGT_SIGIO = 0x000017; 6711382Sbrandon.potter@amd.com static const int TGT_SIGXCPU = 0x000018; 6811382Sbrandon.potter@amd.com static const int TGT_SIGXFSZ = 0x000019; 6911382Sbrandon.potter@amd.com static const int TGT_SIGVTALRM = 0x00001a; 7011382Sbrandon.potter@amd.com static const int TGT_SIGPROF = 0x00001b; 7111382Sbrandon.potter@amd.com static const int TGT_SIGWINCH = 0x00001c; 7211382Sbrandon.potter@amd.com static const int TGT_SIGINFO = 0x00001d; 7311382Sbrandon.potter@amd.com static const int TGT_SIGUSR1 = 0x00001e; 7411382Sbrandon.potter@amd.com static const int TGT_SIGUSR2 = 0x00001f; 7511382Sbrandon.potter@amd.com 762553SN/A /// This table maps the target open() flags to the corresponding 772553SN/A /// host open() flags. 7811381Sbrandon.potter@amd.com static SyscallFlagTransTable openFlagTable[]; 792553SN/A 802553SN/A /// Number of entries in openFlagTable[]. 812553SN/A static const int NUM_OPEN_FLAGS; 822553SN/A 832553SN/A //@{ 842553SN/A /// open(2) flag values. 8511382Sbrandon.potter@amd.com static const int TGT_O_RDONLY = 000000000; //!< O_RDONLY 8611382Sbrandon.potter@amd.com static const int TGT_O_WRONLY = 000000001; //!< O_WRONLY 8711382Sbrandon.potter@amd.com static const int TGT_O_RDWR = 000000002; //!< O_RDWR 8811382Sbrandon.potter@amd.com static const int TGT_O_CREAT = 000001000; //!< O_CREAT 8911382Sbrandon.potter@amd.com static const int TGT_O_EXCL = 000004000; //!< O_EXCL 9011382Sbrandon.potter@amd.com static const int TGT_O_NOCTTY = 000010000; //!< O_NOCTTY 9111382Sbrandon.potter@amd.com static const int TGT_O_TRUNC = 000002000; //!< O_TRUNC 9211382Sbrandon.potter@amd.com static const int TGT_O_APPEND = 000000010; //!< O_APPEND 9311382Sbrandon.potter@amd.com static const int TGT_O_NONBLOCK = 000000004; //!< O_NONBLOCK 9411382Sbrandon.potter@amd.com static const int TGT_O_DSYNC = 000040000; //!< O_DSYNC 9511382Sbrandon.potter@amd.com static const int TGT_FASYNC = 000020000; //!< FASYNC 9611382Sbrandon.potter@amd.com static const int TGT_O_DIRECT = 002000000; //!< O_DIRECT 9711382Sbrandon.potter@amd.com static const int TGT_O_LARGEFILE = 000400000; //!< O_LARGEFILE 9811382Sbrandon.potter@amd.com static const int TGT_O_DIRECTORY = 000100000; //!< O_DIRECTORY 9911382Sbrandon.potter@amd.com static const int TGT_O_NOFOLLOW = 000200000; //!< O_NOFOLLOW 10011382Sbrandon.potter@amd.com static const int TGT_O_NOATIME = 004000000; //!< O_NOATIME 10111382Sbrandon.potter@amd.com static const int TGT_O_CLOEXEC = 010000000; //!< O_CLOEXEC 10211382Sbrandon.potter@amd.com static const int TGT_O_SYNC = 020040000; //!< O_SYNC 10311382Sbrandon.potter@amd.com static const int TGT_O_PATH = 040000000; //!< O_PATH 1042553SN/A //@} 1052553SN/A 1062553SN/A /// For mmap(). 1072553SN/A static const unsigned TGT_MAP_ANONYMOUS = 0x10; 1088600Ssteve.reinhardt@amd.com static const unsigned TGT_MAP_FIXED = 0x100; 1092553SN/A 1102553SN/A //@{ 1112553SN/A /// For getsysinfo(). 1125569Snate@binkert.org static const unsigned GSI_PLATFORM_NAME = 103; //!< platform name as string 1135569Snate@binkert.org static const unsigned GSI_CPU_INFO = 59; //!< CPU information 1145569Snate@binkert.org static const unsigned GSI_PROC_TYPE = 60; //!< get proc_type 1155569Snate@binkert.org static const unsigned GSI_MAX_CPU = 30; //!< max # CPUs on machine 1165569Snate@binkert.org static const unsigned GSI_CPUS_IN_BOX = 55; //!< number of CPUs in system 1175569Snate@binkert.org static const unsigned GSI_PHYSMEM = 19; //!< Physical memory in KB 1185569Snate@binkert.org static const unsigned GSI_CLK_TCK = 42; //!< clock freq in Hz 1192555SN/A static const unsigned GSI_IEEE_FP_CONTROL = 45; 1202553SN/A //@} 1212553SN/A 1222553SN/A //@{ 1232553SN/A /// For setsysinfo(). 1242553SN/A static const unsigned SSI_IEEE_FP_CONTROL = 14; //!< ieee_set_fp_control() 1252553SN/A //@} 1262553SN/A 1272553SN/A //@{ 1282553SN/A /// ioctl() command codes. 1299141Smarc.orr@gmail.com static const unsigned TGT_TIOCGETP = 0x40067408; 1309141Smarc.orr@gmail.com static const unsigned TGT_TIOCSETP = 0x80067409; 1319141Smarc.orr@gmail.com static const unsigned TGT_TIOCSETN = 0x8006740a; 1329141Smarc.orr@gmail.com static const unsigned TGT_TIOCSETC = 0x80067411; 1339141Smarc.orr@gmail.com static const unsigned TGT_TIOCGETC = 0x40067412; 1349141Smarc.orr@gmail.com static const unsigned TGT_FIONREAD = 0x4004667f; 1359141Smarc.orr@gmail.com static const unsigned TGT_TCGETS = 0x402c7413; 1369141Smarc.orr@gmail.com static const unsigned TGT_TCGETA = 0x40127417; 1379141Smarc.orr@gmail.com static const unsigned TGT_TCSETAW = 0x80147419; // 2.6.15 kernel 1382553SN/A //@} 1392553SN/A 1409141Smarc.orr@gmail.com static bool 1419141Smarc.orr@gmail.com isTtyReq(unsigned req) 1429141Smarc.orr@gmail.com { 1439141Smarc.orr@gmail.com switch (req) { 1449141Smarc.orr@gmail.com case TGT_TIOCGETP: 1459141Smarc.orr@gmail.com case TGT_TIOCSETP: 1469141Smarc.orr@gmail.com case TGT_TIOCSETN: 1479141Smarc.orr@gmail.com case TGT_TIOCSETC: 1489141Smarc.orr@gmail.com case TGT_TIOCGETC: 1499141Smarc.orr@gmail.com case TGT_TCGETS: 1509141Smarc.orr@gmail.com case TGT_TCGETA: 1519141Smarc.orr@gmail.com case TGT_TCSETAW: 1529141Smarc.orr@gmail.com return true; 1539141Smarc.orr@gmail.com default: 1549141Smarc.orr@gmail.com return false; 1559141Smarc.orr@gmail.com } 1569141Smarc.orr@gmail.com } 1579141Smarc.orr@gmail.com 1582553SN/A /// For table(). 1592553SN/A static const int TBL_SYSINFO = 12; 1602555SN/A 1619146Smarc.orr@gmail.com /// Resource constants for getrlimit() (overide some generics). 1629146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_NPROC = 8; 1639146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_AS = 7; 1649146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_NOFILE = 6; 1659146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_MEMLOCK = 9; 16611320Ssteve.reinhardt@amd.com 1676640Svince@csl.cornell.edu typedef struct { 1686640Svince@csl.cornell.edu int64_t uptime; /* Seconds since boot */ 1696640Svince@csl.cornell.edu uint64_t loads[3]; /* 1, 5, and 15 minute load averages */ 1706640Svince@csl.cornell.edu uint64_t totalram; /* Total usable main memory size */ 1716640Svince@csl.cornell.edu uint64_t freeram; /* Available memory size */ 1726640Svince@csl.cornell.edu uint64_t sharedram; /* Amount of shared memory */ 1736640Svince@csl.cornell.edu uint64_t bufferram; /* Memory used by buffers */ 1746640Svince@csl.cornell.edu uint64_t totalswap; /* Total swap space size */ 1756640Svince@csl.cornell.edu uint64_t freeswap; /* swap space still available */ 1766640Svince@csl.cornell.edu uint16_t procs; /* Number of current processes */ 1776640Svince@csl.cornell.edu uint64_t totalhigh; /* Total high memory size */ 1786640Svince@csl.cornell.edu uint64_t freehigh; /* Available high memory size */ 1796640Svince@csl.cornell.edu uint64_t mem_unit; /* Memory unit size in bytes */ 1806640Svince@csl.cornell.edu } tgt_sysinfo; 1819112Smarc.orr@gmail.com 1829112Smarc.orr@gmail.com // For futex system call 1839112Smarc.orr@gmail.com static const unsigned TGT_EAGAIN = 35; 1849112Smarc.orr@gmail.com static const unsigned TGT_EWOULDBLOCK = TGT_EAGAIN; 1852553SN/A}; 1862553SN/A 1875569Snate@binkert.org#endif // __ALPHA_ALPHA_LINUX_LINUX_HH__ 188