gem5  v22.1.0.0
fs_workload.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, 2012-2013, 2015-2019 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2002-2005 The Regents of The University of Michigan
15  * All rights reserved.
16  *
17  * Redistribution and use in source and binary forms, with or without
18  * modification, are permitted provided that the following conditions are
19  * met: redistributions of source code must retain the above copyright
20  * notice, this list of conditions and the following disclaimer;
21  * redistributions in binary form must reproduce the above copyright
22  * notice, this list of conditions and the following disclaimer in the
23  * documentation and/or other materials provided with the distribution;
24  * neither the name of the copyright holders nor the names of its
25  * contributors may be used to endorse or promote products derived from
26  * this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  */
40 
41 #ifndef __ARCH_ARM_FS_WORKLOAD_HH__
42 #define __ARCH_ARM_FS_WORKLOAD_HH__
43 
44 #include <memory>
45 #include <vector>
46 
47 #include "arch/arm/aapcs32.hh"
48 #include "arch/arm/aapcs64.hh"
49 #include "arch/arm/remote_gdb.hh"
50 #include "kern/linux/events.hh"
51 #include "params/ArmFsWorkload.hh"
52 #include "sim/kernel_workload.hh"
53 #include "sim/sim_object.hh"
54 
55 namespace gem5
56 {
57 
58 namespace ArmISA
59 {
60 
61 class SkipFunc : public SkipFuncBase
62 {
63  public:
65  void returnFromFuncIn(ThreadContext *tc) override;
66 };
67 
68 class FsWorkload : public KernelWorkload
69 {
70  protected:
73 
78 
85 
94 
95  template <template <class ABI, class Base> class FuncEvent,
96  typename... Args>
97  PCEvent *
98  addSkipFunc(Args... args)
99  {
100  if (getArch() == loader::Arm64) {
101  return addKernelFuncEvent<FuncEvent<Aapcs64, SkipFunc>>(
102  std::forward<Args>(args)...);
103  } else {
104  return addKernelFuncEvent<FuncEvent<Aapcs32, SkipFunc>>(
105  std::forward<Args>(args)...);
106  }
107  }
108 
109  template <template <class ABI, class Base> class FuncEvent,
110  typename... Args>
111  PCEvent *
112  addSkipFuncOrPanic(Args... args)
113  {
114  if (getArch() == loader::Arm64) {
115  return addKernelFuncEventOrPanic<FuncEvent<Aapcs64, SkipFunc>>(
116  std::forward<Args>(args)...);
117  } else {
118  return addKernelFuncEventOrPanic<FuncEvent<Aapcs32, SkipFunc>>(
119  std::forward<Args>(args)...);
120  }
121  }
122 
123  public:
124  PARAMS(ArmFsWorkload);
125 
126  Addr
127  getEntry() const override
128  {
129  if (bootldr)
130  return bootldr->entryPoint();
131  else
132  return kernelEntry;
133  }
134 
136  getArch() const override
137  {
138  if (bootldr)
139  return bootldr->getArch();
140  else if (kernelObj)
141  return kernelObj->getArch();
142  else
143  return loader::Arm64;
144  }
145 
146  ByteOrder byteOrder() const override { return ByteOrder::little; }
147 
148  FsWorkload(const Params &p);
149 
150  void initState() override;
151 
152  void
153  setSystem(System *sys) override
154  {
156  gdb = BaseRemoteGDB::build<RemoteGDB>(
157  params().remote_gdb_port, system);
158  }
159 
160  Addr
161  fixFuncEventAddr(Addr addr) const override
162  {
163  // Remove the low bit that thumb symbols have set
164  // but that aren't actually odd aligned
165  return addr & ~1;
166  }
167 };
168 
169 } // namespace ArmISA
170 } // namespace gem5
171 
172 #endif // __ARCH_ARM_FS_WORKLOAD_HH__
Addr fixFuncEventAddr(Addr addr) const override
Definition: fs_workload.hh:161
loader::ObjectFile * getBootLoader(loader::ObjectFile *const obj)
Get a boot loader that matches the kernel.
Definition: fs_workload.cc:148
PCEvent * addSkipFunc(Args... args)
Definition: fs_workload.hh:98
loader::ObjectFile * bootldr
Pointer to the bootloader object.
Definition: fs_workload.hh:77
Addr getEntry() const override
Definition: fs_workload.hh:127
void setSystem(System *sys) override
Definition: fs_workload.hh:153
loader::Arch getArch() const override
Definition: fs_workload.hh:136
ByteOrder byteOrder() const override
Definition: fs_workload.hh:146
std::vector< std::unique_ptr< loader::ObjectFile > > bootLoaders
Bootloaders.
Definition: fs_workload.hh:72
PCEvent * addSkipFuncOrPanic(Args... args)
Definition: fs_workload.hh:112
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: fs_workload.cc:101
Addr kernelEntry
This differs from entry since it takes into account where the kernel is loaded in memory (with loadAd...
Definition: fs_workload.hh:84
FsWorkload(const Params &p)
Definition: fs_workload.cc:75
void returnFromFuncIn(ThreadContext *tc) override
Definition: fs_workload.cc:58
loader::ObjectFile * kernelObj
SimObjectParams Params
Definition: sim_object.hh:170
SkipFuncBase(PCEventScope *s, const std::string &desc, Addr addr)
ThreadContext is the external interface to all thread state for anything outside of the CPU.
BaseRemoteGDB * gdb
Definition: workload.hh:76
virtual void setSystem(System *sys)
Definition: workload.hh:87
System * system
Definition: workload.hh:80
STL vector class.
Definition: stl.hh:37
const Params & params() const
Definition: sim_object.hh:176
Bitfield< 54 > p
Definition: pagetable.hh:70
Bitfield< 3 > addr
Definition: types.hh:84
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

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