gem5
v21.0.1.0
arch
riscv
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_RISCV_SE_WORKLOAD_HH__
29
#define __ARCH_RISCV_SE_WORKLOAD_HH__
30
31
#include "
arch/riscv/reg_abi.hh
"
32
#include "
arch/riscv/registers.hh
"
33
#include "params/RiscvSEWorkload.hh"
34
#include "
sim/se_workload.hh
"
35
#include "
sim/syscall_abi.hh
"
36
37
namespace
RiscvISA
38
{
39
40
class
SEWorkload
:
public
::SEWorkload
41
{
42
public
:
43
using
Params
= RiscvSEWorkloadParams;
44
45
SEWorkload
(
const
Params
&
p
) : ::
SEWorkload
(
p
) {}
46
47
::Loader::Arch
getArch
()
const override
{
return ::Loader::Riscv64
; }
48
49
//FIXME RISCV needs to handle 64 bit arguments in its 32 bit ISA.
50
using
SyscallABI
=
RegABI64
;
51
};
52
53
}
// namespace RiscvISA
54
55
namespace
GuestABI
56
{
57
58
template
<>
59
struct
Result
<
RiscvISA
::SEWorkload::SyscallABI,
SyscallReturn
>
60
{
61
static
void
62
store
(
ThreadContext
*tc,
const
SyscallReturn
&ret)
63
{
64
if
(ret.
suppressed
() || ret.
needsRetry
())
65
return
;
66
67
if
(ret.
successful
()) {
68
// no error
69
tc->
setIntReg
(
RiscvISA::ReturnValueReg
, ret.
returnValue
());
70
}
else
{
71
// got an error, return details
72
tc->
setIntReg
(
RiscvISA::ReturnValueReg
, ret.
encodedValue
());
73
}
74
}
75
};
76
77
}
// namespace GuestABI
78
79
#endif // __ARCH_RISCV_SE_WORKLOAD_HH__
reg_abi.hh
ThreadContext::setIntReg
virtual void setIntReg(RegIndex reg_idx, RegVal val)=0
RiscvISA::p
Bitfield< 0 > p
Definition:
pra_constants.hh:323
RiscvISA::SEWorkload::Params
RiscvSEWorkloadParams Params
Definition:
se_workload.hh:43
syscall_abi.hh
RiscvISA
Definition:
fs_workload.cc:37
Loader::Riscv64
@ Riscv64
Definition:
object_file.hh:55
SyscallReturn::returnValue
int64_t returnValue() const
The return value.
Definition:
syscall_return.hh:104
RiscvISA::ReturnValueReg
const int ReturnValueReg
Definition:
registers.hh:126
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
RiscvISA::RegABI64
Definition:
reg_abi.hh:39
SyscallReturn
This class represents the return value from an emulated system call, including any errno setting.
Definition:
syscall_return.hh:52
registers.hh
Loader::Arch
Arch
Definition:
object_file.hh:44
GuestABI::Result
Definition:
definition.hh:58
SyscallReturn::encodedValue
int64_t encodedValue() const
The encoded value (as described above)
Definition:
syscall_return.hh:119
RiscvISA::SEWorkload
Definition:
se_workload.hh:40
se_workload.hh
RiscvISA::SEWorkload::SEWorkload
SEWorkload(const Params &p)
Definition:
se_workload.hh:45
SyscallReturn::successful
bool successful() const
Was the system call successful?
Definition:
syscall_return.hh:88
GuestABI::Result< RiscvISA::SEWorkload::SyscallABI, SyscallReturn >::store
static void store(ThreadContext *tc, const SyscallReturn &ret)
Definition:
se_workload.hh:62
RiscvISA::SEWorkload::getArch
::Loader::Arch getArch() const override
Definition:
se_workload.hh:47
Generated on Tue Jun 22 2021 15:28:20 for gem5 by
doxygen
1.8.17