linux.hh revision 6415
14202Sbinkertn@umich.edu/* 24202Sbinkertn@umich.edu * Copyright (c) 2003-2005 The Regents of The University of Michigan 34202Sbinkertn@umich.edu * Copyright (c) 2007-2008 The Florida State University 44202Sbinkertn@umich.edu * All rights reserved. 54202Sbinkertn@umich.edu * 64202Sbinkertn@umich.edu * Redistribution and use in source and binary forms, with or without 74202Sbinkertn@umich.edu * modification, are permitted provided that the following conditions are 84202Sbinkertn@umich.edu * met: redistributions of source code must retain the above copyright 94202Sbinkertn@umich.edu * notice, this list of conditions and the following disclaimer; 104202Sbinkertn@umich.edu * redistributions in binary form must reproduce the above copyright 114202Sbinkertn@umich.edu * notice, this list of conditions and the following disclaimer in the 124202Sbinkertn@umich.edu * documentation and/or other materials provided with the distribution; 134202Sbinkertn@umich.edu * neither the name of the copyright holders nor the names of its 144202Sbinkertn@umich.edu * contributors may be used to endorse or promote products derived from 154202Sbinkertn@umich.edu * this software without specific prior written permission. 164202Sbinkertn@umich.edu * 174202Sbinkertn@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 184202Sbinkertn@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 194202Sbinkertn@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 204202Sbinkertn@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 214202Sbinkertn@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 224202Sbinkertn@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 234202Sbinkertn@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 244202Sbinkertn@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 254202Sbinkertn@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 264202Sbinkertn@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 274202Sbinkertn@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 284202Sbinkertn@umich.edu * 294202Sbinkertn@umich.edu * Authors: Stephen Hines 304202Sbinkertn@umich.edu */ 314202Sbinkertn@umich.edu 324202Sbinkertn@umich.edu#ifndef __ARCH_ARM_LINUX_LINUX_HH__ 334202Sbinkertn@umich.edu#define __ARCH_ARM_LINUX_LINUX_HH__ 344202Sbinkertn@umich.edu 354202Sbinkertn@umich.edu#include "kern/linux/linux.hh" 364486Sbinkertn@umich.edu 374202Sbinkertn@umich.educlass ArmLinux : public Linux 384202Sbinkertn@umich.edu{ 394202Sbinkertn@umich.edu public: 404202Sbinkertn@umich.edu 414486Sbinkertn@umich.edu /// This table maps the target open() flags to the corresponding 424202Sbinkertn@umich.edu /// host open() flags. 434202Sbinkertn@umich.edu static OpenFlagTransTable openFlagTable[]; 445192Ssaidi@eecs.umich.edu 455192Ssaidi@eecs.umich.edu /// Number of entries in openFlagTable[]. 468335Snate@binkert.org static const int NUM_OPEN_FLAGS; 475192Ssaidi@eecs.umich.edu 484202Sbinkertn@umich.edu //@{ 494202Sbinkertn@umich.edu /// open(2) flag values. 505529Snate@binkert.org static const int TGT_O_RDONLY = 00000000; //!< O_RDONLY 51 static const int TGT_O_WRONLY = 00000001; //!< O_WRONLY 52 static const int TGT_O_RDWR = 00000002; //!< O_RDWR 53 static const int TGT_O_CREAT = 00000100; //!< O_CREAT 54 static const int TGT_O_EXCL = 00000200; //!< O_EXCL 55 static const int TGT_O_NOCTTY = 00000400; //!< O_NOCTTY 56 static const int TGT_O_TRUNC = 00001000; //!< O_TRUNC 57 static const int TGT_O_APPEND = 00002000; //!< O_APPEND 58 static const int TGT_O_NONBLOCK = 00004000; //!< O_NONBLOCK 59 static const int TGT_O_SYNC = 00010000; //!< O_SYNC 60 static const int TGT_FASYNC = 00020000; //!< FASYNC 61 static const int TGT_O_DIRECTORY = 00040000; //!< O_DIRECTORY 62 static const int TGT_O_NOFOLLOW = 00100000; //!< O_NOFOLLOW 63 static const int TGT_O_DIRECT = 00200000; //!< O_DIRECT 64 static const int TGT_O_LARGEFILE = 00400000; //!< O_LARGEFILE 65 static const int TGT_O_NOATIME = 01000000; //!< O_NOATIME 66 //@} 67 68 /// For mmap(). 69 static const unsigned TGT_MAP_ANONYMOUS = 0x20; 70 71 //@{ 72 /// For getrusage(). 73 static const int TGT_RUSAGE_SELF = 0; 74 static const int TGT_RUSAGE_CHILDREN = -1; 75 static const int TGT_RUSAGE_BOTH = -2; 76 //@} 77 78 //@{ 79 /// ioctl() command codes. 80 static const unsigned TIOCGETP_ = 0x5401; 81 static const unsigned TIOCSETP_ = 0x80067409; 82 static const unsigned TIOCSETN_ = 0x8006740a; 83 static const unsigned TIOCSETC_ = 0x80067411; 84 static const unsigned TIOCGETC_ = 0x40067412; 85 static const unsigned FIONREAD_ = 0x4004667f; 86 static const unsigned TIOCISATTY_ = 0x2000745e; 87 static const unsigned TIOCGETS_ = 0x402c7413; 88 static const unsigned TIOCGETA_ = 0x40127417; 89 //@} 90 91 /// For table(). 92 static const int TBL_SYSINFO = 12; 93 94 /// Resource enumeration for getrlimit(). 95 enum rlimit_resources { 96 TGT_RLIMIT_CPU = 0, 97 TGT_RLIMIT_FSIZE = 1, 98 TGT_RLIMIT_DATA = 2, 99 TGT_RLIMIT_STACK = 3, 100 TGT_RLIMIT_CORE = 4, 101 TGT_RLIMIT_RSS = 5, 102 TGT_RLIMIT_NPROC = 6, 103 TGT_RLIMIT_NOFILE = 7, 104 TGT_RLIMIT_MEMLOCK = 8, 105 TGT_RLIMIT_AS = 9, 106 TGT_RLIMIT_LOCKS = 10 107 }; 108 109 typedef struct { 110 uint32_t st_dev; 111 uint32_t st_ino; 112 uint16_t st_mode; 113 uint16_t st_nlink; 114 uint16_t st_uid; 115 uint16_t st_gid; 116 uint32_t st_rdev; 117 uint32_t st_size; 118 uint32_t st_blksize; 119 uint32_t st_blocks; 120 uint32_t st_atimeX; 121 uint32_t st_atime_nsec; 122 uint32_t st_mtimeX; 123 uint32_t st_mtime_nsec; 124 uint32_t st_ctimeX; 125 uint32_t st_ctime_nsec; 126 } tgt_stat; 127 128 typedef struct { 129 uint64_t st_dev; 130 uint8_t __pad0[4]; 131 uint32_t __st_ino; 132 uint32_t st_mode; 133 uint32_t st_nlink; 134 uint32_t st_uid; 135 uint32_t st_gid; 136 uint64_t st_rdev; 137 uint8_t __pad3[4]; 138 int64_t __attribute__ ((aligned (8))) st_size; 139 uint32_t st_blksize; 140 uint64_t __attribute__ ((aligned (8))) st_blocks; 141 uint32_t st_atimeX; 142 uint32_t st_atime_nsec; 143 uint32_t st_mtimeX; 144 uint32_t st_mtime_nsec; 145 uint32_t st_ctimeX; 146 uint32_t st_ctime_nsec; 147 uint64_t st_ino; 148 } tgt_stat64; 149 150 151}; 152 153#endif 154