linux.hh revision 8600
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.
422553SN/A    static OpenFlagTransTable 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 getrusage().
832553SN/A    static const int TGT_RUSAGE_SELF = 0;
842553SN/A    static const int TGT_RUSAGE_CHILDREN = -1;
852553SN/A    static const int TGT_RUSAGE_BOTH = -2;
862553SN/A    //@}
872553SN/A
882553SN/A    //@{
892553SN/A    /// For setsysinfo().
902553SN/A    static const unsigned SSI_IEEE_FP_CONTROL = 14; //!< ieee_set_fp_control()
912553SN/A    //@}
922553SN/A
932553SN/A    //@{
942553SN/A    /// ioctl() command codes.
955867Sksewell@umich.edu    static const unsigned TIOCGETP_   = 0x7408;
965867Sksewell@umich.edu    static const unsigned TIOCSETP_   = 0x7409;
975867Sksewell@umich.edu    static const unsigned TIOCSETN_   = 0x740a;
985867Sksewell@umich.edu    static const unsigned TIOCSETC_   = 0x7411;
995867Sksewell@umich.edu    static const unsigned TIOCGETC_   = 0x7412;
1005867Sksewell@umich.edu    static const unsigned FIONREAD_   = 0x467f;
1015867Sksewell@umich.edu    static const unsigned TIOCISATTY_ = 0x5480;
1025867Sksewell@umich.edu    static const unsigned TIOCGETS_   = 0x540d;
1035867Sksewell@umich.edu    static const unsigned TIOCGETA_   = 0x7417;
1046689Stjones1@inf.ed.ac.uk    static const unsigned TCSETAW_    = 0x5403; // 2.6.15 kernel
1052553SN/A    //@}
1062553SN/A
1072553SN/A    /// For table().
1082553SN/A    static const int TBL_SYSINFO = 12;
1092555SN/A
1104661Sksewell@umich.edu    /// Resource enumeration for getrlimit()/setrlimit().
1112555SN/A    enum rlimit_resources {
1122555SN/A        TGT_RLIMIT_CPU = 0,
1132555SN/A        TGT_RLIMIT_FSIZE = 1,
1142555SN/A        TGT_RLIMIT_DATA = 2,
1152555SN/A        TGT_RLIMIT_STACK = 3,
1162555SN/A        TGT_RLIMIT_CORE = 4,
1172555SN/A        TGT_RLIMIT_NOFILE = 5,
1182555SN/A        TGT_RLIMIT_AS = 6,
1192555SN/A        TGT_RLIMIT_RSS = 7,
1202555SN/A        TGT_RLIMIT_VMEM = 7,
1212555SN/A        TGT_RLIMIT_NPROC = 8,
1222555SN/A        TGT_RLIMIT_MEMLOCK = 9,
1234661Sksewell@umich.edu        TGT_RLIMIT_LOCKS = 10,
1244661Sksewell@umich.edu        NUM_RLIMIT_RESOURCES
1252555SN/A    };
1262555SN/A
1274661Sksewell@umich.edu    /// Offset used to make sure that processes don't
1284661Sksewell@umich.edu    /// assign themselves to process IDs reserved for
1294661Sksewell@umich.edu    /// the root users.
1304661Sksewell@umich.edu    static const int NUM_ROOT_PROCS = 2;
1316640Svince@csl.cornell.edu
1326640Svince@csl.cornell.edu    typedef struct {
1336640Svince@csl.cornell.edu       int32_t  uptime;    /* Seconds since boot */
1346640Svince@csl.cornell.edu       uint32_t loads[3];  /* 1, 5, and 15 minute load averages */
1356640Svince@csl.cornell.edu       uint32_t totalram;  /* Total usable main memory size */
1366640Svince@csl.cornell.edu       uint32_t freeram;   /* Available memory size */
1376640Svince@csl.cornell.edu       uint32_t sharedram; /* Amount of shared memory */
1386640Svince@csl.cornell.edu       uint32_t bufferram; /* Memory used by buffers */
1396640Svince@csl.cornell.edu       uint32_t totalswap; /* Total swap space size */
1406640Svince@csl.cornell.edu       uint32_t freeswap;  /* swap space still available */
1416640Svince@csl.cornell.edu       uint16_t procs;     /* Number of current processes */
1426640Svince@csl.cornell.edu       uint32_t totalhigh; /* Total high memory size */
1436640Svince@csl.cornell.edu       uint32_t freehigh;  /* Available high memory size */
1446640Svince@csl.cornell.edu       uint32_t mem_unit;  /* Memory unit size in bytes */
1456640Svince@csl.cornell.edu    } tgt_sysinfo;
1466640Svince@csl.cornell.edu
1472553SN/A};
1482553SN/A
1492553SN/A#endif
150