linux.hh revision 9112
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
442553SN/A    /// This table maps the target open() flags to the corresponding
452553SN/A    /// host open() flags.
462553SN/A    static OpenFlagTransTable openFlagTable[];
472553SN/A
482553SN/A    /// Number of entries in openFlagTable[].
492553SN/A    static const int NUM_OPEN_FLAGS;
502553SN/A
512553SN/A    //@{
522553SN/A    /// open(2) flag values.
535543Ssaidi@eecs.umich.edu    static const int TGT_O_RDONLY       = 00000000;     //!< O_RDONLY
545543Ssaidi@eecs.umich.edu    static const int TGT_O_WRONLY       = 00000001;     //!< O_WRONLY
555543Ssaidi@eecs.umich.edu    static const int TGT_O_RDWR         = 00000002;     //!< O_RDWR
565543Ssaidi@eecs.umich.edu    static const int TGT_O_NONBLOCK     = 00000004;     //!< O_NONBLOCK
575543Ssaidi@eecs.umich.edu    static const int TGT_O_APPEND       = 00000010;     //!< O_APPEND
585543Ssaidi@eecs.umich.edu    static const int TGT_O_CREAT        = 00001000;     //!< O_CREAT
595543Ssaidi@eecs.umich.edu    static const int TGT_O_TRUNC        = 00002000;     //!< O_TRUNC
605543Ssaidi@eecs.umich.edu    static const int TGT_O_EXCL         = 00004000;     //!< O_EXCL
615543Ssaidi@eecs.umich.edu    static const int TGT_O_NOCTTY       = 00010000;     //!< O_NOCTTY
625543Ssaidi@eecs.umich.edu    static const int TGT_O_SYNC         = 00040000;     //!< O_SYNC
635543Ssaidi@eecs.umich.edu    static const int TGT_O_DRD          = 00100000;     //!< O_DRD
645543Ssaidi@eecs.umich.edu    static const int TGT_O_DIRECTIO     = 00200000;     //!< O_DIRECTIO
655543Ssaidi@eecs.umich.edu    static const int TGT_O_CACHE        = 00400000;     //!< O_CACHE
665543Ssaidi@eecs.umich.edu    static const int TGT_O_DSYNC        = 02000000;     //!< O_DSYNC
675543Ssaidi@eecs.umich.edu    static const int TGT_O_RSYNC        = 04000000;     //!< O_RSYNC
682553SN/A    //@}
692553SN/A
702553SN/A    /// For mmap().
712553SN/A    static const unsigned TGT_MAP_ANONYMOUS = 0x10;
728600Ssteve.reinhardt@amd.com    static const unsigned TGT_MAP_FIXED     = 0x100;
732553SN/A
742553SN/A    //@{
752553SN/A    /// For getsysinfo().
765569Snate@binkert.org    static const unsigned GSI_PLATFORM_NAME = 103; //!< platform name as string
775569Snate@binkert.org    static const unsigned GSI_CPU_INFO      = 59; //!< CPU information
785569Snate@binkert.org    static const unsigned GSI_PROC_TYPE     = 60; //!< get proc_type
795569Snate@binkert.org    static const unsigned GSI_MAX_CPU       = 30; //!< max # CPUs on machine
805569Snate@binkert.org    static const unsigned GSI_CPUS_IN_BOX   = 55; //!< number of CPUs in system
815569Snate@binkert.org    static const unsigned GSI_PHYSMEM       = 19; //!< Physical memory in KB
825569Snate@binkert.org    static const unsigned GSI_CLK_TCK       = 42; //!< clock freq in Hz
832555SN/A    static const unsigned GSI_IEEE_FP_CONTROL = 45;
842553SN/A    //@}
852553SN/A
862553SN/A    //@{
872553SN/A    /// For getrusage().
882553SN/A    static const int TGT_RUSAGE_SELF     = 0;
892553SN/A    static const int TGT_RUSAGE_CHILDREN = -1;
902553SN/A    static const int TGT_RUSAGE_BOTH     = -2;
912553SN/A    //@}
922553SN/A
932553SN/A    //@{
942553SN/A    /// For setsysinfo().
952553SN/A    static const unsigned SSI_IEEE_FP_CONTROL = 14; //!< ieee_set_fp_control()
962553SN/A    //@}
972553SN/A
982553SN/A    //@{
992553SN/A    /// ioctl() command codes.
1004131Sbinkertn@umich.edu    static const unsigned TIOCGETP_   = 0x40067408;
1014131Sbinkertn@umich.edu    static const unsigned TIOCSETP_   = 0x80067409;
1024131Sbinkertn@umich.edu    static const unsigned TIOCSETN_   = 0x8006740a;
1034131Sbinkertn@umich.edu    static const unsigned TIOCSETC_   = 0x80067411;
1044131Sbinkertn@umich.edu    static const unsigned TIOCGETC_   = 0x40067412;
1054131Sbinkertn@umich.edu    static const unsigned FIONREAD_   = 0x4004667f;
1064131Sbinkertn@umich.edu    static const unsigned TIOCISATTY_ = 0x2000745e;
1074131Sbinkertn@umich.edu    static const unsigned TIOCGETS_   = 0x402c7413;
1084131Sbinkertn@umich.edu    static const unsigned TIOCGETA_   = 0x40127417;
1096689Stjones1@inf.ed.ac.uk    static const unsigned TCSETAW_    = 0x80147419; // 2.6.15 kernel
1102553SN/A    //@}
1112553SN/A
1122553SN/A    /// For table().
1132553SN/A    static const int TBL_SYSINFO = 12;
1142555SN/A
1152555SN/A    /// Resource enumeration for getrlimit().
1162555SN/A    enum rlimit_resources {
1172555SN/A        TGT_RLIMIT_CPU = 0,
1182555SN/A        TGT_RLIMIT_FSIZE = 1,
1192555SN/A        TGT_RLIMIT_DATA = 2,
1202555SN/A        TGT_RLIMIT_STACK = 3,
1212555SN/A        TGT_RLIMIT_CORE = 4,
1222555SN/A        TGT_RLIMIT_RSS = 5,
1232555SN/A        TGT_RLIMIT_NOFILE = 6,
1242555SN/A        TGT_RLIMIT_AS = 7,
1252555SN/A        TGT_RLIMIT_VMEM = 7,
1262555SN/A        TGT_RLIMIT_NPROC = 8,
1272555SN/A        TGT_RLIMIT_MEMLOCK = 9,
1282555SN/A        TGT_RLIMIT_LOCKS = 10
1292555SN/A    };
1306640Svince@csl.cornell.edu
1316640Svince@csl.cornell.edu    typedef struct {
1326640Svince@csl.cornell.edu       int64_t  uptime;    /* Seconds since boot */
1336640Svince@csl.cornell.edu       uint64_t loads[3];  /* 1, 5, and 15 minute load averages */
1346640Svince@csl.cornell.edu       uint64_t totalram;  /* Total usable main memory size */
1356640Svince@csl.cornell.edu       uint64_t freeram;   /* Available memory size */
1366640Svince@csl.cornell.edu       uint64_t sharedram; /* Amount of shared memory */
1376640Svince@csl.cornell.edu       uint64_t bufferram; /* Memory used by buffers */
1386640Svince@csl.cornell.edu       uint64_t totalswap; /* Total swap space size */
1396640Svince@csl.cornell.edu       uint64_t freeswap;  /* swap space still available */
1406640Svince@csl.cornell.edu       uint16_t procs;     /* Number of current processes */
1416640Svince@csl.cornell.edu       uint64_t totalhigh; /* Total high memory size */
1426640Svince@csl.cornell.edu       uint64_t freehigh;  /* Available high memory size */
1436640Svince@csl.cornell.edu       uint64_t mem_unit;  /* Memory unit size in bytes */
1446640Svince@csl.cornell.edu    } tgt_sysinfo;
1459112Smarc.orr@gmail.com
1469112Smarc.orr@gmail.com    // For futex system call
1479112Smarc.orr@gmail.com    static const unsigned TGT_EAGAIN      = 35;
1489112Smarc.orr@gmail.com    static const unsigned TGT_EWOULDBLOCK = TGT_EAGAIN;
1492553SN/A};
1502553SN/A
1515569Snate@binkert.org#endif // __ALPHA_ALPHA_LINUX_LINUX_HH__
152