linux.hh revision 11320:42ecb523c64a
16657Snate@binkert.org/*
26657Snate@binkert.org * Copyright (c) 2010, 2011-2012, 2015 ARM Limited
36657Snate@binkert.org * All rights reserved
46657Snate@binkert.org *
56657Snate@binkert.org * The license below extends only to copyright in the software and shall
66657Snate@binkert.org * not be construed as granting a license to any other intellectual
76657Snate@binkert.org * property including but not limited to intellectual property relating
86657Snate@binkert.org * to a hardware implementation of the functionality of the software
96657Snate@binkert.org * licensed hereunder.  You may use the software subject to the license
106657Snate@binkert.org * terms below provided that you ensure that this notice is replicated
116657Snate@binkert.org * unmodified and in its entirety in all distributions of the software,
126657Snate@binkert.org * modified or unmodified, in source code or in binary form.
136657Snate@binkert.org *
146657Snate@binkert.org * Copyright (c) 2003-2005 The Regents of The University of Michigan
156657Snate@binkert.org * Copyright (c) 2007-2008 The Florida State University
166657Snate@binkert.org * All rights reserved.
176657Snate@binkert.org *
186657Snate@binkert.org * Redistribution and use in source and binary forms, with or without
196657Snate@binkert.org * modification, are permitted provided that the following conditions are
206657Snate@binkert.org * met: redistributions of source code must retain the above copyright
216657Snate@binkert.org * notice, this list of conditions and the following disclaimer;
226657Snate@binkert.org * redistributions in binary form must reproduce the above copyright
236657Snate@binkert.org * notice, this list of conditions and the following disclaimer in the
246657Snate@binkert.org * documentation and/or other materials provided with the distribution;
256657Snate@binkert.org * neither the name of the copyright holders nor the names of its
266657Snate@binkert.org * contributors may be used to endorse or promote products derived from
276657Snate@binkert.org * this software without specific prior written permission.
286999Snate@binkert.org *
296657Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
306657Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
316657Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
326657Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
336657Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
346882SBrad.Beckmann@amd.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
357055Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
366882SBrad.Beckmann@amd.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
376882SBrad.Beckmann@amd.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
386882SBrad.Beckmann@amd.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
396882SBrad.Beckmann@amd.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
406882SBrad.Beckmann@amd.com *
416888SBrad.Beckmann@amd.com * Authors: Ali Saidi
426882SBrad.Beckmann@amd.com *          Stephen Hines
436882SBrad.Beckmann@amd.com */
446657Snate@binkert.org
456657Snate@binkert.org#ifndef __ARCH_ARM_LINUX_LINUX_HH__
466657Snate@binkert.org#define __ARCH_ARM_LINUX_LINUX_HH__
476657Snate@binkert.org
486657Snate@binkert.org#include "kern/linux/linux.hh"
496657Snate@binkert.org
506882SBrad.Beckmann@amd.comclass ArmLinux32 : public Linux
516882SBrad.Beckmann@amd.com{
526882SBrad.Beckmann@amd.com  public:
536882SBrad.Beckmann@amd.com
546882SBrad.Beckmann@amd.com    /// This table maps the target open() flags to the corresponding
556882SBrad.Beckmann@amd.com    /// host open() flags.
566657Snate@binkert.org    static OpenFlagTransTable openFlagTable[];
576657Snate@binkert.org
586657Snate@binkert.org    /// Number of entries in openFlagTable[].
596657Snate@binkert.org    static const int NUM_OPEN_FLAGS;
606657Snate@binkert.org
616657Snate@binkert.org    //@{
626657Snate@binkert.org    /// Basic ARM Linux types
636657Snate@binkert.org    typedef uint32_t size_t;
646657Snate@binkert.org    typedef uint32_t off_t;
656657Snate@binkert.org    typedef int32_t time_t;
666657Snate@binkert.org    typedef int32_t clock_t;
676657Snate@binkert.org    //@}
686657Snate@binkert.org
696657Snate@binkert.org    //@{
706657Snate@binkert.org    /// open(2) flag values.
716657Snate@binkert.org    static const int TGT_O_RDONLY    = 00000000; //!< O_RDONLY
726657Snate@binkert.org    static const int TGT_O_WRONLY    = 00000001; //!< O_WRONLY
736657Snate@binkert.org    static const int TGT_O_RDWR      = 00000002; //!< O_RDWR
746657Snate@binkert.org    static const int TGT_O_CREAT     = 00000100; //!< O_CREAT
756657Snate@binkert.org    static const int TGT_O_EXCL      = 00000200; //!< O_EXCL
766657Snate@binkert.org    static const int TGT_O_NOCTTY    = 00000400; //!< O_NOCTTY
776657Snate@binkert.org    static const int TGT_O_TRUNC     = 00001000; //!< O_TRUNC
786657Snate@binkert.org    static const int TGT_O_APPEND    = 00002000; //!< O_APPEND
796657Snate@binkert.org    static const int TGT_O_NONBLOCK  = 00004000; //!< O_NONBLOCK
806657Snate@binkert.org    static const int TGT_O_SYNC      = 00010000; //!< O_SYNC
816657Snate@binkert.org    static const int TGT_FASYNC      = 00020000; //!< FASYNC
826657Snate@binkert.org    static const int TGT_O_DIRECT    = 00040000; //!< O_DIRECT
836657Snate@binkert.org    static const int TGT_O_LARGEFILE = 00100000; //!< O_LARGEFILE
846657Snate@binkert.org    static const int TGT_O_DIRECTORY = 00200000; //!< O_DIRECTORY
856779SBrad.Beckmann@amd.com    static const int TGT_O_NOFOLLOW  = 00400000; //!< O_NOFOLLOW
866657Snate@binkert.org    static const int TGT_O_NOATIME   = 01000000; //!< O_NOATIME
876657Snate@binkert.org    static const int TGT_O_CLOEXEC   = 02000000; //!< O_NOATIME
886657Snate@binkert.org
896657Snate@binkert.org
906657Snate@binkert.org    //@}
916657Snate@binkert.org
926657Snate@binkert.org    /// For mmap().
936657Snate@binkert.org    static const unsigned TGT_MAP_ANONYMOUS = 0x20;
946657Snate@binkert.org    static const unsigned TGT_MAP_FIXED     = 0x10;
956657Snate@binkert.org
966657Snate@binkert.org    /// For table().
976657Snate@binkert.org    static const int TBL_SYSINFO = 12;
986657Snate@binkert.org
996657Snate@binkert.org    /// Limit struct for getrlimit/setrlimit.
1006657Snate@binkert.org    struct rlimit {
1016657Snate@binkert.org        uint32_t  rlim_cur;     //!< soft limit
1026657Snate@binkert.org        uint32_t  rlim_max;     //!< hard limit
1036657Snate@binkert.org    };
1046657Snate@binkert.org
1056657Snate@binkert.org    /// For gettimeofday().
1066657Snate@binkert.org    struct timeval {
1076657Snate@binkert.org        int32_t tv_sec;         //!< seconds
1086657Snate@binkert.org        int32_t tv_usec;        //!< microseconds
1096657Snate@binkert.org    };
1106657Snate@binkert.org
1116657Snate@binkert.org    struct timespec {
1126657Snate@binkert.org        int32_t tv_sec;   //!< seconds
1136657Snate@binkert.org        int32_t tv_nsec;  //!< nanoseconds
1146657Snate@binkert.org    };
1156657Snate@binkert.org
1166657Snate@binkert.org    // For writev/readv
1176657Snate@binkert.org    struct tgt_iovec {
1186657Snate@binkert.org        uint32_t iov_base; // void *
1196657Snate@binkert.org        uint32_t iov_len;
1206657Snate@binkert.org    };
1216657Snate@binkert.org
1226657Snate@binkert.org
1236657Snate@binkert.org    typedef struct {
1246657Snate@binkert.org        uint32_t st_dev;
1256657Snate@binkert.org        uint32_t st_ino;
1266657Snate@binkert.org        uint16_t st_mode;
1276657Snate@binkert.org        uint16_t st_nlink;
1286657Snate@binkert.org        uint16_t st_uid;
1296657Snate@binkert.org        uint16_t st_gid;
1306657Snate@binkert.org        uint32_t st_rdev;
1316657Snate@binkert.org        uint32_t __pad1;
1326657Snate@binkert.org        uint32_t st_size;
1336657Snate@binkert.org        uint32_t st_blksize;
1346657Snate@binkert.org        uint32_t __pad2;
1356657Snate@binkert.org        uint32_t st_blocks;
1366657Snate@binkert.org        uint32_t st_atimeX;
1376657Snate@binkert.org        uint32_t st_atime_nsec;
1386657Snate@binkert.org        uint32_t st_mtimeX;
1396657Snate@binkert.org        uint32_t st_mtime_nsec;
1406657Snate@binkert.org        uint32_t st_ctimeX;
1416877Ssteve.reinhardt@amd.com        uint32_t st_ctime_nsec;
1426657Snate@binkert.org    } tgt_stat;
1436657Snate@binkert.org
1446657Snate@binkert.org    typedef struct {
1456657Snate@binkert.org        uint64_t  st_dev;
1466657Snate@binkert.org        uint8_t   __pad0[4];
1476657Snate@binkert.org        uint32_t  __st_ino;
1487542SBrad.Beckmann@amd.com        uint32_t  st_mode;
1497542SBrad.Beckmann@amd.com        uint32_t  st_nlink;
1506657Snate@binkert.org        uint32_t  st_uid;
1516657Snate@binkert.org        uint32_t  st_gid;
1526657Snate@binkert.org        uint64_t  st_rdev;
1536657Snate@binkert.org        uint8_t   __pad3[4];
1546877Ssteve.reinhardt@amd.com        int64_t   __attribute__ ((aligned (8))) st_size;
1556999Snate@binkert.org        uint32_t  st_blksize;
1566877Ssteve.reinhardt@amd.com        uint64_t  __attribute__ ((aligned (8))) st_blocks;
1576877Ssteve.reinhardt@amd.com        uint32_t  st_atimeX;
1586877Ssteve.reinhardt@amd.com        uint32_t  st_atime_nsec;
1596877Ssteve.reinhardt@amd.com        uint32_t  st_mtimeX;
1606877Ssteve.reinhardt@amd.com        uint32_t  st_mtime_nsec;
1616877Ssteve.reinhardt@amd.com        uint32_t  st_ctimeX;
1626877Ssteve.reinhardt@amd.com        uint32_t  st_ctime_nsec;
1636877Ssteve.reinhardt@amd.com        uint64_t  st_ino;
1646877Ssteve.reinhardt@amd.com    } tgt_stat64;
1656877Ssteve.reinhardt@amd.com
1666877Ssteve.reinhardt@amd.com    typedef struct {
1676877Ssteve.reinhardt@amd.com        int32_t  uptime;    /* Seconds since boot */
1686877Ssteve.reinhardt@amd.com        uint32_t loads[3];  /* 1, 5, and 15 minute load averages */
1696877Ssteve.reinhardt@amd.com        uint32_t totalram;  /* Total usable main memory size */
1706877Ssteve.reinhardt@amd.com        uint32_t freeram;   /* Available memory size */
1716877Ssteve.reinhardt@amd.com        uint32_t sharedram; /* Amount of shared memory */
1726882SBrad.Beckmann@amd.com        uint32_t bufferram; /* Memory used by buffers */
1736882SBrad.Beckmann@amd.com        uint32_t totalswap; /* Total swap space size */
1746882SBrad.Beckmann@amd.com        uint32_t freeswap;  /* swap space still available */
1756882SBrad.Beckmann@amd.com        uint16_t procs;     /* Number of current processes */
1766882SBrad.Beckmann@amd.com        uint32_t totalhigh; /* Total high memory size */
1776882SBrad.Beckmann@amd.com        uint32_t freehigh;  /* Available high memory size */
1786882SBrad.Beckmann@amd.com        uint32_t mem_unit;  /* Memory unit size in bytes */
1796877Ssteve.reinhardt@amd.com    } tgt_sysinfo;
1806877Ssteve.reinhardt@amd.com
1816877Ssteve.reinhardt@amd.com    /// For getrusage().
1826877Ssteve.reinhardt@amd.com    struct rusage {
1836657Snate@binkert.org        struct timeval ru_utime;        //!< user time used
1846657Snate@binkert.org        struct timeval ru_stime;        //!< system time used
1856999Snate@binkert.org        int32_t ru_maxrss;              //!< max rss
1866657Snate@binkert.org        int32_t ru_ixrss;               //!< integral shared memory size
1876657Snate@binkert.org        int32_t ru_idrss;               //!< integral unshared data "
1886657Snate@binkert.org        int32_t ru_isrss;               //!< integral unshared stack "
1896657Snate@binkert.org        int32_t ru_minflt;              //!< page reclaims - total vmfaults
1906657Snate@binkert.org        int32_t ru_majflt;              //!< page faults
1916657Snate@binkert.org        int32_t ru_nswap;               //!< swaps
1927007Snate@binkert.org        int32_t ru_inblock;             //!< block input operations
1936657Snate@binkert.org        int32_t ru_oublock;             //!< block output operations
1946657Snate@binkert.org        int32_t ru_msgsnd;              //!< messages sent
1956657Snate@binkert.org        int32_t ru_msgrcv;              //!< messages received
1966657Snate@binkert.org        int32_t ru_nsignals;            //!< signals received
1976657Snate@binkert.org        int32_t ru_nvcsw;               //!< voluntary context switches
1987007Snate@binkert.org        int32_t ru_nivcsw;              //!< involuntary "
1997007Snate@binkert.org    };
2006657Snate@binkert.org
2017002Snate@binkert.org    /// For times().
2027002Snate@binkert.org    struct tms {
2037002Snate@binkert.org        int32_t tms_utime;      //!< user time
2047002Snate@binkert.org        int32_t tms_stime;      //!< system time
2056877Ssteve.reinhardt@amd.com        int32_t tms_cutime;     //!< user time of children
2066877Ssteve.reinhardt@amd.com        int32_t tms_cstime;     //!< system time of children
2076657Snate@binkert.org    };
2086657Snate@binkert.org};
2096657Snate@binkert.org
2106657Snate@binkert.orgclass ArmLinux64 : public Linux
2116657Snate@binkert.org{
2126657Snate@binkert.org  public:
2137542SBrad.Beckmann@amd.com
2146657Snate@binkert.org    /// This table maps the target open() flags to the corresponding
2156657Snate@binkert.org    /// host open() flags.
2166657Snate@binkert.org    static OpenFlagTransTable openFlagTable[];
2176657Snate@binkert.org
2186793SBrad.Beckmann@amd.com    /// Number of entries in openFlagTable[].
2196657Snate@binkert.org    static const int NUM_OPEN_FLAGS;
2206657Snate@binkert.org
2216657Snate@binkert.org    //@{
2226657Snate@binkert.org    /// Basic ARM Linux types
2236657Snate@binkert.org    typedef uint64_t size_t;
2247002Snate@binkert.org    typedef uint64_t off_t;
2256657Snate@binkert.org    typedef int64_t time_t;
2267007Snate@binkert.org    typedef int64_t clock_t;
2277007Snate@binkert.org    //@}
2287007Snate@binkert.org
2297007Snate@binkert.org    //@{
2307007Snate@binkert.org    /// open(2) flag values.
2316657Snate@binkert.org    static const int TGT_O_RDONLY    = 00000000; //!< O_RDONLY
2326877Ssteve.reinhardt@amd.com    static const int TGT_O_WRONLY    = 00000001; //!< O_WRONLY
2336877Ssteve.reinhardt@amd.com    static const int TGT_O_RDWR      = 00000002; //!< O_RDWR
2346657Snate@binkert.org    static const int TGT_O_CREAT     = 00000100; //!< O_CREAT
2356877Ssteve.reinhardt@amd.com    static const int TGT_O_EXCL      = 00000200; //!< O_EXCL
2366657Snate@binkert.org    static const int TGT_O_NOCTTY    = 00000400; //!< O_NOCTTY
2376657Snate@binkert.org    static const int TGT_O_TRUNC     = 00001000; //!< O_TRUNC
2387002Snate@binkert.org    static const int TGT_O_APPEND    = 00002000; //!< O_APPEND
2397002Snate@binkert.org    static const int TGT_O_NONBLOCK  = 00004000; //!< O_NONBLOCK
2406657Snate@binkert.org    static const int TGT_O_SYNC      = 00010000; //!< O_SYNC
2417567SBrad.Beckmann@amd.com    static const int TGT_FASYNC      = 00020000; //!< FASYNC
2427567SBrad.Beckmann@amd.com    static const int TGT_O_DIRECT    = 00040000; //!< O_DIRECT
2436881SBrad.Beckmann@amd.com    static const int TGT_O_LARGEFILE = 00100000; //!< O_LARGEFILE
2447002Snate@binkert.org    static const int TGT_O_DIRECTORY = 00200000; //!< O_DIRECTORY
2457002Snate@binkert.org    static const int TGT_O_NOFOLLOW  = 00400000; //!< O_NOFOLLOW
2466657Snate@binkert.org    static const int TGT_O_NOATIME   = 01000000; //!< O_NOATIME
2477002Snate@binkert.org    static const int TGT_O_CLOEXEC   = 02000000; //!< O_NOATIME
2486902SBrad.Beckmann@amd.com    //@}
2496863Sdrh5@cs.wisc.edu
2506863Sdrh5@cs.wisc.edu    /// For mmap().
2517007Snate@binkert.org    static const unsigned TGT_MAP_ANONYMOUS = 0x20;
2526657Snate@binkert.org    static const unsigned TGT_MAP_FIXED     = 0x10;
2536657Snate@binkert.org
2546657Snate@binkert.org    //@{
2556657Snate@binkert.org    /// For getrusage().
2566657Snate@binkert.org    static const int TGT_RUSAGE_SELF = 0;
2576657Snate@binkert.org    static const int TGT_RUSAGE_CHILDREN = -1;
2586882SBrad.Beckmann@amd.com    static const int TGT_RUSAGE_BOTH = -2;
2596882SBrad.Beckmann@amd.com    //@}
2606882SBrad.Beckmann@amd.com
2616882SBrad.Beckmann@amd.com    //@{
2626657Snate@binkert.org    /// ioctl() command codes.
2636657Snate@binkert.org    static const unsigned TIOCGETP_   = 0x5401;
2646657Snate@binkert.org    static const unsigned TIOCSETP_   = 0x80067409;
2656657Snate@binkert.org    static const unsigned TIOCSETN_   = 0x8006740a;
2667007Snate@binkert.org    static const unsigned TIOCSETC_   = 0x80067411;
2677007Snate@binkert.org    static const unsigned TIOCGETC_   = 0x40067412;
2687007Snate@binkert.org    static const unsigned FIONREAD_   = 0x4004667f;
2697007Snate@binkert.org    static const unsigned TIOCISATTY_ = 0x2000745e;
2707007Snate@binkert.org    static const unsigned TIOCGETS_   = 0x402c7413;
2717007Snate@binkert.org    static const unsigned TIOCGETA_   = 0x5405;
2727007Snate@binkert.org    static const unsigned TCSETAW_    = 0x5407;     // 2.6.15 kernel
2737007Snate@binkert.org    //@}
2747007Snate@binkert.org
2757002Snate@binkert.org    /// For table().
2766657Snate@binkert.org    static const int TBL_SYSINFO = 12;
2776657Snate@binkert.org
2786657Snate@binkert.org    /// Resource enumeration for getrlimit().
2797055Snate@binkert.org    enum rlimit_resources {
2806657Snate@binkert.org        TGT_RLIMIT_CPU = 0,
2816657Snate@binkert.org        TGT_RLIMIT_FSIZE = 1,
2826657Snate@binkert.org        TGT_RLIMIT_DATA = 2,
2836863Sdrh5@cs.wisc.edu        TGT_RLIMIT_STACK = 3,
2847055Snate@binkert.org        TGT_RLIMIT_CORE = 4,
2857567SBrad.Beckmann@amd.com        TGT_RLIMIT_RSS = 5,
2867567SBrad.Beckmann@amd.com        TGT_RLIMIT_NPROC = 6,
2877567SBrad.Beckmann@amd.com        TGT_RLIMIT_NOFILE = 7,
2887567SBrad.Beckmann@amd.com        TGT_RLIMIT_MEMLOCK = 8,
2897567SBrad.Beckmann@amd.com        TGT_RLIMIT_AS = 9,
2907542SBrad.Beckmann@amd.com        TGT_RLIMIT_LOCKS = 10
2917542SBrad.Beckmann@amd.com    };
2926657Snate@binkert.org
2937007Snate@binkert.org    /// Limit struct for getrlimit/setrlimit.
2946657Snate@binkert.org    struct rlimit {
2956657Snate@binkert.org        uint64_t  rlim_cur;     //!< soft limit
2966657Snate@binkert.org        uint64_t  rlim_max;     //!< hard limit
2976657Snate@binkert.org    };
2986657Snate@binkert.org
2996657Snate@binkert.org    /// For gettimeofday().
3006657Snate@binkert.org    struct timeval {
3016657Snate@binkert.org        int64_t tv_sec;         //!< seconds
3026657Snate@binkert.org        int64_t tv_usec;        //!< microseconds
3036657Snate@binkert.org    };
3046657Snate@binkert.org
3056657Snate@binkert.org    struct timespec {
3066657Snate@binkert.org        int64_t tv_sec;   //!< seconds
3076657Snate@binkert.org        int64_t tv_nsec;  //!< nanoseconds
3086657Snate@binkert.org    };
3096657Snate@binkert.org
3106657Snate@binkert.org    // For writev/readv
3116657Snate@binkert.org    struct tgt_iovec {
3126657Snate@binkert.org        uint64_t iov_base; // void *
3137007Snate@binkert.org        uint64_t iov_len;
3146657Snate@binkert.org    };
3156657Snate@binkert.org
3166657Snate@binkert.org    typedef struct {
3176657Snate@binkert.org        uint64_t st_dev;
3186657Snate@binkert.org        uint64_t st_ino;
3196657Snate@binkert.org        uint64_t st_nlink;
3206657Snate@binkert.org        uint32_t st_mode;
3216657Snate@binkert.org        uint32_t st_uid;
3226657Snate@binkert.org        uint32_t st_gid;
3236657Snate@binkert.org        uint32_t __pad0;
3247007Snate@binkert.org        uint64_t st_rdev;
3256657Snate@binkert.org        uint64_t st_size;
3266657Snate@binkert.org        uint64_t st_blksize;
3276657Snate@binkert.org        uint64_t st_blocks;
3286657Snate@binkert.org        uint64_t st_atimeX;
3296657Snate@binkert.org        uint64_t st_atime_nsec;
3306999Snate@binkert.org        uint64_t st_mtimeX;
3316657Snate@binkert.org        uint64_t st_mtime_nsec;
3326657Snate@binkert.org        uint64_t st_ctimeX;
3336657Snate@binkert.org        uint64_t st_ctime_nsec;
3346657Snate@binkert.org    } tgt_stat;
3357007Snate@binkert.org
3366657Snate@binkert.org    typedef struct {
3376657Snate@binkert.org        uint64_t st_dev;
3386657Snate@binkert.org        uint64_t st_ino;
3396657Snate@binkert.org        uint32_t st_mode;
3406657Snate@binkert.org        uint32_t st_nlink;
3417832Snate@binkert.org        uint32_t st_uid;
3427002Snate@binkert.org        uint32_t st_gid;
3437002Snate@binkert.org        uint32_t __pad0;
3447002Snate@binkert.org        uint64_t st_rdev;
3457056Snate@binkert.org        uint64_t st_size;
3466657Snate@binkert.org        uint64_t st_blksize;
3476657Snate@binkert.org        uint64_t st_blocks;
3486657Snate@binkert.org        uint64_t st_atimeX;
3496657Snate@binkert.org        uint64_t st_atime_nsec;
3507056Snate@binkert.org        uint64_t st_mtimeX;
3517056Snate@binkert.org        uint64_t st_mtime_nsec;
3526657Snate@binkert.org        uint64_t st_ctimeX;
3537002Snate@binkert.org        uint64_t st_ctime_nsec;
3547002Snate@binkert.org    } tgt_stat64;
3556657Snate@binkert.org
3566657Snate@binkert.org    typedef struct {
3576657Snate@binkert.org        int64_t  uptime;    /* Seconds since boot */
3586657Snate@binkert.org        uint64_t loads[3];  /* 1, 5, and 15 minute load averages */
3596657Snate@binkert.org        uint64_t totalram;  /* Total usable main memory size */
3606793SBrad.Beckmann@amd.com        uint64_t freeram;   /* Available memory size */
3616657Snate@binkert.org        uint64_t sharedram; /* Amount of shared memory */
3626657Snate@binkert.org        uint64_t bufferram; /* Memory used by buffers */
3636657Snate@binkert.org        uint64_t totalswap; /* Total swap space size */
3646657Snate@binkert.org        uint64_t freeswap;  /* swap space still available */
3656877Ssteve.reinhardt@amd.com        uint16_t procs;     /* Number of current processes */
3666877Ssteve.reinhardt@amd.com        uint16_t pad;
3676877Ssteve.reinhardt@amd.com        uint64_t totalhigh; /* Total high memory size */
3686877Ssteve.reinhardt@amd.com        uint64_t freehigh;  /* Available high memory size */
3696877Ssteve.reinhardt@amd.com        uint32_t mem_unit;  /* Memory unit size in bytes */
3706877Ssteve.reinhardt@amd.com    } tgt_sysinfo;
3716657Snate@binkert.org
3727542SBrad.Beckmann@amd.com    /// For getrusage().
3736657Snate@binkert.org    struct rusage {
3747007Snate@binkert.org        struct timeval ru_utime;        //!< user time used
3756657Snate@binkert.org        struct timeval ru_stime;        //!< system time used
3766657Snate@binkert.org        int64_t ru_maxrss;              //!< max rss
3777007Snate@binkert.org        int64_t ru_ixrss;               //!< integral shared memory size
3786657Snate@binkert.org        int64_t ru_idrss;               //!< integral unshared data "
3796877Ssteve.reinhardt@amd.com        int64_t ru_isrss;               //!< integral unshared stack "
3806877Ssteve.reinhardt@amd.com        int64_t ru_minflt;              //!< page reclaims - total vmfaults
3816657Snate@binkert.org        int64_t ru_majflt;              //!< page faults
3826877Ssteve.reinhardt@amd.com        int64_t ru_nswap;               //!< swaps
3836877Ssteve.reinhardt@amd.com        int64_t ru_inblock;             //!< block input operations
3846877Ssteve.reinhardt@amd.com        int64_t ru_oublock;             //!< block output operations
3856877Ssteve.reinhardt@amd.com        int64_t ru_msgsnd;              //!< messages sent
3866877Ssteve.reinhardt@amd.com        int64_t ru_msgrcv;              //!< messages received
3876969SBrad.Beckmann@amd.com        int64_t ru_nsignals;            //!< signals received
3886657Snate@binkert.org        int64_t ru_nvcsw;               //!< voluntary context switches
3897567SBrad.Beckmann@amd.com        int64_t ru_nivcsw;              //!< involuntary "
3907567SBrad.Beckmann@amd.com    };
3917567SBrad.Beckmann@amd.com
3927567SBrad.Beckmann@amd.com    /// For times().
3937567SBrad.Beckmann@amd.com    struct tms {
3947567SBrad.Beckmann@amd.com        int64_t tms_utime;      //!< user time
3956657Snate@binkert.org        int64_t tms_stime;      //!< system time
3966882SBrad.Beckmann@amd.com        int64_t tms_cutime;     //!< user time of children
3976882SBrad.Beckmann@amd.com        int64_t tms_cstime;     //!< system time of children
3986882SBrad.Beckmann@amd.com    };
3996882SBrad.Beckmann@amd.com};
4006882SBrad.Beckmann@amd.com
4016882SBrad.Beckmann@amd.com#endif
4026882SBrad.Beckmann@amd.com