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