gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
freebsd.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
3  * All rights reserved.
4  *
5  * This software was developed by the University of Cambridge Computer
6  * Laboratory as part of the CTSRD Project, with support from the UK Higher
7  * Education Innovation Fund (HEIF).
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are
11  * met: redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer;
13  * redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution;
16  * neither the name of the copyright holders nor the names of its
17  * contributors may be used to endorse or promote products derived from
18  * this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef __ARCH_ARM_FREEBSD_FREEBSD_HH__
34 #define __ARCH_ARM_FREEBSD_FREEBSD_HH__
35 
36 #include "kern/freebsd/freebsd.hh"
37 
38 class ArmFreebsd32 : public FreeBSD
39 {
40  public:
41 
45 
47  static const int NUM_OPEN_FLAGS;
48 
50  typedef uint32_t size_t;
52  typedef uint32_t off_t;
53  typedef int32_t time_t;
54  typedef int32_t clock_t;
56 
58  static const int TGT_O_RDONLY = 0x00000000;
60  static const int TGT_O_WRONLY = 0x00000001;
61  static const int TGT_O_RDWR = 0x00000002;
62  static const int TGT_O_CREAT = 0x00000200;
63  static const int TGT_O_EXCL = 0x00000800;
64  static const int TGT_O_NOCTTY = 0x00008000;
65  static const int TGT_O_TRUNC = 0x00000400;
66  static const int TGT_O_APPEND = 0x00000008;
67  static const int TGT_O_NONBLOCK = 0x00000004;
68  static const int TGT_O_SYNC = 0x00000080;
69  static const int TGT_FASYNC = 0x00000040;
70  static const int TGT_O_DIRECT = 0x00010000;
71  static const int TGT_O_DIRECTORY = 0x00020000;
72  static const int TGT_O_NOFOLLOW = 0x00000100;
73  static const int TGT_O_CLOEXEC = 0x00100000;
74 
75 
77  static const unsigned TGT_MAP_SHARED = 0x0001;
78  static const unsigned TGT_MAP_PRIVATE = 0x0002;
79  static const unsigned TGT_MAP_ANONYMOUS = 0x1000;
80  static const unsigned TGT_MAP_FIXED = 0x0010;
81 
83  struct rlimit {
84  uint32_t rlim_cur;
85  uint32_t rlim_max;
86  };
87 
89  struct timeval {
90  int32_t tv_sec;
91  int32_t tv_usec;
92  };
93 
94  // For writev/readv
95  struct tgt_iovec {
96  uint32_t iov_base; // void *
97  uint32_t iov_len;
98  };
99 
100  /*
101  * sizeof st 120
102  * sizeof st_dev 4
103  * sizeof st_ino 4
104  * sizeof st_mode 2
105  * sizeof st_nlink 2
106  * sizeof st_uid 4
107  * sizeof st_gid 4
108  * sizeof st_rdev 4
109  * sizeof st_atim 16
110  * sizeof st_size 8
111  * sizeof st_blocks 8
112  * sizeof st_blksize 4
113  * sizeof st_flags 4
114  * sizeof st_gen 4
115  * sizeof st_lspare 4
116  */
117 
118  typedef struct {
119  uint32_t st_dev;
120  uint32_t st_ino;
121  uint16_t st_mode;
122  uint16_t st_nlink;
123  uint32_t st_uid;
124  uint32_t st_gid;
125  uint32_t st_rdev;
126  uint64_t st_atimeX;
127  uint64_t st_atime_nsec;
128  uint64_t st_mtimeX;
129  uint64_t st_mtime_nsec;
130  uint64_t st_ctimeX;
131  uint64_t st_ctime_nsec;
132  uint64_t st_size;
133  uint64_t st_blocks;
134  uint32_t st_blksize;
135  uint32_t st_flags;
136  uint32_t st_gen;
137  uint32_t st_lspare;
138  uint64_t st_birthtimX;
139  uint64_t st_birthtim;
140  } tgt_stat;
141 
142  typedef struct {
143  uint32_t st_dev;
144  uint32_t st_ino;
145  uint16_t st_mode;
146  uint16_t st_nlink;
147  uint32_t st_uid;
148  uint32_t st_gid;
149  uint32_t st_rdev;
150  uint64_t st_atimeX;
151  uint64_t st_atime_nsec;
152  uint64_t st_mtimeX;
153  uint64_t st_mtime_nsec;
154  uint64_t st_ctimeX;
155  uint64_t st_ctime_nsec;
156  uint64_t st_size;
157  uint64_t st_blocks;
158  uint32_t st_blksize;
159  uint32_t st_flags;
160  uint32_t st_gen;
161  uint32_t st_lspare;
162  uint64_t st_birthtimX;
163  uint64_t st_birthtim;
164  } tgt_stat64;
165 
167  struct rusage {
168  struct timeval ru_utime;
169  struct timeval ru_stime;
170  int32_t ru_maxrss;
171  int32_t ru_ixrss;
172  int32_t ru_idrss;
173  int32_t ru_isrss;
174  int32_t ru_minflt;
175  int32_t ru_majflt;
176  int32_t ru_nswap;
177  int32_t ru_inblock;
178  int32_t ru_oublock;
179  int32_t ru_msgsnd;
180  int32_t ru_msgrcv;
181  int32_t ru_nsignals;
182  int32_t ru_nvcsw;
183  int32_t ru_nivcsw;
184  };
185 
187  struct tms {
188  int32_t tms_utime;
189  int32_t tms_stime;
190  int32_t tms_cutime;
191  int32_t tms_cstime;
192  };
193 };
194 
195 class ArmFreebsd64 : public FreeBSD
196 {
197  public:
198 
202 
204  static const int NUM_OPEN_FLAGS;
205 
207  typedef uint64_t size_t;
209  typedef uint64_t off_t;
210  typedef int64_t time_t;
211  typedef int64_t clock_t;
213 
215  static const int TGT_O_RDONLY = 0x00000000;
217  static const int TGT_O_WRONLY = 0x00000001;
218  static const int TGT_O_RDWR = 0x00000002;
219  static const int TGT_O_CREAT = 0x00000200;
220  static const int TGT_O_EXCL = 0x00000800;
221  static const int TGT_O_NOCTTY = 0x00008000;
222  static const int TGT_O_TRUNC = 0x00000400;
223  static const int TGT_O_APPEND = 0x00000008;
224  static const int TGT_O_NONBLOCK = 0x00000004;
225  static const int TGT_O_SYNC = 0x00000080;
226  static const int TGT_FASYNC = 0x00000040;
227  static const int TGT_O_DIRECT = 0x00010000;
228  static const int TGT_O_DIRECTORY = 0x00020000;
229  static const int TGT_O_NOFOLLOW = 0x00000100;
230  static const int TGT_O_CLOEXEC = 0x00100000;
231 
232 
234  static const unsigned TGT_MAP_SHARED = 0x0001;
235  static const unsigned TGT_MAP_PRIVATE = 0x0002;
236  static const unsigned TGT_MAP_ANONYMOUS = 0x1000;
237  static const unsigned TGT_MAP_FIXED = 0x0010;
238 
240  static const int TGT_RUSAGE_SELF = 0;
242  static const int TGT_RUSAGE_CHILDREN = -1;
243  static const int TGT_RUSAGE_THREAD = 1;
245 
263  };
264 
266  struct rlimit {
267  uint64_t rlim_cur;
268  uint64_t rlim_max;
269  };
270 
272  struct timeval {
273  int64_t tv_sec;
274  int64_t tv_usec;
275  };
276 
277  // For writev/readv
278  struct tgt_iovec {
279  uint64_t iov_base; // void *
280  uint64_t iov_len;
281  };
282 
283  typedef struct {
284  uint32_t st_dev;
285  uint32_t st_ino;
286  uint16_t st_mode;
287  uint16_t st_nlink;
288  uint32_t st_uid;
289  uint32_t st_gid;
290  uint32_t st_rdev;
291  uint64_t st_atimeX;
292  uint64_t st_atime_nsec;
293  uint64_t st_mtimeX;
294  uint64_t st_mtime_nsec;
295  uint64_t st_ctimeX;
296  uint64_t st_ctime_nsec;
297  uint64_t st_size;
298  uint64_t st_blocks;
299  uint32_t st_blksize;
300  uint32_t st_flags;
301  uint32_t st_gen;
302  uint32_t st_lspare;
303  uint64_t st_birthtimX;
304  uint64_t st_birthtim;
305  } tgt_stat;
306 
307  typedef struct {
308  uint32_t st_dev;
309  uint32_t st_ino;
310  uint16_t st_mode;
311  uint16_t st_nlink;
312  uint32_t st_uid;
313  uint32_t st_gid;
314  uint32_t st_rdev;
315  uint64_t st_atimeX;
316  uint64_t st_atime_nsec;
317  uint64_t st_mtimeX;
318  uint64_t st_mtime_nsec;
319  uint64_t st_ctimeX;
320  uint64_t st_ctime_nsec;
321  uint64_t st_size;
322  uint64_t st_blocks;
323  uint32_t st_blksize;
324  uint32_t st_flags;
325  uint32_t st_gen;
326  uint32_t st_lspare;
327  uint64_t st_birthtimX;
328  uint64_t st_birthtim;
329  } tgt_stat64;
330 
332  struct rusage {
333  struct timeval ru_utime;
334  struct timeval ru_stime;
335  int64_t ru_maxrss;
336  int64_t ru_ixrss;
337  int64_t ru_idrss;
338  int64_t ru_isrss;
339  int64_t ru_minflt;
340  int64_t ru_majflt;
341  int64_t ru_nswap;
342  int64_t ru_inblock;
343  int64_t ru_oublock;
344  int64_t ru_msgsnd;
345  int64_t ru_msgrcv;
346  int64_t ru_nsignals;
347  int64_t ru_nvcsw;
348  int64_t ru_nivcsw;
349  };
350 
352  struct tms {
353  int64_t tms_utime;
354  int64_t tms_stime;
355  int64_t tms_cutime;
356  int64_t tms_cstime;
357  };
358 };
359 
360 #endif
uint64_t st_atime_nsec
Definition: freebsd.hh:292
static const unsigned TGT_MAP_FIXED
Definition: freebsd.hh:237
For gettimeofday().
Definition: freebsd.hh:272
static const int TGT_FASYNC
FASYNC.
Definition: freebsd.hh:69
static const int TGT_O_RDWR
O_RDWR.
Definition: freebsd.hh:61
static const int TGT_O_DIRECT
O_DIRECT.
Definition: freebsd.hh:70
static const int TGT_O_NONBLOCK
O_NONBLOCK.
Definition: freebsd.hh:224
static const int TGT_O_CREAT
O_CREAT.
Definition: freebsd.hh:219
int64_t ru_oublock
block output operations
Definition: freebsd.hh:343
int32_t ru_nvcsw
voluntary context switches
Definition: freebsd.hh:182
uint32_t rlim_cur
soft limit
Definition: freebsd.hh:84
int32_t tv_sec
seconds
Definition: freebsd.hh:90
static const int TGT_O_TRUNC
O_TRUNC.
Definition: freebsd.hh:65
struct timeval ru_stime
system time used
Definition: freebsd.hh:334
static const unsigned TGT_MAP_PRIVATE
Definition: freebsd.hh:235
uint64_t rlim_max
hard limit
Definition: freebsd.hh:268
static SyscallFlagTransTable openFlagTable[]
This table maps the target open() flags to the corresponding host open() flags.
Definition: freebsd.hh:44
uint64_t st_atime_nsec
Definition: freebsd.hh:127
rlimit_resources
Resource enumeration for getrlimit().
Definition: freebsd.hh:247
uint32_t off_t
Definition: freebsd.hh:52
For times().
Definition: freebsd.hh:187
int64_t ru_msgrcv
messages received
Definition: freebsd.hh:345
static const int TGT_O_CLOEXEC
O_CLOEXEC.
Definition: freebsd.hh:230
For gettimeofday().
Definition: freebsd.hh:89
static const int TGT_O_CREAT
O_CREAT.
Definition: freebsd.hh:62
static const int TGT_O_RDONLY
open(2) flag values.
Definition: freebsd.hh:59
int32_t ru_nivcsw
involuntary "
Definition: freebsd.hh:183
static const unsigned TGT_MAP_ANONYMOUS
Definition: freebsd.hh:79
int32_t ru_msgsnd
messages sent
Definition: freebsd.hh:179
int32_t tms_stime
system time
Definition: freebsd.hh:189
int64_t ru_majflt
page faults
Definition: freebsd.hh:340
int32_t ru_minflt
page reclaims - total vmfaults
Definition: freebsd.hh:174
static SyscallFlagTransTable openFlagTable[]
This table maps the target open() flags to the corresponding host open() flags.
Definition: freebsd.hh:201
static const int TGT_RUSAGE_SELF
For getrusage().
Definition: freebsd.hh:241
int64_t ru_nvcsw
voluntary context switches
Definition: freebsd.hh:347
For getrusage().
Definition: freebsd.hh:332
static const int NUM_OPEN_FLAGS
Number of entries in openFlagTable[].
Definition: freebsd.hh:204
static const int TGT_O_CLOEXEC
O_CLOEXEC.
Definition: freebsd.hh:73
static const int NUM_OPEN_FLAGS
Number of entries in openFlagTable[].
Definition: freebsd.hh:47
static const int TGT_O_SYNC
O_SYNC.
Definition: freebsd.hh:68
static const unsigned TGT_MAP_SHARED
For mmap().
Definition: freebsd.hh:234
static const int TGT_O_DIRECT
O_DIRECT.
Definition: freebsd.hh:227
uint64_t st_mtime_nsec
Definition: freebsd.hh:129
int32_t ru_inblock
block input operations
Definition: freebsd.hh:177
static const int TGT_O_NOFOLLOW
O_NOFOLLOW.
Definition: freebsd.hh:229
static const int TGT_O_DIRECTORY
O_DIRECTORY.
Definition: freebsd.hh:71
For getrusage().
Definition: freebsd.hh:167
int64_t ru_idrss
integral unshared data "
Definition: freebsd.hh:337
int32_t tms_utime
user time
Definition: freebsd.hh:188
static const int TGT_O_APPEND
O_APPEND.
Definition: freebsd.hh:66
int32_t ru_msgrcv
messages received
Definition: freebsd.hh:180
static const int TGT_O_NOCTTY
O_NOCTTY.
Definition: freebsd.hh:64
static const int TGT_O_TRUNC
O_TRUNC.
Definition: freebsd.hh:222
static const int TGT_O_DIRECTORY
O_DIRECTORY.
Definition: freebsd.hh:228
int32_t tv_usec
microseconds
Definition: freebsd.hh:91
int64_t ru_minflt
page reclaims - total vmfaults
Definition: freebsd.hh:339
static const unsigned TGT_MAP_FIXED
Definition: freebsd.hh:80
int32_t tms_cstime
system time of children
Definition: freebsd.hh:191
uint64_t st_ctime_nsec
Definition: freebsd.hh:296
int64_t ru_inblock
block input operations
Definition: freebsd.hh:342
uint64_t st_mtime_nsec
Definition: freebsd.hh:294
int32_t ru_idrss
integral unshared data "
Definition: freebsd.hh:172
uint32_t size_t
Basic ARM FreeBSD types.
Definition: freebsd.hh:51
int64_t tms_cutime
user time of children
Definition: freebsd.hh:355
void tgt_stat
Stat buffer.
int32_t ru_nswap
swaps
Definition: freebsd.hh:176
static const int TGT_O_NONBLOCK
O_NONBLOCK.
Definition: freebsd.hh:67
int32_t tms_cutime
user time of children
Definition: freebsd.hh:190
int64_t ru_nswap
swaps
Definition: freebsd.hh:341
Limit struct for getrlimit/setrlimit.
Definition: freebsd.hh:266
For times().
Definition: freebsd.hh:352
int32_t ru_isrss
integral unshared stack "
Definition: freebsd.hh:173
int64_t tms_stime
system time
Definition: freebsd.hh:354
int32_t ru_majflt
page faults
Definition: freebsd.hh:175
int64_t ru_nivcsw
involuntary "
Definition: freebsd.hh:348
int64_t tms_utime
user time
Definition: freebsd.hh:353
static const int TGT_O_WRONLY
O_WRONLY.
Definition: freebsd.hh:60
This struct is used to build target-OS-dependent tables that map the target's flags to the host's fla...
static const int TGT_O_RDONLY
open(2) flag values.
Definition: freebsd.hh:216
struct timeval ru_utime
user time used
Definition: freebsd.hh:333
uint64_t st_ctime_nsec
Definition: freebsd.hh:131
struct timeval ru_stime
system time used
Definition: freebsd.hh:169
int64_t ru_msgsnd
messages sent
Definition: freebsd.hh:344
int64_t ru_isrss
integral unshared stack "
Definition: freebsd.hh:338
struct timeval ru_utime
user time used
Definition: freebsd.hh:168
static const int TGT_O_RDWR
O_RDWR.
Definition: freebsd.hh:218
uint64_t off_t
Definition: freebsd.hh:209
static const unsigned TGT_MAP_PRIVATE
Definition: freebsd.hh:78
int32_t ru_nsignals
signals received
Definition: freebsd.hh:181
uint32_t rlim_max
hard limit
Definition: freebsd.hh:85
static const int TGT_O_APPEND
O_APPEND.
Definition: freebsd.hh:223
uint64_t size_t
Basic ARM FreeBSD types.
Definition: freebsd.hh:208
static const int TGT_FASYNC
FASYNC.
Definition: freebsd.hh:226
static const int TGT_O_NOCTTY
O_NOCTTY.
Definition: freebsd.hh:221
static const int TGT_O_EXCL
O_EXCL.
Definition: freebsd.hh:220
static const unsigned TGT_MAP_ANONYMOUS
Definition: freebsd.hh:236
int64_t tms_cstime
system time of children
Definition: freebsd.hh:356
Limit struct for getrlimit/setrlimit.
Definition: freebsd.hh:83
uint64_t rlim_cur
soft limit
Definition: freebsd.hh:267
int64_t clock_t
Definition: freebsd.hh:211
int32_t ru_oublock
block output operations
Definition: freebsd.hh:178
int64_t ru_nsignals
signals received
Definition: freebsd.hh:346
int64_t tv_usec
microseconds
Definition: freebsd.hh:274
static const int TGT_O_SYNC
O_SYNC.
Definition: freebsd.hh:225
static const int TGT_O_WRONLY
O_WRONLY.
Definition: freebsd.hh:217
static const unsigned TGT_MAP_SHARED
For mmap().
Definition: freebsd.hh:77
int64_t ru_ixrss
integral shared memory size
Definition: freebsd.hh:336
int64_t time_t
Definition: freebsd.hh:210
int32_t ru_maxrss
max rss
Definition: freebsd.hh:170
int32_t clock_t
Definition: freebsd.hh:54
static const int TGT_O_NOFOLLOW
O_NOFOLLOW.
Definition: freebsd.hh:72
int32_t ru_ixrss
integral shared memory size
Definition: freebsd.hh:171
int64_t tv_sec
seconds
Definition: freebsd.hh:273
int64_t ru_maxrss
max rss
Definition: freebsd.hh:335
static const int TGT_RUSAGE_CHILDREN
Definition: freebsd.hh:242
This class encapsulates the types, structures, constants, functions, and syscall-number mappings spec...
Definition: freebsd.hh:49
static const int TGT_O_EXCL
O_EXCL.
Definition: freebsd.hh:63
int32_t time_t
Definition: freebsd.hh:53
static const int TGT_RUSAGE_THREAD
Definition: freebsd.hh:243

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