gem5  v22.1.0.0
freebsd.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Arm Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
15  * All rights reserved.
16  *
17  * This software was developed by the University of Cambridge Computer
18  * Laboratory as part of the CTSRD Project, with support from the UK Higher
19  * Education Innovation Fund (HEIF).
20  *
21  * Redistribution and use in source and binary forms, with or without
22  * modification, are permitted provided that the following conditions are
23  * met: redistributions of source code must retain the above copyright
24  * notice, this list of conditions and the following disclaimer;
25  * redistributions in binary form must reproduce the above copyright
26  * notice, this list of conditions and the following disclaimer in the
27  * documentation and/or other materials provided with the distribution;
28  * neither the name of the copyright holders nor the names of its
29  * contributors may be used to endorse or promote products derived from
30  * this software without specific prior written permission.
31  *
32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
35  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
37  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
38  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
39  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
40  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
41  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
42  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43  */
44 
45 #ifndef __FREEBSD_HH__
46 #define __FREEBSD_HH__
47 
48 #include <string>
49 
50 #include "base/types.hh"
51 #include "kern/operatingsystem.hh"
52 
53 namespace gem5
54 {
55 
56 class ThreadContext;
57 class Process;
58 
64 class FreeBSD : public OperatingSystem
65 {
66 
67  public:
68 
70  typedef uint64_t size_t;
72  typedef uint64_t off_t;
73  typedef int64_t time_t;
74  typedef int64_t clock_t;
75  typedef uint32_t uid_t;
76  typedef uint32_t gid_t;
78 
80  static const int M5_SC_CLK_TCK = 100;
81 
83  static const unsigned TGT_TIOCGETA = 0x402c7413;
85  static const unsigned TGT_TIOCSETA = 0x802c7414;
86  static const unsigned TGT_TIOCSETAW = 0x802c7415;
87  static const unsigned TGT_FIONREAD = 0x4004667f;
89 
94  static bool
95  isTtyReq(unsigned req)
96  {
97  switch (req) {
98  case TGT_TIOCGETA:
99  case TGT_TIOCSETA:
100  case TGT_TIOCSETAW:
101  case TGT_FIONREAD:
102  return true;
103  default:
104  return false;
105  }
106  }
107 
109  static const unsigned TGT_RLIMIT_CPU = 0;
110  static const unsigned TGT_RLIMIT_FSIZE = 1;
111  static const unsigned TGT_RLIMIT_DATA = 2;
112  static const unsigned TGT_RLIMIT_STACK = 3;
113  static const unsigned TGT_RLIMIT_CORE = 4;
114  static const unsigned TGT_RLIMIT_RSS = 5;
115  static const unsigned TGT_RLIMIT_MEMLOCK = 6;
116  static const unsigned TGT_RLIMIT_NPROC = 7;
117  static const unsigned TGT_RLIMIT_NOFILE = 8;
118  static const unsigned TGT_RLIMIT_SBSIZE = 9;
119  static const unsigned TGT_RLIMIT_VMEM = 10;
120  static const unsigned TGT_RLIMIT_AS = TGT_RLIMIT_VMEM;
121  static const unsigned TGT_RLIMIT_NPTS = 11;
122  static const unsigned TGT_RLIMIT_SWAP = 12;
123  static const unsigned TGT_RLIMIT_KQUEUES = 13;
124 
126  static const int TGT_RUSAGE_SELF = 0;
127  static const int TGT_RUSAGE_CHILDREN = -1;
128  static const int TGT_RUSAGE_THREAD = 1;
129 
130  // for *at syscalls
131  static const int TGT_AT_FDCWD = -100;
132  static const int TGT_AT_REMOVEDIR = 0x800;
133 
134 }; // class FreeBSD
135 
136 } // namespace gem5
137 
138 #endif // __FREEBSD_HH__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
This class encapsulates the types, structures, constants, functions, and syscall-number mappings spec...
Definition: freebsd.hh:65
static const unsigned TGT_RLIMIT_NPROC
Definition: freebsd.hh:116
static const unsigned TGT_RLIMIT_SBSIZE
Definition: freebsd.hh:118
int64_t clock_t
Definition: freebsd.hh:74
static const int M5_SC_CLK_TCK
Clock ticks per second, for times().
Definition: freebsd.hh:80
static const unsigned TGT_RLIMIT_KQUEUES
Definition: freebsd.hh:123
static const unsigned TGT_TIOCSETA
Definition: freebsd.hh:85
static const unsigned TGT_RLIMIT_SWAP
Definition: freebsd.hh:122
static const unsigned TGT_RLIMIT_CPU
Resource constants for getrlimit().
Definition: freebsd.hh:109
static const unsigned TGT_RLIMIT_DATA
Definition: freebsd.hh:111
static bool isTtyReq(unsigned req)
Return true for the ioctl codes for which we return ENOTTY without printing a warning,...
Definition: freebsd.hh:95
static const unsigned TGT_FIONREAD
Definition: freebsd.hh:87
static const unsigned TGT_RLIMIT_MEMLOCK
Definition: freebsd.hh:115
static const unsigned TGT_RLIMIT_NPTS
Definition: freebsd.hh:121
static const int TGT_RUSAGE_THREAD
Definition: freebsd.hh:128
static const unsigned TGT_RLIMIT_AS
Definition: freebsd.hh:120
static const int TGT_AT_FDCWD
Definition: freebsd.hh:131
static const unsigned TGT_RLIMIT_CORE
Definition: freebsd.hh:113
static const int TGT_RUSAGE_SELF
For getrusage().
Definition: freebsd.hh:126
static const unsigned TGT_RLIMIT_FSIZE
Definition: freebsd.hh:110
uint32_t gid_t
Definition: freebsd.hh:76
static const unsigned TGT_RLIMIT_NOFILE
Definition: freebsd.hh:117
uint64_t off_t
Definition: freebsd.hh:72
static const unsigned TGT_RLIMIT_VMEM
Definition: freebsd.hh:119
static const int TGT_AT_REMOVEDIR
Definition: freebsd.hh:132
uint64_t size_t
Basic FreeBSD types.
Definition: freebsd.hh:71
static const unsigned TGT_TIOCGETA
ioctl() command codes.
Definition: freebsd.hh:84
static const unsigned TGT_RLIMIT_RSS
Definition: freebsd.hh:114
uint32_t uid_t
Definition: freebsd.hh:75
static const int TGT_RUSAGE_CHILDREN
Definition: freebsd.hh:127
static const unsigned TGT_TIOCSETAW
Definition: freebsd.hh:86
static const unsigned TGT_RLIMIT_STACK
Definition: freebsd.hh:112
int64_t time_t
Definition: freebsd.hh:73
This class encapsulates the types, structures, constants, functions, and syscall-number mappings spec...
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....

Generated on Wed Dec 21 2022 10:22:25 for gem5 by doxygen 1.9.1