linux.hh revision 10290:b7715fb7cf9f
12SN/A/*
21762SN/A * Copyright (c) 2006 The Regents of The University of Michigan
32SN/A * All rights reserved.
42SN/A *
52SN/A * Redistribution and use in source and binary forms, with or without
62SN/A * modification, are permitted provided that the following conditions are
72SN/A * met: redistributions of source code must retain the above copyright
82SN/A * notice, this list of conditions and the following disclaimer;
92SN/A * redistributions in binary form must reproduce the above copyright
102SN/A * notice, this list of conditions and the following disclaimer in the
112SN/A * documentation and/or other materials provided with the distribution;
122SN/A * neither the name of the copyright holders nor the names of its
132SN/A * contributors may be used to endorse or promote products derived from
142SN/A * this software without specific prior written permission.
152SN/A *
162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Korey Sewell
292665Ssaidi@eecs.umich.edu */
302SN/A
312SN/A#ifndef __ARCH_MIPS_LINUX_LINUX_HH__
321110SN/A#define __ARCH_MIPS_LINUX_LINUX_HH__
332680Sktlim@umich.edu
342196SN/A#include "kern/linux/linux.hh"
352196SN/A
362289SN/Aclass MipsLinux : public Linux
372289SN/A{
382289SN/A  public:
392SN/A
402167SN/A    /// This table maps the target open() flags to the corresponding
412167SN/A    /// host open() flags.
422167SN/A    static OpenFlagTransTable openFlagTable[];
432203SN/A
442203SN/A    /// Number of entries in openFlagTable[].
452222SN/A    static const int NUM_OPEN_FLAGS;
462166SN/A
472203SN/A    //@{
482203SN/A    /// open(2) flag values.
492222SN/A    static const int TGT_O_RDONLY       = 0x00000000;   //!< O_RDONLY
502166SN/A    static const int TGT_O_WRONLY       = 0x00000001;   //!< O_WRONLY
512147SN/A    static const int TGT_O_RDWR         = 0x00000002;   //!< O_RDWR
522147SN/A    static const int TGT_O_NONBLOCK     = 0x00000080;   //!< O_NONBLOCK
532222SN/A    static const int TGT_O_APPEND       = 0x00000008;   //!< O_APPEND
542147SN/A    static const int TGT_O_CREAT        = 0x00000100;   //!< O_CREAT
552147SN/A    static const int TGT_O_TRUNC        = 0x00000200;   //!< O_TRUNC
562147SN/A    static const int TGT_O_EXCL         = 0x00000400;   //!< O_EXCL
572222SN/A    static const int TGT_O_NOCTTY       = 0x00000800;   //!< O_NOCTTY
582147SN/A    static const int TGT_O_SYNC         = 0x00000010;   //!< O_SYNC
592147SN/A    static const int TGT_O_DRD          = 0x00010000;   //!< O_DRD
602147SN/A    static const int TGT_O_DIRECTIO     = 0x00020000;   //!< O_DIRECTIO
612222SN/A    static const int TGT_O_CACHE        = 0x00002000;   //!< O_CACHE
622147SN/A    static const int TGT_O_DSYNC        = 0x00008000;   //!< O_DSYNC
632147SN/A    static const int TGT_O_RSYNC        = 0x00040000;   //!< O_RSYNC
642147SN/A    //@}
652222SN/A
662147SN/A    /// For mmap().
672147SN/A    static const unsigned TGT_MAP_ANONYMOUS = 0x800;
682147SN/A    static const unsigned TGT_MAP_FIXED     = 0x10;
692222SN/A
702147SN/A    //@{
712147SN/A    /// For getsysinfo().
722147SN/A    static const unsigned GSI_PLATFORM_NAME = 103; //!< platform name as string
732222SN/A    static const unsigned GSI_CPU_INFO = 59;       //!< CPU information
742147SN/A    static const unsigned GSI_PROC_TYPE = 60;      //!< get proc_type
752147SN/A    static const unsigned GSI_MAX_CPU = 30;        //!< max # cpu's on this machine
762147SN/A    static const unsigned GSI_CPUS_IN_BOX = 55;    //!< number of CPUs in system
772222SN/A    static const unsigned GSI_PHYSMEM = 19;        //!< Physical memory in KB
782147SN/A    static const unsigned GSI_CLK_TCK = 42;        //!< clock freq in Hz
792289SN/A    //@}
802289SN/A
812289SN/A    //@{
822289SN/A    /// For setsysinfo().
832147SN/A    static const unsigned SSI_IEEE_FP_CONTROL = 14; //!< ieee_set_fp_control()
842147SN/A    //@}
852222SN/A
862147SN/A    //@{
872147SN/A    /// ioctl() command codes.
882147SN/A    static const unsigned TGT_TCGETA     = 0x5401;
892222SN/A    static const unsigned TGT_TCSETAW    = 0x5403;
902147SN/A    static const unsigned TGT_TCGETS     = 0x540d;
912147SN/A    static const unsigned TGT_FIONREAD   = 0x467f;
922147SN/A    static const unsigned TGT_TIOCGETP   = 0x7408;
932222SN/A    static const unsigned TGT_TIOCSETP   = 0x7409;
942147SN/A    static const unsigned TGT_TIOCSETN   = 0x740a;
952147SN/A    //@}
962147SN/A
972222SN/A    static bool
982147SN/A    isTtyReq(unsigned req)
992147SN/A    {
1002147SN/A        switch (req) {
1012222SN/A          case TGT_TIOCGETP:
1022147SN/A          case TGT_TIOCSETP:
1032147SN/A          case TGT_TIOCSETN:
1042147SN/A          case TGT_FIONREAD:
1052222SN/A          case TGT_TCGETS:
1062147SN/A          case TGT_TCGETA:
1072147SN/A          case TGT_TCSETAW:
1082147SN/A            return true;
1092222SN/A          default:
1102147SN/A            return false;
1112174SN/A        }
1122174SN/A    }
1132680Sktlim@umich.edu
1142174SN/A    /// For table().
1152680Sktlim@umich.edu    static const int TBL_SYSINFO = 12;
1162222SN/A
1172174SN/A    /// Resource constants for getrlimit() (overide some generics).
1182196SN/A    static const unsigned TGT_RLIMIT_NPROC = 8;
1192680Sktlim@umich.edu    static const unsigned TGT_RLIMIT_AS = 6;
1202680Sktlim@umich.edu    static const unsigned TGT_RLIMIT_RSS = 7;
1212196SN/A    static const unsigned TGT_RLIMIT_NOFILE = 5;
1222201SN/A    static const unsigned TGT_RLIMIT_MEMLOCK = 9;
1232196SN/A
1242680Sktlim@umich.edu    /// Offset used to make sure that processes don't
1252680Sktlim@umich.edu    /// assign themselves to process IDs reserved for
1262196SN/A    /// the root users.
1272196SN/A    static const int NUM_ROOT_PROCS = 2;
1282680Sktlim@umich.edu
1292680Sktlim@umich.edu    typedef struct {
1302174SN/A       int32_t  uptime;    /* Seconds since boot */
1312174SN/A       uint32_t loads[3];  /* 1, 5, and 15 minute load averages */
1322680Sktlim@umich.edu       uint32_t totalram;  /* Total usable main memory size */
1332201SN/A       uint32_t freeram;   /* Available memory size */
1342680Sktlim@umich.edu       uint32_t sharedram; /* Amount of shared memory */
1352201SN/A       uint32_t bufferram; /* Memory used by buffers */
1362201SN/A       uint32_t totalswap; /* Total swap space size */
1372201SN/A       uint32_t freeswap;  /* swap space still available */
1382680Sktlim@umich.edu       uint16_t procs;     /* Number of current processes */
1392289SN/A       uint32_t totalhigh; /* Total high memory size */
1402289SN/A       uint32_t freehigh;  /* Available high memory size */
1412289SN/A       uint32_t mem_unit;  /* Memory unit size in bytes */
1422289SN/A    } tgt_sysinfo;
1432289SN/A
1442289SN/A};
1452680Sktlim@umich.edu
1462289SN/A#endif
1472289SN/A