gem5  v21.1.0.2
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__
gem5::SparcProcess::readFillStart
Addr readFillStart()
Definition: process.hh:63
gem5::loader::MemoryImage::maxAddr
Addr maxAddr() const
Definition: memory_image.hh:136
gem5::loader::ObjectFile
Definition: object_file.hh:85
gem5::SparcProcess::SparcProcess
SparcProcess(const ProcessParams &params, loader::ObjectFile *objFile, Addr _StackBias)
Definition: process.cc:55
gem5::Process::memState
std::shared_ptr< MemState > memState
Definition: process.hh:276
gem5::SparcProcess::fillStart
Addr fillStart
Definition: process.hh:51
gem5::SparcProcess
Definition: process.hh:44
gem5::SimObject::params
const Params & params() const
Definition: sim_object.hh:176
gem5::Sparc32Process::argsInit
void argsInit(int intSize, int pageSize)
Definition: process.cc:383
gem5::Sparc64Process::argsInit
void argsInit(int intSize, int pageSize)
Definition: process.cc:371
gem5::SparcProcess::argsInit
void argsInit(int pageSize)
Definition: process.cc:143
process.hh
gem5::SparcProcess::readSpillStart
Addr readSpillStart()
Definition: process.hh:64
gem5::Sparc32Process::initState
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:113
gem5::Sparc32Process
Definition: process.hh:67
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::Sparc64Process::Sparc64Process
Sparc64Process(const ProcessParams &params, loader::ObjectFile *objFile)
Definition: process.hh:110
gem5::SparcProcess::spillStart
Addr spillStart
Definition: process.hh:51
gem5::Process
Definition: process.hh:67
page_size.hh
gem5::SparcISA::PageBytes
const Addr PageBytes
Definition: page_size.hh:41
gem5::SparcProcess::initState
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:69
gem5::roundUp
static constexpr T roundUp(const T &val, const U &align)
This function is used to align addresses in memory.
Definition: intmath.hh:260
gem5::SparcProcess::StackBias
const Addr StackBias
Definition: process.hh:48
gem5::Sparc64Process
Definition: process.hh:103
page_table.hh
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
object_file.hh
gem5::Sparc32Process::Sparc32Process
Sparc32Process(const ProcessParams &params, loader::ObjectFile *objFile)
Definition: process.hh:75
gem5::Process::image
loader::MemoryImage image
Definition: process.hh:211
gem5::Process::objFile
loader::ObjectFile * objFile
Definition: process.hh:210
gem5::Sparc64Process::initState
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:128

Generated on Tue Sep 21 2021 12:24:36 for gem5 by doxygen 1.8.17