gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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__
static const std::vector< int > ArgumentRegs
Definition: process.hh:60
bool successful() const
Was the system call successful?
Definition: system.hh:72
ThreadContext is the external interface to all thread state for anything outside of the CPU...
int64_t encodedValue() const
The encoded value (as described above)
virtual bool mmapGrowsDown() const override
Does mmap region grow upward or downward from mmapEnd? Most platforms grow downward, but a few (such as Alpha) grow upward instead, so they can override this method to return false.
Definition: process.hh:55
const int ReturnValueReg
Definition: registers.hh:99
virtual void setIntReg(RegIndex reg_idx, RegVal val)=0
static void store(ThreadContext *tc, const SyscallReturn &ret)
Definition: process.hh:71
int64_t returnValue() const
The return value.
bool suppressed() const
Should returning this value be suppressed?
Declarations of a non-full system Page Table.
bool needsRetry() const
Does the syscall need to be retried?
This class represents the return value from an emulated system call, including any errno setting...

Generated on Mon Jun 8 2020 15:34:39 for gem5 by doxygen 1.8.13