gem5  v21.1.0.2
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 __FREEBSD_HH__
34 #define __FREEBSD_HH__
35 
36 #include <string>
37 
38 #include "base/types.hh"
39 #include "kern/operatingsystem.hh"
40 
41 namespace gem5
42 {
43 
44 class ThreadContext;
45 class Process;
46 
52 class FreeBSD : public OperatingSystem
53 {
54 
55  public:
56 
58  typedef uint64_t size_t;
60  typedef uint64_t off_t;
61  typedef int64_t time_t;
62  typedef int64_t clock_t;
63  typedef uint32_t uid_t;
64  typedef uint32_t gid_t;
66 
68  static const int M5_SC_CLK_TCK = 100;
69 
71  static const unsigned TGT_TIOCGETA = 0x402c7413;
73  static const unsigned TGT_TIOCSETA = 0x802c7414;
74  static const unsigned TGT_TIOCSETAW = 0x802c7415;
75  static const unsigned TGT_FIONREAD = 0x4004667f;
77 
82  static bool
83  isTtyReq(unsigned req)
84  {
85  switch (req) {
86  case TGT_TIOCGETA:
87  case TGT_TIOCSETA:
88  case TGT_TIOCSETAW:
89  case TGT_FIONREAD:
90  return true;
91  default:
92  return false;
93  }
94  }
95 
97  static const unsigned TGT_RLIMIT_CPU = 0;
98  static const unsigned TGT_RLIMIT_FSIZE = 1;
99  static const unsigned TGT_RLIMIT_DATA = 2;
100  static const unsigned TGT_RLIMIT_STACK = 3;
101  static const unsigned TGT_RLIMIT_CORE = 4;
102  static const unsigned TGT_RLIMIT_RSS = 5;
103  static const unsigned TGT_RLIMIT_MEMLOCK = 6;
104  static const unsigned TGT_RLIMIT_NPROC = 7;
105  static const unsigned TGT_RLIMIT_NOFILE = 8;
106  static const unsigned TGT_RLIMIT_SBSIZE = 9;
107  static const unsigned TGT_RLIMIT_VMEM = 10;
108  static const unsigned TGT_RLIMIT_AS = TGT_RLIMIT_VMEM;
109  static const unsigned TGT_RLIMIT_NPTS = 11;
110  static const unsigned TGT_RLIMIT_SWAP = 12;
111  static const unsigned TGT_RLIMIT_KQUEUES = 13;
112 
114  static const int TGT_RUSAGE_SELF = 0;
115  static const int TGT_RUSAGE_CHILDREN = -1;
116  static const int TGT_RUSAGE_THREAD = 1;
117 
118  // for *at syscalls
119  static const int TGT_AT_FDCWD = -100;
120 
121 }; // class FreeBSD
122 
123 } // namespace gem5
124 
125 #endif // __FREEBSD_HH__
gem5::FreeBSD::TGT_AT_FDCWD
static const int TGT_AT_FDCWD
Definition: freebsd.hh:119
gem5::FreeBSD::TGT_RLIMIT_MEMLOCK
static const unsigned TGT_RLIMIT_MEMLOCK
Definition: freebsd.hh:103
gem5::FreeBSD::TGT_TIOCSETA
static const unsigned TGT_TIOCSETA
Definition: freebsd.hh:73
gem5::FreeBSD::TGT_RLIMIT_AS
static const unsigned TGT_RLIMIT_AS
Definition: freebsd.hh:108
gem5::FreeBSD::TGT_TIOCSETAW
static const unsigned TGT_TIOCSETAW
Definition: freebsd.hh:74
gem5::FreeBSD::TGT_RUSAGE_CHILDREN
static const int TGT_RUSAGE_CHILDREN
Definition: freebsd.hh:115
gem5::FreeBSD::TGT_RLIMIT_NPROC
static const unsigned TGT_RLIMIT_NPROC
Definition: freebsd.hh:104
gem5::FreeBSD::TGT_RLIMIT_NPTS
static const unsigned TGT_RLIMIT_NPTS
Definition: freebsd.hh:109
gem5::FreeBSD::isTtyReq
static bool isTtyReq(unsigned req)
Return true for the ioctl codes for which we return ENOTTY without printing a warning,...
Definition: freebsd.hh:83
gem5::FreeBSD::TGT_RUSAGE_SELF
static const int TGT_RUSAGE_SELF
For getrusage().
Definition: freebsd.hh:114
gem5::FreeBSD::TGT_RLIMIT_SBSIZE
static const unsigned TGT_RLIMIT_SBSIZE
Definition: freebsd.hh:106
gem5::FreeBSD::TGT_RLIMIT_SWAP
static const unsigned TGT_RLIMIT_SWAP
Definition: freebsd.hh:110
gem5::FreeBSD::TGT_RLIMIT_NOFILE
static const unsigned TGT_RLIMIT_NOFILE
Definition: freebsd.hh:105
gem5::FreeBSD
This class encapsulates the types, structures, constants, functions, and syscall-number mappings spec...
Definition: freebsd.hh:52
gem5::FreeBSD::TGT_RUSAGE_THREAD
static const int TGT_RUSAGE_THREAD
Definition: freebsd.hh:116
gem5::FreeBSD::TGT_RLIMIT_KQUEUES
static const unsigned TGT_RLIMIT_KQUEUES
Definition: freebsd.hh:111
gem5::FreeBSD::TGT_RLIMIT_CORE
static const unsigned TGT_RLIMIT_CORE
Definition: freebsd.hh:101
gem5::FreeBSD::TGT_RLIMIT_VMEM
static const unsigned TGT_RLIMIT_VMEM
Definition: freebsd.hh:107
gem5::FreeBSD::clock_t
int64_t clock_t
Definition: freebsd.hh:62
gem5::OperatingSystem
This class encapsulates the types, structures, constants, functions, and syscall-number mappings spec...
Definition: operatingsystem.hh:47
gem5::FreeBSD::TGT_RLIMIT_RSS
static const unsigned TGT_RLIMIT_RSS
Definition: freebsd.hh:102
gem5::FreeBSD::TGT_FIONREAD
static const unsigned TGT_FIONREAD
Definition: freebsd.hh:75
operatingsystem.hh
gem5::FreeBSD::size_t
uint64_t size_t
Basic FreeBSD types.
Definition: freebsd.hh:59
gem5::FreeBSD::TGT_RLIMIT_CPU
static const unsigned TGT_RLIMIT_CPU
Resource constants for getrlimit().
Definition: freebsd.hh:97
gem5::FreeBSD::off_t
uint64_t off_t
Definition: freebsd.hh:60
gem5::FreeBSD::time_t
int64_t time_t
Definition: freebsd.hh:61
gem5::FreeBSD::TGT_RLIMIT_FSIZE
static const unsigned TGT_RLIMIT_FSIZE
Definition: freebsd.hh:98
gem5::FreeBSD::M5_SC_CLK_TCK
static const int M5_SC_CLK_TCK
Clock ticks per second, for times().
Definition: freebsd.hh:68
gem5::FreeBSD::gid_t
uint32_t gid_t
Definition: freebsd.hh:64
types.hh
gem5::FreeBSD::TGT_TIOCGETA
static const unsigned TGT_TIOCGETA
ioctl() command codes.
Definition: freebsd.hh:72
gem5::FreeBSD::TGT_RLIMIT_DATA
static const unsigned TGT_RLIMIT_DATA
Definition: freebsd.hh:99
gem5::FreeBSD::uid_t
uint32_t uid_t
Definition: freebsd.hh:63
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::FreeBSD::TGT_RLIMIT_STACK
static const unsigned TGT_RLIMIT_STACK
Definition: freebsd.hh:100

Generated on Tue Sep 21 2021 12:24:31 for gem5 by doxygen 1.8.17