gem5  v21.0.1.0
se_workload.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2015 Ruslan Bukin <br@bsdpad.com>
3  *
4  * This software was developed by the University of Cambridge Computer
5  * Laboratory as part of the CTSRD Project, with support from the UK Higher
6  * Education Innovation Fund (HEIF).
7  *
8  * Copyright 2020 Google Inc.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions are
12  * met: redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer;
14  * redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution;
17  * neither the name of the copyright holders nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef __ARCH_ARM_FREEBSD_SE_WORKLOAD_HH__
35 #define __ARCH_ARM_FREEBSD_SE_WORKLOAD_HH__
36 
38 #include "arch/arm/registers.hh"
39 #include "arch/arm/se_workload.hh"
40 #include "params/ArmEmuFreebsd.hh"
41 #include "sim/syscall_desc.hh"
42 
43 namespace ArmISA
44 {
45 
46 class EmuFreebsd : public SEWorkload
47 {
48  public:
49  using Params = ArmEmuFreebsdParams;
50 
51  EmuFreebsd(const Params &p) : SEWorkload(p) {}
52 
53  struct BaseSyscallABI {};
55  public BaseSyscallABI
56  {};
58  public BaseSyscallABI
59  {};
60 
61  void syscall(ThreadContext *tc) override;
62 };
63 
64 } // namespace ArmISA
65 
66 namespace GuestABI
67 {
68 
69 template <typename ABI>
70 struct Result<ABI, SyscallReturn,
71  typename std::enable_if_t<std::is_base_of<
72  ArmISA::EmuFreebsd::BaseSyscallABI, ABI>::value>>
73 {
74  static void
76  {
77  if (ret.suppressed() || ret.needsRetry())
78  return;
79 
80  RegVal val;
81  if (ret.successful()) {
82  tc->setCCReg(ArmISA::CCREG_C, 0);
83  val = ret.returnValue();
84  } else {
85  tc->setCCReg(ArmISA::CCREG_C, 1);
86  val = ret.encodedValue();
87  }
89  if (ret.count() > 1)
91  }
92 };
93 
94 } // namespace GuestABI
95 
96 #endif // __ARCH_ARM_FREEBSD_SE_WORKLOAD_HH__
ArmISA::EmuFreebsd::SyscallABI32
Definition: se_workload.hh:54
freebsd.hh
ArmISA::EmuFreebsd::SyscallABI64
Definition: se_workload.hh:57
ArmISA::EmuFreebsd
Definition: se_workload.hh:46
ArmISA::EmuFreebsd::BaseSyscallABI
Definition: se_workload.hh:53
ThreadContext::setIntReg
virtual void setIntReg(RegIndex reg_idx, RegVal val)=0
SyscallReturn::value2
int64_t value2() const
Definition: syscall_return.hh:120
GuestABI::Result< ABI, SyscallReturn, typename std::enable_if_t< std::is_base_of< ArmISA::EmuFreebsd::BaseSyscallABI, ABI >::value > >::store
static void store(ThreadContext *tc, const SyscallReturn &ret)
Definition: se_workload.hh:75
ArmISA::EmuFreebsd::Params
ArmEmuFreebsdParams Params
Definition: se_workload.hh:49
ArmISA
Definition: ccregs.hh:41
ArmISA::ReturnValueReg
const int ReturnValueReg
Definition: registers.hh:96
SyscallReturn::returnValue
int64_t returnValue() const
The return value.
Definition: syscall_return.hh:104
ArmISA::SyscallPseudoReturnReg
const int SyscallPseudoReturnReg
Definition: registers.hh:123
ArmISA::CCREG_C
@ CCREG_C
Definition: ccregs.hh:46
SyscallReturn::suppressed
bool suppressed() const
Should returning this value be suppressed?
Definition: syscall_return.hh:97
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
GuestABI
Definition: aapcs32.hh:66
SyscallReturn::needsRetry
bool needsRetry() const
Does the syscall need to be retried?
Definition: syscall_return.hh:94
se_workload.hh
X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:769
SyscallReturn
This class represents the return value from an emulated system call, including any errno setting.
Definition: syscall_return.hh:52
ArmISA::EmuFreebsd::syscall
void syscall(ThreadContext *tc) override
Definition: se_workload.cc:146
ArmISA::RegABI32
Definition: reg_abi.hh:39
GuestABI::Result
Definition: definition.hh:58
ThreadContext::setCCReg
virtual void setCCReg(RegIndex reg_idx, RegVal val)=0
std
Overload hash function for BasicBlockRange type.
Definition: vec_reg.hh:587
registers.hh
ArmISA::RegABI64
Definition: reg_abi.hh:44
SyscallReturn::encodedValue
int64_t encodedValue() const
The encoded value (as described above)
Definition: syscall_return.hh:119
SyscallReturn::count
int count() const
How many values did the syscall attempt to return?
Definition: syscall_return.hh:100
ArmISA::SEWorkload
Definition: se_workload.hh:38
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
ArmISA::EmuFreebsd::EmuFreebsd
EmuFreebsd(const Params &p)
Definition: se_workload.hh:51
RegVal
uint64_t RegVal
Definition: types.hh:174
syscall_desc.hh
SyscallReturn::successful
bool successful() const
Was the system call successful?
Definition: syscall_return.hh:88

Generated on Tue Jun 22 2021 15:28:20 for gem5 by doxygen 1.8.17