gem5  v19.0.0.0
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 ArmFreebsd : public FreeBSD
39 {
40  public:
42 };
43 
44 class ArmFreebsd32 : public ArmFreebsd
45 {
46  public:
49  static SyscallFlagTransTable openFlagTable[];
50 
52  static const int NUM_OPEN_FLAGS;
53 
55  typedef uint32_t size_t;
57  typedef uint32_t off_t;
58  typedef int32_t time_t;
59  typedef int32_t clock_t;
61 
63  static const int TGT_O_RDONLY = 0x00000000;
65  static const int TGT_O_WRONLY = 0x00000001;
66  static const int TGT_O_RDWR = 0x00000002;
67  static const int TGT_O_CREAT = 0x00000200;
68  static const int TGT_O_EXCL = 0x00000800;
69  static const int TGT_O_NOCTTY = 0x00008000;
70  static const int TGT_O_TRUNC = 0x00000400;
71  static const int TGT_O_APPEND = 0x00000008;
72  static const int TGT_O_NONBLOCK = 0x00000004;
73  static const int TGT_O_SYNC = 0x00000080;
74  static const int TGT_FASYNC = 0x00000040;
75  static const int TGT_O_DIRECT = 0x00010000;
76  static const int TGT_O_DIRECTORY = 0x00020000;
77  static const int TGT_O_NOFOLLOW = 0x00000100;
78  static const int TGT_O_CLOEXEC = 0x00100000;
79 
80 
82  static const unsigned TGT_MAP_SHARED = 0x0001;
83  static const unsigned TGT_MAP_PRIVATE = 0x0002;
84  static const unsigned TGT_MAP_ANONYMOUS = 0x1000;
85  static const unsigned TGT_MAP_FIXED = 0x0010;
86 
88  struct rlimit {
89  uint32_t rlim_cur;
90  uint32_t rlim_max;
91  };
92 
94  struct timeval {
95  int32_t tv_sec;
96  int32_t tv_usec;
97  };
98 
99  // For writev/readv
100  struct tgt_iovec {
101  uint32_t iov_base; // void *
102  uint32_t iov_len;
103  };
104 
105  /*
106  * sizeof st 120
107  * sizeof st_dev 4
108  * sizeof st_ino 4
109  * sizeof st_mode 2
110  * sizeof st_nlink 2
111  * sizeof st_uid 4
112  * sizeof st_gid 4
113  * sizeof st_rdev 4
114  * sizeof st_atim 16
115  * sizeof st_size 8
116  * sizeof st_blocks 8
117  * sizeof st_blksize 4
118  * sizeof st_flags 4
119  * sizeof st_gen 4
120  * sizeof st_lspare 4
121  */
122 
123  typedef struct {
124  uint32_t st_dev;
125  uint32_t st_ino;
126  uint16_t st_mode;
127  uint16_t st_nlink;
128  uint32_t st_uid;
129  uint32_t st_gid;
130  uint32_t st_rdev;
131  uint64_t st_atimeX;
132  uint64_t st_atime_nsec;
133  uint64_t st_mtimeX;
134  uint64_t st_mtime_nsec;
135  uint64_t st_ctimeX;
136  uint64_t st_ctime_nsec;
137  uint64_t st_size;
138  uint64_t st_blocks;
139  uint32_t st_blksize;
140  uint32_t st_flags;
141  uint32_t st_gen;
142  uint32_t st_lspare;
143  uint64_t st_birthtimX;
144  uint64_t st_birthtim;
145  } tgt_stat;
146 
147  typedef struct {
148  uint32_t st_dev;
149  uint32_t st_ino;
150  uint16_t st_mode;
151  uint16_t st_nlink;
152  uint32_t st_uid;
153  uint32_t st_gid;
154  uint32_t st_rdev;
155  uint64_t st_atimeX;
156  uint64_t st_atime_nsec;
157  uint64_t st_mtimeX;
158  uint64_t st_mtime_nsec;
159  uint64_t st_ctimeX;
160  uint64_t st_ctime_nsec;
161  uint64_t st_size;
162  uint64_t st_blocks;
163  uint32_t st_blksize;
164  uint32_t st_flags;
165  uint32_t st_gen;
166  uint32_t st_lspare;
167  uint64_t st_birthtimX;
168  uint64_t st_birthtim;
169  } tgt_stat64;
170 
172  struct rusage {
173  struct timeval ru_utime;
174  struct timeval ru_stime;
175  int32_t ru_maxrss;
176  int32_t ru_ixrss;
177  int32_t ru_idrss;
178  int32_t ru_isrss;
179  int32_t ru_minflt;
180  int32_t ru_majflt;
181  int32_t ru_nswap;
182  int32_t ru_inblock;
183  int32_t ru_oublock;
184  int32_t ru_msgsnd;
185  int32_t ru_msgrcv;
186  int32_t ru_nsignals;
187  int32_t ru_nvcsw;
188  int32_t ru_nivcsw;
189  };
190 
192  struct tms {
193  int32_t tms_utime;
194  int32_t tms_stime;
195  int32_t tms_cutime;
196  int32_t tms_cstime;
197  };
198 };
199 
200 class ArmFreebsd64 : public ArmFreebsd
201 {
202  public:
203 
206  static SyscallFlagTransTable openFlagTable[];
207 
209  static const int NUM_OPEN_FLAGS;
210 
212  typedef uint64_t size_t;
214  typedef uint64_t off_t;
215  typedef int64_t time_t;
216  typedef int64_t clock_t;
218 
220  static const int TGT_O_RDONLY = 0x00000000;
222  static const int TGT_O_WRONLY = 0x00000001;
223  static const int TGT_O_RDWR = 0x00000002;
224  static const int TGT_O_CREAT = 0x00000200;
225  static const int TGT_O_EXCL = 0x00000800;
226  static const int TGT_O_NOCTTY = 0x00008000;
227  static const int TGT_O_TRUNC = 0x00000400;
228  static const int TGT_O_APPEND = 0x00000008;
229  static const int TGT_O_NONBLOCK = 0x00000004;
230  static const int TGT_O_SYNC = 0x00000080;
231  static const int TGT_FASYNC = 0x00000040;
232  static const int TGT_O_DIRECT = 0x00010000;
233  static const int TGT_O_DIRECTORY = 0x00020000;
234  static const int TGT_O_NOFOLLOW = 0x00000100;
235  static const int TGT_O_CLOEXEC = 0x00100000;
236 
237 
239  static const unsigned TGT_MAP_SHARED = 0x0001;
240  static const unsigned TGT_MAP_PRIVATE = 0x0002;
241  static const unsigned TGT_MAP_ANONYMOUS = 0x1000;
242  static const unsigned TGT_MAP_FIXED = 0x0010;
243 
245  static const int TGT_RUSAGE_SELF = 0;
247  static const int TGT_RUSAGE_CHILDREN = -1;
248  static const int TGT_RUSAGE_THREAD = 1;
250 
268  };
269 
271  struct rlimit {
272  uint64_t rlim_cur;
273  uint64_t rlim_max;
274  };
275 
277  struct timeval {
278  int64_t tv_sec;
279  int64_t tv_usec;
280  };
281 
282  // For writev/readv
283  struct tgt_iovec {
284  uint64_t iov_base; // void *
285  uint64_t iov_len;
286  };
287 
288  typedef struct {
289  uint32_t st_dev;
290  uint32_t st_ino;
291  uint16_t st_mode;
292  uint16_t st_nlink;
293  uint32_t st_uid;
294  uint32_t st_gid;
295  uint32_t st_rdev;
296  uint64_t st_atimeX;
297  uint64_t st_atime_nsec;
298  uint64_t st_mtimeX;
299  uint64_t st_mtime_nsec;
300  uint64_t st_ctimeX;
301  uint64_t st_ctime_nsec;
302  uint64_t st_size;
303  uint64_t st_blocks;
304  uint32_t st_blksize;
305  uint32_t st_flags;
306  uint32_t st_gen;
307  uint32_t st_lspare;
308  uint64_t st_birthtimX;
309  uint64_t st_birthtim;
310  } tgt_stat;
311 
312  typedef struct {
313  uint32_t st_dev;
314  uint32_t st_ino;
315  uint16_t st_mode;
316  uint16_t st_nlink;
317  uint32_t st_uid;
318  uint32_t st_gid;
319  uint32_t st_rdev;
320  uint64_t st_atimeX;
321  uint64_t st_atime_nsec;
322  uint64_t st_mtimeX;
323  uint64_t st_mtime_nsec;
324  uint64_t st_ctimeX;
325  uint64_t st_ctime_nsec;
326  uint64_t st_size;
327  uint64_t st_blocks;
328  uint32_t st_blksize;
329  uint32_t st_flags;
330  uint32_t st_gen;
331  uint32_t st_lspare;
332  uint64_t st_birthtimX;
333  uint64_t st_birthtim;
334  } tgt_stat64;
335 
337  struct rusage {
338  struct timeval ru_utime;
339  struct timeval ru_stime;
340  int64_t ru_maxrss;
341  int64_t ru_ixrss;
342  int64_t ru_idrss;
343  int64_t ru_isrss;
344  int64_t ru_minflt;
345  int64_t ru_majflt;
346  int64_t ru_nswap;
347  int64_t ru_inblock;
348  int64_t ru_oublock;
349  int64_t ru_msgsnd;
350  int64_t ru_msgrcv;
351  int64_t ru_nsignals;
352  int64_t ru_nvcsw;
353  int64_t ru_nivcsw;
354  };
355 
357  struct tms {
358  int64_t tms_utime;
359  int64_t tms_stime;
360  int64_t tms_cutime;
361  int64_t tms_cstime;
362  };
363 };
364 
365 #endif
uint64_t st_atime_nsec
Definition: freebsd.hh:297
static const unsigned TGT_RLIMIT_NPTS
Definition: freebsd.hh:106
For gettimeofday().
Definition: freebsd.hh:277
static const unsigned TGT_RLIMIT_CORE
Definition: freebsd.hh:98
static const unsigned TGT_RLIMIT_KQUEUES
Definition: freebsd.hh:108
int64_t ru_oublock
block output operations
Definition: freebsd.hh:348
int32_t ru_nvcsw
voluntary context switches
Definition: freebsd.hh:187
uint32_t rlim_cur
soft limit
Definition: freebsd.hh:89
int32_t tv_sec
seconds
Definition: freebsd.hh:95
uint64_t rlim_max
hard limit
Definition: freebsd.hh:273
uint64_t st_atime_nsec
Definition: freebsd.hh:132
rlimit_resources
Resource enumeration for getrlimit().
Definition: freebsd.hh:252
uint32_t off_t
Definition: freebsd.hh:57
static const unsigned TGT_RLIMIT_MEMLOCK
Definition: freebsd.hh:100
For times().
Definition: freebsd.hh:192
int64_t ru_msgrcv
messages received
Definition: freebsd.hh:350
For gettimeofday().
Definition: freebsd.hh:94
int32_t ru_nivcsw
involuntary "
Definition: freebsd.hh:188
int32_t ru_msgsnd
messages sent
Definition: freebsd.hh:184
int32_t tms_stime
system time
Definition: freebsd.hh:194
static const unsigned TGT_RLIMIT_DATA
Definition: freebsd.hh:96
int64_t ru_majflt
page faults
Definition: freebsd.hh:345
int32_t ru_minflt
page reclaims - total vmfaults
Definition: freebsd.hh:179
static const int TGT_RUSAGE_THREAD
Definition: freebsd.hh:113
int64_t ru_nvcsw
voluntary context switches
Definition: freebsd.hh:352
For getrusage().
Definition: freebsd.hh:337
static const int NUM_OPEN_FLAGS
Number of entries in openFlagTable[].
Definition: freebsd.hh:209
static const unsigned TGT_RLIMIT_STACK
Definition: freebsd.hh:97
static const int NUM_OPEN_FLAGS
Number of entries in openFlagTable[].
Definition: freebsd.hh:52
uint64_t st_mtime_nsec
Definition: freebsd.hh:134
int32_t ru_inblock
block input operations
Definition: freebsd.hh:182
static const unsigned TGT_RLIMIT_VMEM
Definition: freebsd.hh:104
For getrusage().
Definition: freebsd.hh:172
int64_t ru_idrss
integral unshared data "
Definition: freebsd.hh:342
int32_t tms_utime
user time
Definition: freebsd.hh:193
int32_t ru_msgrcv
messages received
Definition: freebsd.hh:185
static const unsigned TGT_RLIMIT_FSIZE
Definition: freebsd.hh:95
int32_t tv_usec
microseconds
Definition: freebsd.hh:96
int64_t ru_minflt
page reclaims - total vmfaults
Definition: freebsd.hh:344
int32_t tms_cstime
system time of children
Definition: freebsd.hh:196
uint64_t st_ctime_nsec
Definition: freebsd.hh:301
static const ByteOrder byteOrder
Definition: freebsd.hh:41
int64_t ru_inblock
block input operations
Definition: freebsd.hh:347
uint64_t st_mtime_nsec
Definition: freebsd.hh:299
int32_t ru_idrss
integral unshared data "
Definition: freebsd.hh:177
static const unsigned TGT_RLIMIT_NPROC
Definition: freebsd.hh:101
ByteOrder
Definition: types.hh:247
int64_t tms_cutime
user time of children
Definition: freebsd.hh:360
void tgt_stat
Stat buffer.
int32_t ru_nswap
swaps
Definition: freebsd.hh:181
static const unsigned TGT_RLIMIT_SBSIZE
Definition: freebsd.hh:103
int32_t tms_cutime
user time of children
Definition: freebsd.hh:195
int64_t ru_nswap
swaps
Definition: freebsd.hh:346
Limit struct for getrlimit/setrlimit.
Definition: freebsd.hh:271
For times().
Definition: freebsd.hh:357
int32_t ru_isrss
integral unshared stack "
Definition: freebsd.hh:178
int64_t tms_stime
system time
Definition: freebsd.hh:359
int32_t ru_majflt
page faults
Definition: freebsd.hh:180
int64_t ru_nivcsw
involuntary "
Definition: freebsd.hh:353
int64_t tms_utime
user time
Definition: freebsd.hh:358
This struct is used to build target-OS-dependent tables that map the target&#39;s flags to the host&#39;s fla...
static const unsigned TGT_RLIMIT_NOFILE
Definition: freebsd.hh:102
static const int TGT_RUSAGE_CHILDREN
Definition: freebsd.hh:112
uint64_t st_ctime_nsec
Definition: freebsd.hh:136
int64_t ru_msgsnd
messages sent
Definition: freebsd.hh:349
int64_t ru_isrss
integral unshared stack "
Definition: freebsd.hh:343
uint64_t size_t
Basic FreeBSD types.
Definition: freebsd.hh:56
uint64_t off_t
Definition: freebsd.hh:214
int32_t ru_nsignals
signals received
Definition: freebsd.hh:186
uint32_t rlim_max
hard limit
Definition: freebsd.hh:90
static const unsigned TGT_RLIMIT_CPU
Resource constants for getrlimit().
Definition: freebsd.hh:94
int64_t tms_cstime
system time of children
Definition: freebsd.hh:361
Limit struct for getrlimit/setrlimit.
Definition: freebsd.hh:88
static const unsigned TGT_RLIMIT_SWAP
Definition: freebsd.hh:107
uint64_t rlim_cur
soft limit
Definition: freebsd.hh:272
int64_t clock_t
Definition: freebsd.hh:216
int32_t ru_oublock
block output operations
Definition: freebsd.hh:183
static const int TGT_RUSAGE_SELF
For getrusage().
Definition: freebsd.hh:111
static const unsigned TGT_RLIMIT_RSS
Definition: freebsd.hh:99
int64_t ru_nsignals
signals received
Definition: freebsd.hh:351
int64_t tv_usec
microseconds
Definition: freebsd.hh:279
int64_t ru_ixrss
integral shared memory size
Definition: freebsd.hh:341
int64_t time_t
Definition: freebsd.hh:215
int32_t ru_maxrss
max rss
Definition: freebsd.hh:175
int32_t clock_t
Definition: freebsd.hh:59
int32_t ru_ixrss
integral shared memory size
Definition: freebsd.hh:176
int64_t tv_sec
seconds
Definition: freebsd.hh:278
static const unsigned TGT_RLIMIT_AS
Definition: freebsd.hh:105
int64_t ru_maxrss
max rss
Definition: freebsd.hh:340
int32_t time_t
Definition: freebsd.hh:58

Generated on Fri Feb 28 2020 16:26:57 for gem5 by doxygen 1.8.13