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