linux.hh revision 11381
12553SN/A/* 25254Sksewell@umich.edu * Copyright (c) 2006 The Regents of The University of Michigan 35254Sksewell@umich.edu * All rights reserved. 42553SN/A * 55254Sksewell@umich.edu * Redistribution and use in source and binary forms, with or without 65254Sksewell@umich.edu * modification, are permitted provided that the following conditions are 75254Sksewell@umich.edu * met: redistributions of source code must retain the above copyright 85254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer; 95254Sksewell@umich.edu * redistributions in binary form must reproduce the above copyright 105254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer in the 115254Sksewell@umich.edu * documentation and/or other materials provided with the distribution; 125254Sksewell@umich.edu * neither the name of the copyright holders nor the names of its 135254Sksewell@umich.edu * contributors may be used to endorse or promote products derived from 145254Sksewell@umich.edu * this software without specific prior written permission. 152553SN/A * 165254Sksewell@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 175254Sksewell@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 185254Sksewell@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 195254Sksewell@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 205254Sksewell@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 215254Sksewell@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 225254Sksewell@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 235254Sksewell@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 245254Sksewell@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 255254Sksewell@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 265254Sksewell@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272632Sstever@eecs.umich.edu * 285254Sksewell@umich.edu * Authors: Korey Sewell 292553SN/A */ 302553SN/A 312599SN/A#ifndef __ARCH_MIPS_LINUX_LINUX_HH__ 322599SN/A#define __ARCH_MIPS_LINUX_LINUX_HH__ 332553SN/A 342553SN/A#include "kern/linux/linux.hh" 352553SN/A 362553SN/Aclass MipsLinux : public Linux 372553SN/A{ 382553SN/A public: 392553SN/A 402553SN/A /// This table maps the target open() flags to the corresponding 412553SN/A /// host open() flags. 4211381Sbrandon.potter@amd.com static SyscallFlagTransTable openFlagTable[]; 432553SN/A 442553SN/A /// Number of entries in openFlagTable[]. 452553SN/A static const int NUM_OPEN_FLAGS; 462553SN/A 472553SN/A //@{ 482553SN/A /// open(2) flag values. 495543Ssaidi@eecs.umich.edu static const int TGT_O_RDONLY = 0x00000000; //!< O_RDONLY 505543Ssaidi@eecs.umich.edu static const int TGT_O_WRONLY = 0x00000001; //!< O_WRONLY 515543Ssaidi@eecs.umich.edu static const int TGT_O_RDWR = 0x00000002; //!< O_RDWR 525543Ssaidi@eecs.umich.edu static const int TGT_O_NONBLOCK = 0x00000080; //!< O_NONBLOCK 535543Ssaidi@eecs.umich.edu static const int TGT_O_APPEND = 0x00000008; //!< O_APPEND 545543Ssaidi@eecs.umich.edu static const int TGT_O_CREAT = 0x00000100; //!< O_CREAT 555543Ssaidi@eecs.umich.edu static const int TGT_O_TRUNC = 0x00000200; //!< O_TRUNC 565543Ssaidi@eecs.umich.edu static const int TGT_O_EXCL = 0x00000400; //!< O_EXCL 575543Ssaidi@eecs.umich.edu static const int TGT_O_NOCTTY = 0x00000800; //!< O_NOCTTY 585543Ssaidi@eecs.umich.edu static const int TGT_O_SYNC = 0x00000010; //!< O_SYNC 595543Ssaidi@eecs.umich.edu static const int TGT_O_DRD = 0x00010000; //!< O_DRD 605543Ssaidi@eecs.umich.edu static const int TGT_O_DIRECTIO = 0x00020000; //!< O_DIRECTIO 615543Ssaidi@eecs.umich.edu static const int TGT_O_CACHE = 0x00002000; //!< O_CACHE 625543Ssaidi@eecs.umich.edu static const int TGT_O_DSYNC = 0x00008000; //!< O_DSYNC 635543Ssaidi@eecs.umich.edu static const int TGT_O_RSYNC = 0x00040000; //!< O_RSYNC 642553SN/A //@} 652553SN/A 662553SN/A /// For mmap(). 672555SN/A static const unsigned TGT_MAP_ANONYMOUS = 0x800; 688600Ssteve.reinhardt@amd.com static const unsigned TGT_MAP_FIXED = 0x10; 692553SN/A 702553SN/A //@{ 712553SN/A /// For getsysinfo(). 726378Sgblack@eecs.umich.edu static const unsigned GSI_PLATFORM_NAME = 103; //!< platform name as string 736378Sgblack@eecs.umich.edu static const unsigned GSI_CPU_INFO = 59; //!< CPU information 746378Sgblack@eecs.umich.edu static const unsigned GSI_PROC_TYPE = 60; //!< get proc_type 756378Sgblack@eecs.umich.edu static const unsigned GSI_MAX_CPU = 30; //!< max # cpu's on this machine 766378Sgblack@eecs.umich.edu static const unsigned GSI_CPUS_IN_BOX = 55; //!< number of CPUs in system 776378Sgblack@eecs.umich.edu static const unsigned GSI_PHYSMEM = 19; //!< Physical memory in KB 786378Sgblack@eecs.umich.edu static const unsigned GSI_CLK_TCK = 42; //!< clock freq in Hz 792553SN/A //@} 802553SN/A 812553SN/A //@{ 822553SN/A /// For setsysinfo(). 832553SN/A static const unsigned SSI_IEEE_FP_CONTROL = 14; //!< ieee_set_fp_control() 842553SN/A //@} 852553SN/A 862553SN/A //@{ 872553SN/A /// ioctl() command codes. 889141Smarc.orr@gmail.com static const unsigned TGT_TCGETA = 0x5401; 899141Smarc.orr@gmail.com static const unsigned TGT_TCSETAW = 0x5403; 909141Smarc.orr@gmail.com static const unsigned TGT_TCGETS = 0x540d; 919141Smarc.orr@gmail.com static const unsigned TGT_FIONREAD = 0x467f; 929141Smarc.orr@gmail.com static const unsigned TGT_TIOCGETP = 0x7408; 939141Smarc.orr@gmail.com static const unsigned TGT_TIOCSETP = 0x7409; 949141Smarc.orr@gmail.com static const unsigned TGT_TIOCSETN = 0x740a; 952553SN/A //@} 962553SN/A 979141Smarc.orr@gmail.com static bool 989141Smarc.orr@gmail.com isTtyReq(unsigned req) 999141Smarc.orr@gmail.com { 1009141Smarc.orr@gmail.com switch (req) { 1019141Smarc.orr@gmail.com case TGT_TIOCGETP: 1029141Smarc.orr@gmail.com case TGT_TIOCSETP: 1039141Smarc.orr@gmail.com case TGT_TIOCSETN: 1049141Smarc.orr@gmail.com case TGT_FIONREAD: 1059141Smarc.orr@gmail.com case TGT_TCGETS: 1069141Smarc.orr@gmail.com case TGT_TCGETA: 1079141Smarc.orr@gmail.com case TGT_TCSETAW: 1089141Smarc.orr@gmail.com return true; 1099141Smarc.orr@gmail.com default: 1109141Smarc.orr@gmail.com return false; 1119141Smarc.orr@gmail.com } 1129141Smarc.orr@gmail.com } 1139141Smarc.orr@gmail.com 1142553SN/A /// For table(). 1152553SN/A static const int TBL_SYSINFO = 12; 1162555SN/A 1179146Smarc.orr@gmail.com /// Resource constants for getrlimit() (overide some generics). 1189146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_NPROC = 8; 1199146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_AS = 6; 12010290Smitch.hayenga@arm.com static const unsigned TGT_RLIMIT_RSS = 7; 1219146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_NOFILE = 5; 1229146Smarc.orr@gmail.com static const unsigned TGT_RLIMIT_MEMLOCK = 9; 1232555SN/A 1244661Sksewell@umich.edu /// Offset used to make sure that processes don't 1254661Sksewell@umich.edu /// assign themselves to process IDs reserved for 1264661Sksewell@umich.edu /// the root users. 1274661Sksewell@umich.edu static const int NUM_ROOT_PROCS = 2; 12811320Ssteve.reinhardt@amd.com 1296640Svince@csl.cornell.edu typedef struct { 1306640Svince@csl.cornell.edu int32_t uptime; /* Seconds since boot */ 1316640Svince@csl.cornell.edu uint32_t loads[3]; /* 1, 5, and 15 minute load averages */ 1326640Svince@csl.cornell.edu uint32_t totalram; /* Total usable main memory size */ 1336640Svince@csl.cornell.edu uint32_t freeram; /* Available memory size */ 1346640Svince@csl.cornell.edu uint32_t sharedram; /* Amount of shared memory */ 1356640Svince@csl.cornell.edu uint32_t bufferram; /* Memory used by buffers */ 1366640Svince@csl.cornell.edu uint32_t totalswap; /* Total swap space size */ 1376640Svince@csl.cornell.edu uint32_t freeswap; /* swap space still available */ 1386640Svince@csl.cornell.edu uint16_t procs; /* Number of current processes */ 1396640Svince@csl.cornell.edu uint32_t totalhigh; /* Total high memory size */ 1406640Svince@csl.cornell.edu uint32_t freehigh; /* Available high memory size */ 1416640Svince@csl.cornell.edu uint32_t mem_unit; /* Memory unit size in bytes */ 1426640Svince@csl.cornell.edu } tgt_sysinfo; 14311320Ssteve.reinhardt@amd.com 1442553SN/A}; 1452553SN/A 1462553SN/A#endif 147