gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
linux.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2003-2005 The Regents of The University of Michigan
3  * Copyright (c) 2009 The University of Edinburgh
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: Timothy M. Jones
30  */
31 
32 #ifndef __ARCH_POWER_LINUX_LINUX_HH__
33 #define __ARCH_POWER_LINUX_LINUX_HH__
34 
35 #include "kern/linux/linux.hh"
36 
37 /*
38  * This works for a 2.6.15 kernel.
39  */
40 
41 class PowerLinux : public Linux
42 {
43  public:
44 
45  typedef int32_t time_t;
46 
47  typedef struct {
48  uint64_t st_dev;
49  uint32_t __pad1;
50  uint32_t st_ino;
51  uint32_t st_mode;
52  uint32_t st_nlink;
53  uint32_t st_uid;
54  uint32_t st_gid;
55  uint64_t st_rdev;
56  uint32_t __pad2;
57  uint32_t st_size;
58  uint32_t st_blksize;
59  uint32_t st_blocks;
60  uint32_t st_atimeX;
61  uint32_t st_atime_nsec;
62  uint32_t st_mtimeX;
63  uint32_t st_mtime_nsec;
64  uint32_t st_ctimeX;
65  uint32_t st_ctime_nsec;
66  uint32_t __unused4;
67  uint32_t __unused5;
68  } tgt_stat;
69 
70  typedef struct {
71  uint64_t st_dev;
72  uint64_t st_ino;
73  uint32_t st_mode;
74  uint32_t st_nlink;
75  uint32_t st_uid;
76  uint32_t st_gid;
77  uint64_t st_rdev;
78  uint64_t __pad2;
79  uint64_t st_size;
80  uint32_t st_blksize;
81  uint32_t __blksize_pad;
82  uint64_t st_blocks;
83  uint32_t st_atimeX;
84  uint32_t st_atime_nsec;
85  uint32_t st_mtimeX;
86  uint32_t st_mtime_nsec;
87  uint32_t st_ctimeX;
88  uint32_t st_ctime_nsec;
89  uint32_t __unused4;
90  uint32_t __unused5;
91  } tgt_stat64;
92 
94  struct tms {
95  int32_t tms_utime;
96  int32_t tms_stime;
97  int32_t tms_cutime;
98  int32_t tms_cstime;
99  };
100 
101  static const int TGT_SIGHUP = 0x000001;
102  static const int TGT_SIGINT = 0x000002;
103  static const int TGT_SIGQUIT = 0x000003;
104  static const int TGT_SIGILL = 0x000004;
105  static const int TGT_SIGTRAP = 0x000005;
106  static const int TGT_SIGABRT = 0x000006;
107  static const int TGT_SIGIOT = 0x000006;
108  static const int TGT_SIGBUS = 0x000007;
109  static const int TGT_SIGFPE = 0x000008;
110  static const int TGT_SIGKILL = 0x000009;
111  static const int TGT_SIGUSR1 = 0x00000a;
112  static const int TGT_SIGSEGV = 0x00000b;
113  static const int TGT_SIGUSR2 = 0x00000c;
114  static const int TGT_SIGPIPE = 0x00000d;
115  static const int TGT_SIGALRM = 0x00000e;
116  static const int TGT_SIGTERM = 0x00000f;
117  static const int TGT_SIGSTKFLT = 0x000010;
118  static const int TGT_SIGCHLD = 0x000011;
119  static const int TGT_SIGCONT = 0x000012;
120  static const int TGT_SIGSTOP = 0x000013;
121  static const int TGT_SIGTSTP = 0x000014;
122  static const int TGT_SIGTTIN = 0x000015;
123  static const int TGT_SIGTTOU = 0x000016;
124  static const int TGT_SIGURG = 0x000017;
125  static const int TGT_SIGXCPU = 0x000018;
126  static const int TGT_SIGXFSZ = 0x000019;
127  static const int TGT_SIGVTALRM = 0x00001a;
128  static const int TGT_SIGPROF = 0x00001b;
129  static const int TGT_SIGWINCH = 0x00001c;
130  static const int TGT_SIGIO = 0x00001d;
131  static const int TGT_SIGPOLL = 0x00001d;
132  static const int TGT_SIGPWR = 0x00001e;
133  static const int TGT_SIGSYS = 0x00001f;
134  static const int TGT_SIGUNUSED = 0x00001f;
135 
139 
141  static const int NUM_OPEN_FLAGS;
142 
144  static const int TGT_O_RDONLY = 000000000;
146  static const int TGT_O_WRONLY = 000000001;
147  static const int TGT_O_RDWR = 000000002;
148  static const int TGT_O_CREAT = 000000100;
149  static const int TGT_O_EXCL = 000000200;
150  static const int TGT_O_NOCTTY = 000000400;
151  static const int TGT_O_TRUNC = 000001000;
152  static const int TGT_O_APPEND = 000002000;
153  static const int TGT_O_NONBLOCK = 000004000;
154  static const int TGT_O_DSYNC = 000010000;
155  static const int TGT_FASYNC = 000020000;
156  static const int TGT_O_DIRECT = 000400000;
157  static const int TGT_O_LARGEFILE = 000200000;
158  static const int TGT_O_DIRECTORY = 000040000;
159  static const int TGT_O_NOFOLLOW = 000100000;
160  static const int TGT_O_NOATIME = 001000000;
161  static const int TGT_O_CLOEXEC = 002000000;
162  static const int TGT_O_SYNC = 004010000;
163  static const int TGT_O_PATH = 010000000;
164 
165 
166  static const unsigned TGT_MAP_SHARED = 0x00001;
167  static const unsigned TGT_MAP_PRIVATE = 0x00002;
168  static const unsigned TGT_MAP_ANON = 0x00020;
169  static const unsigned TGT_MAP_DENYWRITE = 0x00800;
170  static const unsigned TGT_MAP_EXECUTABLE = 0x01000;
171  static const unsigned TGT_MAP_FILE = 0x00000;
172  static const unsigned TGT_MAP_GROWSDOWN = 0x00100;
173  static const unsigned TGT_MAP_HUGETLB = 0x40000;
174  static const unsigned TGT_MAP_LOCKED = 0x00080;
175  static const unsigned TGT_MAP_NONBLOCK = 0x10000;
176  static const unsigned TGT_MAP_NORESERVE = 0x00040;
177  static const unsigned TGT_MAP_POPULATE = 0x08000;
178  static const unsigned TGT_MAP_STACK = 0x20000;
179  static const unsigned TGT_MAP_ANONYMOUS = 0x00020;
180  static const unsigned TGT_MAP_FIXED = 0x00010;
181 
182  static const unsigned NUM_MMAP_FLAGS;
183 
185  static const unsigned TGT_TIOCGETP = 0x40067408;
187  static const unsigned TGT_TIOCSETP = 0x80067409;
188  static const unsigned TGT_TIOCSETN = 0x8006740a;
189  static const unsigned TGT_TIOCSETC = 0x80067411;
190  static const unsigned TGT_TIOCGETC = 0x40067412;
191  static const unsigned TGT_FIONREAD = 0x4004667f;
192  static const unsigned TGT_TCGETS = 0x402c7413;
193  static const unsigned TGT_TCGETA = 0x40127417;
194  static const unsigned TGT_TCSETAW = 0x80147419; // 2.6.15 kernel
196 
197  static bool
198  isTtyReq(unsigned req)
199  {
200  switch (req) {
201  case TGT_TIOCGETP:
202  case TGT_TIOCSETP:
203  case TGT_TIOCSETN:
204  case TGT_TIOCSETC:
205  case TGT_TIOCGETC:
206  case TGT_TCGETS:
207  case TGT_TCGETA:
208  case TGT_TCSETAW:
209  return true;
210  default:
211  return false;
212  }
213  }
214 };
215 
216 #endif // __ARCH_POWER_LINUX_LINUX_HH__
static const int TGT_O_CLOEXEC
O_CLOEXEC.
Definition: linux.hh:161
static const int TGT_SIGTRAP
Definition: linux.hh:105
static const int TGT_SIGPROF
Definition: linux.hh:128
static const unsigned TGT_TIOCGETC
Definition: linux.hh:190
static const int TGT_SIGUSR1
Definition: linux.hh:111
uint32_t __unused5
Definition: linux.hh:90
uint32_t st_blocks
Definition: linux.hh:59
static const unsigned TGT_MAP_NORESERVE
Definition: linux.hh:176
static const int TGT_O_APPEND
O_APPEND.
Definition: linux.hh:152
static const unsigned TGT_TIOCSETN
Definition: linux.hh:188
uint32_t st_ctime_nsec
Definition: linux.hh:88
static const unsigned TGT_MAP_STACK
Definition: linux.hh:178
static const int TGT_SIGTTIN
Definition: linux.hh:122
uint32_t st_mtime_nsec
Definition: linux.hh:86
static const int TGT_SIGSTKFLT
Definition: linux.hh:117
uint32_t st_gid
Definition: linux.hh:54
static const int TGT_SIGIOT
Definition: linux.hh:107
static const unsigned TGT_MAP_ANONYMOUS
Definition: linux.hh:179
static const unsigned NUM_MMAP_FLAGS
Definition: linux.hh:182
int32_t tms_stime
system time
Definition: linux.hh:96
uint32_t __unused4
Definition: linux.hh:66
static const int TGT_SIGTTOU
Definition: linux.hh:123
For times().
Definition: linux.hh:94
uint32_t st_blksize
Definition: linux.hh:58
uint32_t st_ctimeX
Definition: linux.hh:64
uint32_t st_atimeX
Definition: linux.hh:83
uint32_t __pad2
Definition: linux.hh:56
static const int TGT_SIGSTOP
Definition: linux.hh:120
uint32_t st_atime_nsec
Definition: linux.hh:61
static const int TGT_SIGUSR2
Definition: linux.hh:113
static const int TGT_SIGQUIT
Definition: linux.hh:103
static const int TGT_O_NOCTTY
O_NOCTTY.
Definition: linux.hh:150
uint32_t st_mtimeX
Definition: linux.hh:62
uint64_t st_dev
Definition: linux.hh:48
static const unsigned TGT_MAP_HUGETLB
Definition: linux.hh:173
int32_t tms_cstime
system time of children
Definition: linux.hh:98
static const int TGT_SIGVTALRM
Definition: linux.hh:127
static const int TGT_SIGINT
Definition: linux.hh:102
uint32_t st_mtime_nsec
Definition: linux.hh:63
uint64_t st_rdev
Definition: linux.hh:77
static const int TGT_SIGBUS
Definition: linux.hh:108
static const unsigned TGT_MAP_NONBLOCK
Definition: linux.hh:175
uint32_t __unused5
Definition: linux.hh:67
static const unsigned TGT_MAP_GROWSDOWN
Definition: linux.hh:172
static const int TGT_SIGALRM
Definition: linux.hh:115
static const int TGT_O_RDONLY
open(2) flag values.
Definition: linux.hh:145
static bool isTtyReq(unsigned req)
Definition: linux.hh:198
static const int TGT_O_DSYNC
O_DSYNC.
Definition: linux.hh:154
static const unsigned TGT_MAP_DENYWRITE
Definition: linux.hh:169
uint32_t st_mode
Definition: linux.hh:73
This class encapsulates the types, structures, constants, functions, and syscall-number mappings spec...
Definition: linux.hh:48
uint32_t __unused4
Definition: linux.hh:89
static const unsigned TGT_MAP_POPULATE
Definition: linux.hh:177
uint64_t st_rdev
Definition: linux.hh:55
int32_t time_t
Definition: linux.hh:45
static const int TGT_SIGABRT
Definition: linux.hh:106
static const unsigned TGT_MAP_LOCKED
Definition: linux.hh:174
static const unsigned TGT_MAP_FILE
Definition: linux.hh:171
void tgt_stat
Stat buffer.
uint32_t st_mtimeX
Definition: linux.hh:85
static const int TGT_FASYNC
FASYNC.
Definition: linux.hh:155
static const int TGT_SIGCHLD
Definition: linux.hh:118
static const int TGT_SIGKILL
Definition: linux.hh:110
uint32_t st_size
Definition: linux.hh:57
static const int TGT_O_LARGEFILE
O_LARGEFILE.
Definition: linux.hh:157
uint32_t st_atimeX
Definition: linux.hh:60
uint32_t __pad1
Definition: linux.hh:49
int32_t tms_cutime
user time of children
Definition: linux.hh:97
static const int TGT_O_CREAT
O_CREAT.
Definition: linux.hh:148
uint32_t st_blksize
Definition: linux.hh:80
static const int TGT_O_RDWR
O_RDWR.
Definition: linux.hh:147
static const unsigned TGT_TIOCGETP
ioctl() command codes.
Definition: linux.hh:186
uint64_t st_size
Definition: linux.hh:79
static const int TGT_O_WRONLY
O_WRONLY.
Definition: linux.hh:146
static const int TGT_SIGTERM
Definition: linux.hh:116
uint32_t st_uid
Definition: linux.hh:53
static SyscallFlagTransTable openFlagTable[]
This table maps the target open() flags to the corresponding host open() flags.
Definition: linux.hh:138
static const int TGT_O_SYNC
O_SYNC.
Definition: linux.hh:162
static const int TGT_SIGXCPU
Definition: linux.hh:125
static const int TGT_SIGPWR
Definition: linux.hh:132
This struct is used to build target-OS-dependent tables that map the target's flags to the host's fla...
uint32_t st_ino
Definition: linux.hh:50
static const int TGT_SIGUNUSED
Definition: linux.hh:134
static const unsigned TGT_TCGETA
Definition: linux.hh:193
static const int TGT_SIGPOLL
Definition: linux.hh:131
static const int TGT_O_DIRECTORY
O_DIRECTORY.
Definition: linux.hh:158
static const int TGT_O_NOFOLLOW
O_NOFOLLOW.
Definition: linux.hh:159
uint32_t st_nlink
Definition: linux.hh:52
static const int TGT_SIGIO
Definition: linux.hh:130
int32_t tms_utime
user time
Definition: linux.hh:95
static const unsigned TGT_TIOCSETC
Definition: linux.hh:189
static const int TGT_SIGXFSZ
Definition: linux.hh:126
static const int TGT_SIGURG
Definition: linux.hh:124
static const int TGT_O_NOATIME
O_NOATIME.
Definition: linux.hh:160
static const int TGT_SIGCONT
Definition: linux.hh:119
uint32_t st_mode
Definition: linux.hh:51
static const unsigned TGT_TCGETS
Definition: linux.hh:192
static const int TGT_O_PATH
O_PATH.
Definition: linux.hh:163
static const int TGT_O_NONBLOCK
O_NONBLOCK.
Definition: linux.hh:153
uint64_t st_blocks
Definition: linux.hh:82
static const unsigned TGT_TCSETAW
Definition: linux.hh:194
static const int TGT_SIGSEGV
Definition: linux.hh:112
static const unsigned TGT_MAP_SHARED
Definition: linux.hh:166
uint32_t st_nlink
Definition: linux.hh:74
static const unsigned TGT_MAP_FIXED
Definition: linux.hh:180
static const int TGT_SIGPIPE
Definition: linux.hh:114
static const int NUM_OPEN_FLAGS
Number of entries in openFlagTable[].
Definition: linux.hh:141
static const int TGT_O_TRUNC
O_TRUNC.
Definition: linux.hh:151
uint32_t st_ctimeX
Definition: linux.hh:87
static const unsigned TGT_FIONREAD
Definition: linux.hh:191
static const int TGT_SIGILL
Definition: linux.hh:104
static const int TGT_SIGTSTP
Definition: linux.hh:121
uint32_t st_atime_nsec
Definition: linux.hh:84
static const unsigned TGT_TIOCSETP
Definition: linux.hh:187
static const unsigned TGT_MAP_ANON
Definition: linux.hh:168
static const unsigned TGT_MAP_EXECUTABLE
Definition: linux.hh:170
uint32_t __blksize_pad
Definition: linux.hh:81
static const int TGT_O_EXCL
O_EXCL.
Definition: linux.hh:149
static const unsigned TGT_MAP_PRIVATE
Definition: linux.hh:167
uint32_t st_ctime_nsec
Definition: linux.hh:65
static const int TGT_SIGHUP
Definition: linux.hh:101
static const int TGT_SIGWINCH
Definition: linux.hh:129
static const int TGT_O_DIRECT
O_DIRECT.
Definition: linux.hh:156
static const int TGT_SIGSYS
Definition: linux.hh:133
static const int TGT_SIGFPE
Definition: linux.hh:109

Generated on Fri Jun 9 2017 13:03:35 for gem5 by doxygen 1.8.6