gem5  v21.0.0.0
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) 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/isa_traits.hh"
38 #include "mem/page_table.hh"
39 #include "sim/process.hh"
40 
41 class SparcProcess : public Process
42 {
43  protected:
44 
45  const Addr StackBias;
46 
47  // The locations of the fill and spill handlers
49 
50  SparcProcess(const ProcessParams &params, ::Loader::ObjectFile *objFile,
51  Addr _StackBias);
52 
53  void initState() override;
54 
55  template<class IntType>
56  void argsInit(int pageSize);
57 
58  public:
59 
62 };
63 
65 {
66  protected:
67 
68  void initState() override;
69 
70  public:
71 
72  Sparc32Process(const ProcessParams &params, ::Loader::ObjectFile *objFile)
74  {
75  Addr brk_point = image.maxAddr();
76  brk_point = roundUp(brk_point, SparcISA::PageBytes);
77 
78  // Reserve 8M for main stack.
79  Addr max_stack_size = 8 * 1024 * 1024;
80 
81  // Set up stack. On SPARC Linux, stack goes from the top of memory
82  // downward, less the hole for the kernel address space.
83  Addr stack_base = 0xf0000000ULL;
84 
85  // Set pointer for next thread stack.
86  Addr next_thread_stack_base = stack_base - max_stack_size;
87 
88  // Set up region for mmaps.
89  Addr mmap_end = 0x70000000;
90 
91  memState = std::make_shared<MemState>(this, brk_point, stack_base,
92  max_stack_size,
93  next_thread_stack_base,
94  mmap_end);
95  }
96 
97  void argsInit(int intSize, int pageSize);
98 };
99 
101 {
102  protected:
103  void initState() override;
104 
105  public:
106 
108  : SparcProcess(params, objFile, 2047)
109  {
110  Addr brk_point = image.maxAddr();
111  brk_point = roundUp(brk_point, SparcISA::PageBytes);
112 
113  Addr max_stack_size = 8 * 1024 * 1024;
114 
115  // Set up stack. On SPARC Linux, stack goes from the top of memory
116  // downward, less the hole for the kernel address space.
117  Addr stack_base = 0x80000000000ULL;
118 
119  // Set pointer for next thread stack. Reserve 8M for main stack.
120  Addr next_thread_stack_base = stack_base - max_stack_size;
121 
122  // Set up region for mmaps.
123  Addr mmap_end = 0xfffff80000000000ULL;
124 
125  memState = std::make_shared<MemState>(this, brk_point, stack_base,
126  max_stack_size,
127  next_thread_stack_base,
128  mmap_end);
129  }
130 
131  void argsInit(int intSize, int pageSize);
132 };
133 
134 #endif // __SPARC_PROCESS_HH__
SparcProcess::readFillStart
Addr readFillStart()
Definition: process.hh:60
Sparc64Process::Sparc64Process
Sparc64Process(const ProcessParams &params, ::Loader::ObjectFile *objFile)
Definition: process.hh:107
Process
Definition: process.hh:65
Sparc64Process::initState
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:123
Sparc32Process::Sparc32Process
Sparc32Process(const ProcessParams &params, ::Loader::ObjectFile *objFile)
Definition: process.hh:72
Loader::MemoryImage::maxAddr
Addr maxAddr() const
Definition: memory_image.hh:131
SparcProcess
Definition: process.hh:41
SparcProcess::StackBias
const Addr StackBias
Definition: process.hh:45
SparcISA::PageBytes
const Addr PageBytes
Definition: isa_traits.hh:41
Loader::ObjectFile
Definition: object_file.hh:74
SparcProcess::spillStart
Addr spillStart
Definition: process.hh:48
SparcProcess::initState
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:64
isa_traits.hh
process.hh
SparcProcess::readSpillStart
Addr readSpillStart()
Definition: process.hh:61
Process::image
::Loader::MemoryImage image
Definition: process.hh:209
SparcProcess::fillStart
Addr fillStart
Definition: process.hh:48
Sparc64Process::argsInit
void argsInit(int intSize, int pageSize)
Definition: process.cc:368
Sparc64Process
Definition: process.hh:100
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:148
Process::objFile
::Loader::ObjectFile * objFile
Definition: process.hh:208
Sparc32Process::argsInit
void argsInit(int intSize, int pageSize)
Definition: process.cc:380
SparcProcess::argsInit
void argsInit(int pageSize)
Definition: process.cc:138
SparcProcess::SparcProcess
SparcProcess(const ProcessParams &params, ::Loader::ObjectFile *objFile, Addr _StackBias)
Definition: process.cc:50
roundUp
T roundUp(const T &val, const U &align)
This function is used to align addresses in memory.
Definition: intmath.hh:131
Sparc32Process::initState
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:108
SimObject::params
const Params & params() const
Definition: sim_object.hh:168
page_table.hh
object_file.hh
Sparc32Process
Definition: process.hh:64
ULL
#define ULL(N)
uint64_t constant
Definition: types.hh:46
Process::memState
std::shared_ptr< MemState > memState
Definition: process.hh:274

Generated on Tue Mar 23 2021 19:41:20 for gem5 by doxygen 1.8.17