linux.hh revision 4661
12553SN/A/* 22632Sstever@eecs.umich.edu * Copyright (c) 2006 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. 272632Sstever@eecs.umich.edu * 282632Sstever@eecs.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" 354661Sksewell@umich.edu#include <string> 364661Sksewell@umich.edu 374661Sksewell@umich.eduusing std::string; 382553SN/A 392553SN/Aclass MipsLinux : public Linux 402553SN/A{ 412553SN/A public: 422553SN/A 432553SN/A /// This table maps the target open() flags to the corresponding 442553SN/A /// host open() flags. 452553SN/A static OpenFlagTransTable openFlagTable[]; 462553SN/A 472553SN/A /// Number of entries in openFlagTable[]. 482553SN/A static const int NUM_OPEN_FLAGS; 492553SN/A 502553SN/A //@{ 512553SN/A /// open(2) flag values. 522555SN/A static const int TGT_O_RDONLY = 0x00000000; //!< O_RDONLY 532555SN/A static const int TGT_O_WRONLY = 0x00000001; //!< O_WRONLY 542555SN/A static const int TGT_O_RDWR = 0x00000002; //!< O_RDWR 552555SN/A static const int TGT_O_NONBLOCK = 0x00000080; //!< O_NONBLOCK 562555SN/A static const int TGT_O_APPEND = 0x00000008; //!< O_APPEND 572555SN/A static const int TGT_O_CREAT = 0x00000100; //!< O_CREAT 582555SN/A static const int TGT_O_TRUNC = 0x00000200; //!< O_TRUNC 592555SN/A static const int TGT_O_EXCL = 0x00000400; //!< O_EXCL 602555SN/A static const int TGT_O_NOCTTY = 0x00000800; //!< O_NOCTTY 612555SN/A static const int TGT_O_SYNC = 0x00000010; //!< O_SYNC 622555SN/A static const int TGT_O_DRD = 0x00010000; //!< O_DRD 632555SN/A static const int TGT_O_DIRECTIO = 0x00020000; //!< O_DIRECTIO 642555SN/A static const int TGT_O_CACHE = 0x00002000; //!< O_CACHE 652555SN/A static const int TGT_O_DSYNC = 0x00008000; //!< O_DSYNC 662555SN/A static const int TGT_O_RSYNC = 0x00040000; //!< O_RSYNC 672553SN/A //@} 682553SN/A 692553SN/A /// For mmap(). 702555SN/A static const unsigned TGT_MAP_ANONYMOUS = 0x800; 712553SN/A 722553SN/A //@{ 732553SN/A /// For getsysinfo(). 742553SN/A static const unsigned GSI_PLATFORM_NAME = 103; //!< platform name as string 752553SN/A static const unsigned GSI_CPU_INFO = 59; //!< CPU information 762553SN/A static const unsigned GSI_PROC_TYPE = 60; //!< get proc_type 772553SN/A static const unsigned GSI_MAX_CPU = 30; //!< max # cpu's on this machine 782553SN/A static const unsigned GSI_CPUS_IN_BOX = 55; //!< number of CPUs in system 792553SN/A static const unsigned GSI_PHYSMEM = 19; //!< Physical memory in KB 802553SN/A static const unsigned GSI_CLK_TCK = 42; //!< clock freq in Hz 812553SN/A //@} 822553SN/A 832553SN/A //@{ 842553SN/A /// For getrusage(). 852553SN/A static const int TGT_RUSAGE_SELF = 0; 862553SN/A static const int TGT_RUSAGE_CHILDREN = -1; 872553SN/A static const int TGT_RUSAGE_BOTH = -2; 882553SN/A //@} 892553SN/A 902553SN/A //@{ 912553SN/A /// For setsysinfo(). 922553SN/A static const unsigned SSI_IEEE_FP_CONTROL = 14; //!< ieee_set_fp_control() 932553SN/A //@} 942553SN/A 952553SN/A //@{ 962553SN/A /// ioctl() command codes. 974661Sksewell@umich.edu static const unsigned TIOCGETP = 0x7408; 984661Sksewell@umich.edu static const unsigned TIOCSETP = 0x7409; 994661Sksewell@umich.edu static const unsigned TIOCSETN = 0x740a; 1004661Sksewell@umich.edu static const unsigned TIOCSETC = 0x7411; 1014661Sksewell@umich.edu static const unsigned TIOCGETC = 0x7412; 1024661Sksewell@umich.edu static const unsigned FIONREAD = 0x467f; 1034661Sksewell@umich.edu static const unsigned TIOCISATTY = 0x5480; 1044661Sksewell@umich.edu static const unsigned TIOCGETS = 0x540d; 1054661Sksewell@umich.edu static const unsigned TIOCGETA = 0x7417; 1062553SN/A //@} 1072553SN/A 1082553SN/A /// For table(). 1092553SN/A static const int TBL_SYSINFO = 12; 1102555SN/A 1114661Sksewell@umich.edu /// Resource enumeration for getrlimit()/setrlimit(). 1122555SN/A enum rlimit_resources { 1132555SN/A TGT_RLIMIT_CPU = 0, 1142555SN/A TGT_RLIMIT_FSIZE = 1, 1152555SN/A TGT_RLIMIT_DATA = 2, 1162555SN/A TGT_RLIMIT_STACK = 3, 1172555SN/A TGT_RLIMIT_CORE = 4, 1182555SN/A TGT_RLIMIT_NOFILE = 5, 1192555SN/A TGT_RLIMIT_AS = 6, 1202555SN/A TGT_RLIMIT_RSS = 7, 1212555SN/A TGT_RLIMIT_VMEM = 7, 1222555SN/A TGT_RLIMIT_NPROC = 8, 1232555SN/A TGT_RLIMIT_MEMLOCK = 9, 1244661Sksewell@umich.edu TGT_RLIMIT_LOCKS = 10, 1254661Sksewell@umich.edu NUM_RLIMIT_RESOURCES 1262555SN/A }; 1272555SN/A 1284661Sksewell@umich.edu /// Offset used to make sure that processes don't 1294661Sksewell@umich.edu /// assign themselves to process IDs reserved for 1304661Sksewell@umich.edu /// the root users. 1314661Sksewell@umich.edu static const int NUM_ROOT_PROCS = 2; 1322553SN/A}; 1332553SN/A 1342553SN/A#endif 135