linux.hh revision 6395:05f1d2cd7e9e
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * Copyright (c) 2007-2008 The Florida State University 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer; 10 * redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution; 13 * neither the name of the copyright holders nor the names of its 14 * contributors may be used to endorse or promote products derived from 15 * this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * 29 * Authors: Stephen Hines 30 */ 31 32#ifndef __ARCH_ARM_LINUX_LINUX_HH__ 33#define __ARCH_ARM_LINUX_LINUX_HH__ 34 35#include "kern/linux/linux.hh" 36 37class ArmLinux : public Linux 38{ 39 public: 40 41 /// This table maps the target open() flags to the corresponding 42 /// host open() flags. 43 static OpenFlagTransTable openFlagTable[]; 44 45 /// Number of entries in openFlagTable[]. 46 static const int NUM_OPEN_FLAGS; 47 48 //@{ 49 /// open(2) flag values. 50 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 = 0x800; 70 71 //@{ 72 /// For getsysinfo(). 73 static const unsigned GSI_PLATFORM_NAME = 103; //!< platform name as string 74 static const unsigned GSI_CPU_INFO = 59; //!< CPU information 75 static const unsigned GSI_PROC_TYPE = 60; //!< get proc_type 76 static const unsigned GSI_MAX_CPU = 30; //!< max # cpu's on this machine 77 static const unsigned GSI_CPUS_IN_BOX = 55; //!< number of CPUs in system 78 static const unsigned GSI_PHYSMEM = 19; //!< Physical memory in KB 79 static const unsigned GSI_CLK_TCK = 42; //!< clock freq in Hz 80 //@} 81 82 //@{ 83 /// For getrusage(). 84 static const int TGT_RUSAGE_SELF = 0; 85 static const int TGT_RUSAGE_CHILDREN = -1; 86 static const int TGT_RUSAGE_BOTH = -2; 87 //@} 88 89 //@{ 90 /// For setsysinfo(). 91 static const unsigned SSI_IEEE_FP_CONTROL = 14; //!< ieee_set_fp_control() 92 //@} 93 94 //@{ 95 /// ioctl() command codes. 96 static const unsigned TIOCGETP_ = 0x40067408; 97 static const unsigned TIOCSETP_ = 0x80067409; 98 static const unsigned TIOCSETN_ = 0x8006740a; 99 static const unsigned TIOCSETC_ = 0x80067411; 100 static const unsigned TIOCGETC_ = 0x40067412; 101 static const unsigned FIONREAD_ = 0x4004667f; 102 static const unsigned TIOCISATTY_ = 0x2000745e; 103 static const unsigned TIOCGETS_ = 0x402c7413; 104 static const unsigned TIOCGETA_ = 0x40127417; 105 //@} 106 107 /// For table(). 108 static const int TBL_SYSINFO = 12; 109 110 /// Resource enumeration for getrlimit(). 111 enum rlimit_resources { 112 TGT_RLIMIT_CPU = 0, 113 TGT_RLIMIT_FSIZE = 1, 114 TGT_RLIMIT_DATA = 2, 115 TGT_RLIMIT_STACK = 3, 116 TGT_RLIMIT_CORE = 4, 117 TGT_RLIMIT_NOFILE = 5, 118 TGT_RLIMIT_AS = 6, 119 TGT_RLIMIT_RSS = 7, 120 TGT_RLIMIT_VMEM = 7, 121 TGT_RLIMIT_NPROC = 8, 122 TGT_RLIMIT_MEMLOCK = 9, 123 TGT_RLIMIT_LOCKS = 10 124 }; 125 126 typedef struct { 127 uint32_t st_dev; 128 uint32_t st_ino; 129 uint16_t st_mode; 130 uint16_t st_nlink; 131 uint16_t st_uid; 132 uint16_t st_gid; 133 uint32_t st_rdev; 134 uint32_t st_size; 135 uint32_t st_blksize; 136 uint32_t st_blocks; 137 uint32_t st_atimeX; 138 uint32_t st_atime_nsec; 139 uint32_t st_mtimeX; 140 uint32_t st_mtime_nsec; 141 uint32_t st_ctimeX; 142 uint32_t st_ctime_nsec; 143 } tgt_stat; 144 145 typedef struct { 146 uint64_t st_dev; 147 uint8_t __pad0[4]; 148 uint32_t __st_ino; 149 uint32_t st_mode; 150 uint32_t st_nlink; 151 uint32_t st_uid; 152 uint32_t st_gid; 153 uint64_t st_rdev; 154 uint8_t __pad3[4]; 155 int64_t __attribute__ ((aligned (8))) st_size; 156 uint32_t st_blksize; 157 uint64_t __attribute__ ((aligned (8))) st_blocks; 158 uint32_t st_atimeX; 159 uint32_t st_atime_nsec; 160 uint32_t st_mtimeX; 161 uint32_t st_mtime_nsec; 162 uint32_t st_ctimeX; 163 uint32_t st_ctime_nsec; 164 uint64_t st_ino; 165 } tgt_stat64; 166 167 168}; 169 170#endif 171