gem5
v21.0.1.0
arch
power
se_workload.hh
Go to the documentation of this file.
1
/*
2
* Copyright 2020 Google Inc.
3
*
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions are
6
* met: redistributions of source code must retain the above copyright
7
* notice, this list of conditions and the following disclaimer;
8
* redistributions in binary form must reproduce the above copyright
9
* notice, this list of conditions and the following disclaimer in the
10
* documentation and/or other materials provided with the distribution;
11
* neither the name of the copyright holders nor the names of its
12
* contributors may be used to endorse or promote products derived from
13
* this software without specific prior written permission.
14
*
15
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
*/
27
28
#ifndef __ARCH_POWER_SE_WORKLOAD_HH__
29
#define __ARCH_POWER_SE_WORKLOAD_HH__
30
31
#include "
arch/power/registers.hh
"
32
#include "params/PowerSEWorkload.hh"
33
#include "
sim/se_workload.hh
"
34
#include "
sim/syscall_abi.hh
"
35
#include "
sim/syscall_desc.hh
"
36
37
namespace
PowerISA
38
{
39
40
class
SEWorkload
:
public
::SEWorkload
41
{
42
public
:
43
using
Params
= PowerSEWorkloadParams;
44
SEWorkload
(
const
Params
&
p
) : ::
SEWorkload
(
p
) {}
45
46
::Loader::Arch
getArch
()
const override
{
return ::Loader::Power
; }
47
48
struct
SyscallABI
:
public
GenericSyscallABI64
49
{
50
static
const
std::vector<int>
ArgumentRegs
;
51
};
52
};
53
54
}
// namespace PowerISA
55
56
namespace
GuestABI
57
{
58
59
template
<>
60
struct
Result
<
PowerISA
::SEWorkload::SyscallABI,
SyscallReturn
>
61
{
62
static
void
63
store
(
ThreadContext
*tc,
const
SyscallReturn
&ret)
64
{
65
if
(ret.
suppressed
() || ret.
needsRetry
())
66
return
;
67
68
PowerISA::Cr cr = tc->
readIntReg
(
PowerISA::INTREG_CR
);
69
if
(ret.
successful
()) {
70
cr.cr0.so = 0;
71
}
else
{
72
cr.cr0.so = 1;
73
}
74
tc->
setIntReg
(
PowerISA::INTREG_CR
, cr);
75
tc->
setIntReg
(
PowerISA::ReturnValueReg
, ret.
encodedValue
());
76
}
77
};
78
79
}
// namespace GuestABI
80
81
#endif // __ARCH_POWER_SE_WORKLOAD_HH__
PowerISA::SEWorkload::Params
PowerSEWorkloadParams Params
Definition:
se_workload.hh:43
PowerISA::SEWorkload::SEWorkload
SEWorkload(const Params &p)
Definition:
se_workload.hh:44
GenericSyscallABI64
Definition:
syscall_abi.hh:44
ThreadContext::setIntReg
virtual void setIntReg(RegIndex reg_idx, RegVal val)=0
Loader::Power
@ Power
Definition:
object_file.hh:54
std::vector< int >
syscall_abi.hh
PowerISA::INTREG_CR
@ INTREG_CR
Definition:
registers.hh:80
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
PowerISA
Definition:
decoder.cc:31
PowerISA::SEWorkload::SyscallABI::ArgumentRegs
static const std::vector< int > ArgumentRegs
Definition:
se_workload.hh:50
PowerISA::ReturnValueReg
const int ReturnValueReg
Definition:
registers.hh:73
GuestABI
Definition:
aapcs32.hh:66
registers.hh
SyscallReturn::needsRetry
bool needsRetry() const
Does the syscall need to be retried?
Definition:
syscall_return.hh:94
PowerISA::SEWorkload::getArch
::Loader::Arch getArch() const override
Definition:
se_workload.hh:46
SyscallReturn
This class represents the return value from an emulated system call, including any errno setting.
Definition:
syscall_return.hh:52
Loader::Arch
Arch
Definition:
object_file.hh:44
GuestABI::Result
Definition:
definition.hh:58
PowerISA::SEWorkload
Definition:
se_workload.hh:40
SyscallReturn::encodedValue
int64_t encodedValue() const
The encoded value (as described above)
Definition:
syscall_return.hh:119
GuestABI::Result< PowerISA::SEWorkload::SyscallABI, SyscallReturn >::store
static void store(ThreadContext *tc, const SyscallReturn &ret)
Definition:
se_workload.hh:63
MipsISA::p
Bitfield< 0 > p
Definition:
pra_constants.hh:323
ThreadContext::readIntReg
virtual RegVal readIntReg(RegIndex reg_idx) const =0
PowerISA::SEWorkload::SyscallABI
Definition:
se_workload.hh:48
syscall_desc.hh
se_workload.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