gem5  v22.1.0.0
process.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2003-2004 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 __SPARC_PROCESS_HH__
30 #define __SPARC_PROCESS_HH__
31 
32 #include <memory>
33 #include <string>
34 #include <vector>
35 
36 #include "arch/sparc/page_size.hh"
38 #include "mem/page_table.hh"
39 #include "sim/process.hh"
40 
41 namespace gem5
42 {
43 
44 class SparcProcess : public Process
45 {
46  protected:
47 
48  const Addr StackBias;
49 
50  // The locations of the fill and spill handlers
52 
53  SparcProcess(const ProcessParams &params, loader::ObjectFile *objFile,
54  Addr _StackBias);
55 
56  void initState() override;
57 
58  template<class IntType>
59  void argsInit(int pageSize);
60 
61  public:
62 
65 };
66 
68 {
69  protected:
70 
71  void initState() override;
72 
73  public:
74 
77  {
78  Addr brk_point = image.maxAddr();
79  brk_point = roundUp(brk_point, SparcISA::PageBytes);
80 
81  // Reserve 8M for main stack.
82  Addr max_stack_size = 8 * 1024 * 1024;
83 
84  // Set up stack. On SPARC Linux, stack goes from the top of memory
85  // downward, less the hole for the kernel address space.
86  Addr stack_base = 0xf0000000ULL;
87 
88  // Set pointer for next thread stack.
89  Addr next_thread_stack_base = stack_base - max_stack_size;
90 
91  // Set up region for mmaps.
92  Addr mmap_end = 0x70000000;
93 
94  memState = std::make_shared<MemState>(this, brk_point, stack_base,
95  max_stack_size,
96  next_thread_stack_base,
97  mmap_end);
98  }
99 
100  void argsInit(int intSize, int pageSize);
101 };
102 
104 {
105  protected:
106  void initState() override;
107 
108  public:
109 
111  : SparcProcess(params, objFile, 2047)
112  {
113  Addr brk_point = image.maxAddr();
114  brk_point = roundUp(brk_point, SparcISA::PageBytes);
115 
116  Addr max_stack_size = 8 * 1024 * 1024;
117 
118  // Set up stack. On SPARC Linux, stack goes from the top of memory
119  // downward, less the hole for the kernel address space.
120  Addr stack_base = 0x80000000000ULL;
121 
122  // Set pointer for next thread stack. Reserve 8M for main stack.
123  Addr next_thread_stack_base = stack_base - max_stack_size;
124 
125  // Set up region for mmaps.
126  Addr mmap_end = 0xfffff80000000000ULL;
127 
128  memState = std::make_shared<MemState>(this, brk_point, stack_base,
129  max_stack_size,
130  next_thread_stack_base,
131  mmap_end);
132  }
133 
134  void argsInit(int intSize, int pageSize);
135 };
136 
137 } // namespace gem5
138 
139 #endif // __SPARC_PROCESS_HH__
loader::MemoryImage image
Definition: process.hh:225
std::shared_ptr< MemState > memState
Definition: process.hh:290
loader::ObjectFile * objFile
Definition: process.hh:224
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:116
void argsInit(int intSize, int pageSize)
Definition: process.cc:388
Sparc32Process(const ProcessParams &params, loader::ObjectFile *objFile)
Definition: process.hh:75
Sparc64Process(const ProcessParams &params, loader::ObjectFile *objFile)
Definition: process.hh:110
void argsInit(int intSize, int pageSize)
Definition: process.cc:376
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:132
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:69
Addr readSpillStart()
Definition: process.hh:64
void argsInit(int pageSize)
Definition: process.cc:148
SparcProcess(const ProcessParams &params, loader::ObjectFile *objFile, Addr _StackBias)
Definition: process.cc:55
Addr readFillStart()
Definition: process.hh:63
const Addr StackBias
Definition: process.hh:48
static constexpr T roundUp(const T &val, const U &align)
This function is used to align addresses in memory.
Definition: intmath.hh:260
const Params & params() const
Definition: sim_object.hh:176
const Addr PageBytes
Definition: page_size.hh:41
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
Declarations of a non-full system Page Table.

Generated on Wed Dec 21 2022 10:22:26 for gem5 by doxygen 1.9.1