linux.hh revision 11383
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(). 10711383Sbrandon.potter@amd.com static SyscallFlagTransTable mmapFlagTable[]; 10811383Sbrandon.potter@amd.com 10911383Sbrandon.potter@amd.com static const unsigned TGT_MAP_SHARED = 0x000001; 11011383Sbrandon.potter@amd.com static const unsigned TGT_MAP_PRIVATE = 0x000002; 11111383Sbrandon.potter@amd.com static const unsigned TGT_MAP_ANON = 0x000010; 11211383Sbrandon.potter@amd.com static const unsigned TGT_MAP_DENYWRITE = 0x002000; 11311383Sbrandon.potter@amd.com static const unsigned TGT_MAP_EXECUTABLE = 0x004000; 11411383Sbrandon.potter@amd.com static const unsigned TGT_MAP_FILE = 0x000000; 11511383Sbrandon.potter@amd.com static const unsigned TGT_MAP_GROWSDOWN = 0x001000; 11611383Sbrandon.potter@amd.com static const unsigned TGT_MAP_HUGETLB = 0x100000; 11711383Sbrandon.potter@amd.com static const unsigned TGT_MAP_LOCKED = 0x008000; 11811383Sbrandon.potter@amd.com static const unsigned TGT_MAP_NONBLOCK = 0x040000; 11911383Sbrandon.potter@amd.com static const unsigned TGT_MAP_NORESERVE = 0x010000; 12011383Sbrandon.potter@amd.com static const unsigned TGT_MAP_POPULATE = 0x020000; 12111383Sbrandon.potter@amd.com static const unsigned TGT_MAP_STACK = 0x080000; 12211383Sbrandon.potter@amd.com static const unsigned TGT_MAP_ANONYMOUS = 0x000010; 12311383Sbrandon.potter@amd.com static const unsigned TGT_MAP_FIXED = 0x000100; 12411383Sbrandon.potter@amd.com 12511383Sbrandon.potter@amd.com static const unsigned NUM_MMAP_FLAGS; 1262553SN/A 1272553SN/A //@{ 1282553SN/A /// For getsysinfo(). 1295569Snate@binkert.org static const unsigned GSI_PLATFORM_NAME = 103; //!< platform name as string 1305569Snate@binkert.org static const unsigned GSI_CPU_INFO = 59; //!< CPU information 1315569Snate@binkert.org static const unsigned GSI_PROC_TYPE = 60; //!< get proc_type 1325569Snate@binkert.org static const unsigned GSI_MAX_CPU = 30; //!< max # CPUs on machine 1335569Snate@binkert.org static const unsigned GSI_CPUS_IN_BOX = 55; //!< number of CPUs in system 1345569Snate@binkert.org static const unsigned GSI_PHYSMEM = 19; //!< Physical memory in KB 1355569Snate@binkert.org static const unsigned GSI_CLK_TCK = 42; //!< clock freq in Hz 1362555SN/A static const unsigned GSI_IEEE_FP_CONTROL = 45; 1372553SN/A //@} 1382553SN/A 1392553SN/A //@{ 1402553SN/A /// For setsysinfo(). 1412553SN/A static const unsigned SSI_IEEE_FP_CONTROL = 14; //!< ieee_set_fp_control() 1422553SN/A //@} 1432553SN/A 1442553SN/A //@{ 1452553SN/A /// ioctl() command codes. 1469141Smarc.orr@gmail.com static const unsigned TGT_TIOCGETP = 0x40067408; 1479141Smarc.orr@gmail.com static const unsigned TGT_TIOCSETP = 0x80067409; 1489141Smarc.orr@gmail.com static const unsigned TGT_TIOCSETN = 0x8006740a; 1499141Smarc.orr@gmail.com static const unsigned TGT_TIOCSETC = 0x80067411; 1509141Smarc.orr@gmail.com static const unsigned TGT_TIOCGETC = 0x40067412; 1519141Smarc.orr@gmail.com static const unsigned TGT_FIONREAD = 0x4004667f; 1529141Smarc.orr@gmail.com static const unsigned TGT_TCGETS = 0x402c7413; 1539141Smarc.orr@gmail.com static const unsigned TGT_TCGETA = 0x40127417; 1549141Smarc.orr@gmail.com static const unsigned TGT_TCSETAW = 0x80147419; // 2.6.15 kernel 1552553SN/A //@} 1562553SN/A 1579141Smarc.orr@gmail.com static bool 1589141Smarc.orr@gmail.com isTtyReq(unsigned req) 1599141Smarc.orr@gmail.com { 1609141Smarc.orr@gmail.com switch (req) { 1619141Smarc.orr@gmail.com case TGT_TIOCGETP: 1629141Smarc.orr@gmail.com case TGT_TIOCSETP: 1639141Smarc.orr@gmail.com case TGT_TIOCSETN: 1649141Smarc.orr@gmail.com case TGT_TIOCSETC: 1659141Smarc.orr@gmail.com case TGT_TIOCGETC: 1669141Smarc.orr@gmail.com case TGT_TCGETS: 1679141Smarc.orr@gmail.com case TGT_TCGETA: 1689141Smarc.orr@gmail.com case TGT_TCSETAW: 1699141Smarc.orr@gmail.com return true; 1709141Smarc.orr@gmail.com default: 1719141Smarc.orr@gmail.com return false; 1729141Smarc.orr@gmail.com } 1739141Smarc.orr@gmail.com } 1749141Smarc.orr@gmail.com 1752553SN/A /// For table(). 1762553SN/A static const int TBL_SYSINFO = 12; 1772555SN/A 1789146Smarc.orr@gmail.com /// Resource constants for getrlimit() (overide some generics). 1799146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_NPROC = 8; 1809146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_AS = 7; 1819146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_NOFILE = 6; 1829146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_MEMLOCK = 9; 18311320Ssteve.reinhardt@amd.com 1846640Svince@csl.cornell.edu typedef struct { 1856640Svince@csl.cornell.edu int64_t uptime; /* Seconds since boot */ 1866640Svince@csl.cornell.edu uint64_t loads[3]; /* 1, 5, and 15 minute load averages */ 1876640Svince@csl.cornell.edu uint64_t totalram; /* Total usable main memory size */ 1886640Svince@csl.cornell.edu uint64_t freeram; /* Available memory size */ 1896640Svince@csl.cornell.edu uint64_t sharedram; /* Amount of shared memory */ 1906640Svince@csl.cornell.edu uint64_t bufferram; /* Memory used by buffers */ 1916640Svince@csl.cornell.edu uint64_t totalswap; /* Total swap space size */ 1926640Svince@csl.cornell.edu uint64_t freeswap; /* swap space still available */ 1936640Svince@csl.cornell.edu uint16_t procs; /* Number of current processes */ 1946640Svince@csl.cornell.edu uint64_t totalhigh; /* Total high memory size */ 1956640Svince@csl.cornell.edu uint64_t freehigh; /* Available high memory size */ 1966640Svince@csl.cornell.edu uint64_t mem_unit; /* Memory unit size in bytes */ 1976640Svince@csl.cornell.edu } tgt_sysinfo; 1989112Smarc.orr@gmail.com 1999112Smarc.orr@gmail.com // For futex system call 2009112Smarc.orr@gmail.com static const unsigned TGT_EAGAIN = 35; 2019112Smarc.orr@gmail.com static const unsigned TGT_EWOULDBLOCK = TGT_EAGAIN; 2022553SN/A}; 2032553SN/A 2045569Snate@binkert.org#endif // __ALPHA_ALPHA_LINUX_LINUX_HH__ 205