gem5  v21.1.0.2
kernel_workload.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Google Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met: redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer;
8  * redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution;
11  * neither the name of the copyright holders nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef __SIM_KERNEL_WORKLOAD_HH__
29 #define __SIM_KERNEL_WORKLOAD_HH__
30 
31 #include <string>
32 #include <vector>
33 
35 #include "base/loader/symtab.hh"
36 #include "base/types.hh"
37 #include "params/KernelWorkload.hh"
38 #include "sim/workload.hh"
39 
40 namespace gem5
41 {
42 
43 class System;
44 
45 class KernelWorkload : public Workload
46 {
47  protected:
49 
57 
64 
66 
68 
70  // Keep a separate copy of the kernel's symbol table so we can add things
71  // to it.
73 
74  const std::string commandLine;
75 
76  public:
78 
79  Addr start() const { return _start; }
80  Addr end() const { return _end; }
81  Addr loadAddrMask() const { return _loadAddrMask; }
82  Addr loadAddrOffset() const { return _loadAddrOffset; }
83 
84  KernelWorkload(const Params &p);
85 
86  Addr getEntry() const override { return kernelObj->entryPoint(); }
88  getArch() const override
89  {
90  return kernelObj->getArch();
91  }
92 
93  const loader::SymbolTable &
94  symtab(ThreadContext *tc) override
95  {
96  return kernelSymtab;
97  }
98 
99  bool
100  insertSymbol(const loader::Symbol &symbol) override
101  {
102  return kernelSymtab.insert(symbol);
103  }
104 
105  void initState() override;
106 
107  void serialize(CheckpointOut &cp) const override;
108  void unserialize(CheckpointIn &cp) override;
109 
125  template <class T, typename... Args>
126  T *
127  addKernelFuncEvent(const char *lbl, Args... args)
128  {
129  return addFuncEvent<T>(kernelSymtab, lbl, std::forward<Args>(args)...);
130  }
131 
132  template <class T, typename... Args>
133  T *
134  addKernelFuncEventOrPanic(const char *lbl, Args... args)
135  {
136  T *e = addFuncEvent<T>(kernelSymtab, lbl, std::forward<Args>(args)...);
137  panic_if(!e, "Failed to find kernel symbol '%s'", lbl);
138  return e;
139  }
141 };
142 
143 } // namespace gem5
144 
145 #endif // __SIM_KERNEL_WORKLOAD_HH__
gem5::KernelWorkload::KernelWorkload
KernelWorkload(const Params &p)
Definition: kernel_workload.cc:37
gem5::KernelWorkload::_loadAddrMask
Addr _loadAddrMask
Mask that should be anded for binary/symbol loading.
Definition: kernel_workload.hh:56
gem5::KernelWorkload::_start
Addr _start
Definition: kernel_workload.hh:65
gem5::loader::ObjectFile
Definition: object_file.hh:85
gem5::KernelWorkload::_end
Addr _end
Definition: kernel_workload.hh:65
gem5::loader::ObjectFile::entryPoint
Addr entryPoint() const
Definition: object_file.hh:125
gem5::KernelWorkload::commandLine
const std::string commandLine
Definition: kernel_workload.hh:74
gem5::CheckpointIn
Definition: serialize.hh:68
gem5::KernelWorkload::start
Addr start() const
Definition: kernel_workload.hh:79
gem5::ArmISA::e
Bitfield< 9 > e
Definition: misc_types.hh:64
gem5::KernelWorkload::end
Addr end() const
Definition: kernel_workload.hh:80
gem5::loader::SymbolTable
Definition: symtab.hh:65
std::vector
STL vector class.
Definition: stl.hh:37
gem5::KernelWorkload::insertSymbol
bool insertSymbol(const loader::Symbol &symbol) override
Definition: kernel_workload.hh:100
workload.hh
gem5::KernelWorkload::kernelObj
loader::ObjectFile * kernelObj
Definition: kernel_workload.hh:69
gem5::KernelWorkload::getArch
loader::Arch getArch() const override
Definition: kernel_workload.hh:88
gem5::KernelWorkload
Definition: kernel_workload.hh:45
gem5::SimObject::Params
SimObjectParams Params
Definition: sim_object.hh:170
gem5::KernelWorkload::PARAMS
PARAMS(KernelWorkload)
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:93
gem5::KernelWorkload::loadAddrMask
Addr loadAddrMask() const
Definition: kernel_workload.hh:81
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::loader::MemoryImage
Definition: memory_image.hh:53
gem5::KernelWorkload::addKernelFuncEvent
T * addKernelFuncEvent(const char *lbl, Args... args)
Add a function-based event to a kernel symbol.
Definition: kernel_workload.hh:127
gem5::Workload
Definition: workload.hh:47
gem5::loader::Arch
Arch
Definition: object_file.hh:50
gem5::loader::ObjectFile::getArch
Arch getArch() const
Definition: object_file.hh:115
gem5::KernelWorkload::kernelSymtab
loader::SymbolTable kernelSymtab
Definition: kernel_workload.hh:72
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::KernelWorkload::getEntry
Addr getEntry() const override
Definition: kernel_workload.hh:86
panic_if
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition: logging.hh:203
gem5::loader::SymbolTable::insert
bool insert(const Symbol &symbol)
Insert a new symbol in the table if it does not already exist.
Definition: symtab.cc:55
gem5::KernelWorkload::addKernelFuncEventOrPanic
T * addKernelFuncEventOrPanic(const char *lbl, Args... args)
Definition: kernel_workload.hh:134
types.hh
gem5::KernelWorkload::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: kernel_workload.cc:144
gem5::KernelWorkload::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: kernel_workload.cc:138
gem5::loader::Symbol
Definition: symtab.hh:51
gem5::KernelWorkload::symtab
const loader::SymbolTable & symtab(ThreadContext *tc) override
Definition: kernel_workload.hh:94
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
symtab.hh
gem5::KernelWorkload::extras
std::vector< loader::ObjectFile * > extras
Definition: kernel_workload.hh:67
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::KernelWorkload::image
loader::MemoryImage image
Definition: kernel_workload.hh:48
object_file.hh
gem5::KernelWorkload::_loadAddrOffset
Addr _loadAddrOffset
Offset that should be used for binary/symbol loading.
Definition: kernel_workload.hh:63
gem5::KernelWorkload::loadAddrOffset
Addr loadAddrOffset() const
Definition: kernel_workload.hh:82
gem5::KernelWorkload::initState
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: kernel_workload.cc:96

Generated on Tue Sep 21 2021 12:25:48 for gem5 by doxygen 1.8.17