gem5  v20.1.0.0
process.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006 The Regents of The University of Michigan
3  * Copyright (c) 2017 The University of Virginia
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 __RISCV_PROCESS_HH__
31 #define __RISCV_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 System;
46 
47 class RiscvProcess : public Process
48 {
49  protected:
50  RiscvProcess(ProcessParams * params, ::Loader::ObjectFile *objFile);
51  template<class IntType>
52  void argsInit(int pageSize);
53 
54  public:
55  virtual bool mmapGrowsDown() const override { return false; }
56 
57  //FIXME RISCV needs to handle 64 bit arguments in its 32 bit ISA.
59  {
61  };
62 };
63 
64 namespace GuestABI
65 {
66 
67 template <>
68 struct Result<RiscvProcess::SyscallABI, SyscallReturn>
69 {
70  static void
72  {
73  if (ret.suppressed() || ret.needsRetry())
74  return;
75 
76  if (ret.successful()) {
77  // no error
79  } else {
80  // got an error, return details
82  }
83  }
84 };
85 
86 };
87 
89 {
90  protected:
91  RiscvProcess64(ProcessParams * params, ::Loader::ObjectFile *objFile);
92  void initState() override;
93 };
94 
96 {
97  protected:
98  RiscvProcess32(ProcessParams * params, ::Loader::ObjectFile *objFile);
99  void initState() override;
100 };
101 
102 #endif // __RISCV_PROCESS_HH__
GuestABI::Result< RiscvProcess::SyscallABI, SyscallReturn >::store
static void store(ThreadContext *tc, const SyscallReturn &ret)
Definition: process.hh:71
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
SyscallReturn::returnValue
int64_t returnValue() const
The return value.
Definition: syscall_return.hh:104
Loader
Definition: process.hh:39
RiscvProcess::RiscvProcess
RiscvProcess(ProcessParams *params, ::Loader::ObjectFile *objFile)
Definition: process.cc:60
Loader::ObjectFile
Definition: object_file.hh:70
RiscvISA::ReturnValueReg
const int ReturnValueReg
Definition: registers.hh:98
SyscallReturn::suppressed
bool suppressed() const
Should returning this value be suppressed?
Definition: syscall_return.hh:97
RiscvProcess::argsInit
void argsInit(int pageSize)
Definition: process.cc:121
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
System
Definition: system.hh:73
SyscallReturn::needsRetry
bool needsRetry() const
Does the syscall need to be retried?
Definition: syscall_return.hh:94
RiscvProcess::mmapGrowsDown
virtual bool mmapGrowsDown() const override
Does mmap region grow upward or downward from mmapEnd? Most platforms grow downward,...
Definition: process.hh:55
process.hh
RiscvProcess64::RiscvProcess64
RiscvProcess64(ProcessParams *params, ::Loader::ObjectFile *objFile)
Definition: process.cc:69
RiscvProcess32
Definition: process.hh:95
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
RiscvProcess::SyscallABI::ArgumentRegs
static const std::vector< int > ArgumentRegs
Definition: process.hh:60
RiscvProcess
Definition: process.hh:47
GuestABI::Result
Definition: definition.hh:58
RiscvProcess64::initState
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:96
SyscallReturn::encodedValue
int64_t encodedValue() const
The encoded value (as described above)
Definition: syscall_return.hh:119
RiscvProcess64
Definition: process.hh:88
RiscvProcess::SyscallABI
Definition: process.hh:58
page_table.hh
RiscvProcess32::RiscvProcess32
RiscvProcess32(ProcessParams *params, ::Loader::ObjectFile *objFile)
Definition: process.cc:82
SyscallReturn::successful
bool successful() const
Was the system call successful?
Definition: syscall_return.hh:88
RiscvProcess32::initState
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:106

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