gem5  v20.1.0.0
process.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_PROCESS_HH__
34 #define __ARCH_ARM_FREEBSD_PROCESS_HH__
35 
36 #include <vector>
37 
38 #include "arch/arm/process.hh"
39 
41 {
42  public:
43  struct SyscallABI {};
44 };
45 
46 namespace GuestABI
47 {
48 
49 template <typename ABI>
50 struct Result<ABI, SyscallReturn,
51  typename std::enable_if<std::is_base_of<
52  ArmFreebsdProcessBits::SyscallABI, ABI>::value>::type>
53 {
54  static void
56  {
57  if (ret.suppressed() || ret.needsRetry())
58  return;
59 
60  RegVal val;
61  if (ret.successful()) {
62  tc->setCCReg(ArmISA::CCREG_C, 0);
63  val = ret.returnValue();
64  } else {
65  tc->setCCReg(ArmISA::CCREG_C, 1);
66  val = ret.encodedValue();
67  }
69  if (ret.count() > 1)
71  }
72 };
73 
74 } // namespace GuestABI
75 
78 {
79  public:
81  ::Loader::Arch _arch);
82 
83  void initState() override;
84 
85  void syscall(ThreadContext *tc) override;
86 
88  static const Addr commPage;
89 
92  {};
93 };
94 
97 {
98  public:
100  ::Loader::Arch _arch);
101 
102  void initState() override;
103  void syscall(ThreadContext *tc) override;
104 
107  {};
108 };
109 
110 #endif // __ARCH_ARM_FREEBSD_PROCESS_HH__
ArmFreebsdProcess32::initState
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:164
ArmFreebsdProcess32::ArmFreebsdProcess32
ArmFreebsdProcess32(ProcessParams *params, ::Loader::ObjectFile *objFile, ::Loader::Arch _arch)
Definition: process.cc:153
ArmProcess64
Definition: process.hh:117
type
uint8_t type
Definition: inet.hh:421
ThreadContext::setIntReg
virtual void setIntReg(RegIndex reg_idx, RegVal val)=0
SyscallReturn::value2
int64_t value2() const
Definition: syscall_return.hh:120
ArmFreebsdProcessBits
Definition: process.hh:40
ArmISA::ReturnValueReg
const int ReturnValueReg
Definition: registers.hh:104
SyscallReturn::returnValue
int64_t returnValue() const
The return value.
Definition: syscall_return.hh:104
ArmISA::SyscallPseudoReturnReg
const int SyscallPseudoReturnReg
Definition: registers.hh:131
ArmISA::CCREG_C
@ CCREG_C
Definition: ccregs.hh:46
ArmProcess32::SyscallABI
Definition: process.hh:86
Loader::ObjectFile
Definition: object_file.hh:70
SyscallReturn::suppressed
bool suppressed() const
Should returning this value be suppressed?
Definition: syscall_return.hh:97
GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< ArmFreebsdProcessBits::SyscallABI, ABI >::value >::type >::store
static void store(ThreadContext *tc, const SyscallReturn &ret)
Definition: process.hh:55
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
ArmFreebsdProcess32::syscall
void syscall(ThreadContext *tc) override
Definition: process.cc:178
ArmFreebsdProcess32
A process with emulated Arm/Freebsd syscalls.
Definition: process.hh:77
ArmProcess32
Definition: process.hh:74
X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:769
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
Process::objFile
::Loader::ObjectFile * objFile
Definition: process.hh:213
SyscallReturn
This class represents the return value from an emulated system call, including any errno setting.
Definition: syscall_return.hh:52
SimObject::params
const Params * params() const
Definition: sim_object.hh:119
ArmFreebsdProcessBits::SyscallABI
Definition: process.hh:43
ArmFreebsdProcess64::syscall
void syscall(ThreadContext *tc) override
Definition: process.cc:185
Loader::Arch
Arch
Definition: object_file.hh:44
ArmProcess64::SyscallABI
Definition: process.hh:129
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
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
ArmFreebsdProcess64
A process with emulated Arm/Freebsd syscalls.
Definition: process.hh:96
ArmFreebsdProcess32::commPage
static const Addr commPage
A page to hold "kernel" provided functions. The name might be wrong.
Definition: process.hh:88
process.hh
ArmFreebsdProcess64::SyscallABI
Definition: process.hh:105
RegVal
uint64_t RegVal
Definition: types.hh:168
ArmFreebsdProcess64::initState
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:171
ArmFreebsdProcess32::SyscallABI
Definition: process.hh:90
ArmFreebsdProcess64::ArmFreebsdProcess64
ArmFreebsdProcess64(ProcessParams *params, ::Loader::ObjectFile *objFile, ::Loader::Arch _arch)
Definition: process.cc:158
SyscallReturn::successful
bool successful() const
Was the system call successful?
Definition: syscall_return.hh:88

Generated on Wed Sep 30 2020 14:02:00 for gem5 by doxygen 1.8.17