mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-24 18:51:36 +01:00
This commit is contained in:
143
index.html
143
index.html
@@ -1191,33 +1191,35 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#gem5-arm-platforms">19.18. gem5 ARM platforms</a></li>
|
||||
<li><a href="#gem5-internals">19.19. gem5 internals</a>
|
||||
<li><a href="#gem5-upstream-images">19.19. gem5 upstream images</a></li>
|
||||
<li><a href="#gem5-internals">19.20. gem5 internals</a>
|
||||
<ul class="sectlevel3">
|
||||
<li><a href="#gem5-eclipse-configuration">19.19.1. gem5 Eclipse configuration</a></li>
|
||||
<li><a href="#gem5-python-c-interaction">19.19.2. gem5 Python C++ interaction</a></li>
|
||||
<li><a href="#gem5-entry-point">19.19.3. gem5 entry point</a></li>
|
||||
<li><a href="#gem5-event-queue">19.19.4. gem5 event queue</a>
|
||||
<li><a href="#gem5-eclipse-configuration">19.20.1. gem5 Eclipse configuration</a></li>
|
||||
<li><a href="#gem5-python-c-interaction">19.20.2. gem5 Python C++ interaction</a></li>
|
||||
<li><a href="#gem5-entry-point">19.20.3. gem5 entry point</a></li>
|
||||
<li><a href="#gem5-event-queue">19.20.4. gem5 event queue</a>
|
||||
<ul class="sectlevel4">
|
||||
<li><a href="#gem5-event-queue-atomicsimplecpu-syscall-emulation-freestanding-example-analysis">19.19.4.1. gem5 event queue AtomicSimpleCPU syscall emulation freestanding example analysis</a></li>
|
||||
<li><a href="#gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis">19.19.4.2. gem5 event queue TimingSimpleCPU syscall emulation freestanding example analysis</a></li>
|
||||
<li><a href="#gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis-with-caches">19.19.4.3. gem5 event queue TimingSimpleCPU syscall emulation freestanding example analysis with caches</a></li>
|
||||
<li><a href="#gem5-event-queue-minorcpu-syscall-emulation-freestanding-example-analysis">19.19.4.4. gem5 event queue MinorCPU syscall emulation freestanding example analysis</a></li>
|
||||
<li><a href="#gem5-event-queue-atomicsimplecpu-syscall-emulation-freestanding-example-analysis">19.20.4.1. gem5 event queue AtomicSimpleCPU syscall emulation freestanding example analysis</a></li>
|
||||
<li><a href="#gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis">19.20.4.2. gem5 event queue TimingSimpleCPU syscall emulation freestanding example analysis</a></li>
|
||||
<li><a href="#gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis-with-caches">19.20.4.3. gem5 event queue TimingSimpleCPU syscall emulation freestanding example analysis with caches</a></li>
|
||||
<li><a href="#gem5-event-queue-minorcpu-syscall-emulation-freestanding-example-analysis">19.20.4.4. gem5 event queue MinorCPU syscall emulation freestanding example analysis</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#gem5-stats-internals">19.19.5. gem5 stats internals</a></li>
|
||||
<li><a href="#gem5-code-generation">19.19.6. gem5 code generation</a>
|
||||
<li><a href="#gem5-stats-internals">19.20.5. gem5 stats internals</a></li>
|
||||
<li><a href="#gem5-code-generation">19.20.6. gem5 code generation</a>
|
||||
<ul class="sectlevel4">
|
||||
<li><a href="#gem5-the-isa">19.19.6.1. gem5 THE_ISA</a></li>
|
||||
<li><a href="#gem5-the-isa">19.20.6.1. gem5 THE_ISA</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#gem5-build-system">19.19.7. gem5 build system</a>
|
||||
<li><a href="#gem5-build-system">19.20.7. gem5 build system</a>
|
||||
<ul class="sectlevel4">
|
||||
<li><a href="#gem5-polymorphic-isa-includes">19.19.7.1. gem5 polymorphic ISA includes</a></li>
|
||||
<li><a href="#why-are-all-c-symlinked-into-the-gem5-build-dir">19.19.7.2. Why are all C++ symlinked into the gem5 build dir?</a></li>
|
||||
<li><a href="#gem5-polymorphic-isa-includes">19.20.7.1. gem5 polymorphic ISA includes</a></li>
|
||||
<li><a href="#why-are-all-c-symlinked-into-the-gem5-build-dir">19.20.7.2. Why are all C++ symlinked into the gem5 build dir?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#gem5-bootloaders">19.21. gem5 bootloaders</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#buildroot">20. Buildroot</a>
|
||||
@@ -20378,7 +20380,61 @@ Indirect leak of 1346 byte(s) in 2 object(s) allocated from:
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="gem5-internals"><a class="anchor" href="#gem5-internals"></a><a class="link" href="#gem5-internals">19.19. gem5 internals</a></h3>
|
||||
<h3 id="gem5-upstream-images"><a class="anchor" href="#gem5-upstream-images"></a><a class="link" href="#gem5-upstream-images">19.19. gem5 upstream images</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>Present at:</p>
|
||||
</div>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p><a href="http://www.gem5.org/dist/current/arm/" class="bare">http://www.gem5.org/dist/current/arm/</a></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><a href="http://www.gem5.org/dist/current/x86/" class="bare">http://www.gem5.org/dist/current/x86/</a></p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Depending on which archive you download from there, you can find some of:</p>
|
||||
</div>
|
||||
<div class="ulist">
|
||||
<ul>
|
||||
<li>
|
||||
<p>Ubuntu based images</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>precompiled Linux kernels, with the <a href="#gem5-arm-linux-kernel-patches">gem5 arm Linux kernel patches</a> for arm</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>precompiled <a href="#gem5-bootloaders">gem5 bootloaders</a> for ISAs that have them, e.g. ARM</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>precompiled DTBs if you don’t want to use autogeneration for some crazy reason</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Some of those images are also used on the <a href="#gem5-unit-tests">gem5 unit tests</a> continuous integration.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>Could be used as an alternative to this repository. But why would you do that? :-)</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>E.g. to use a precompiled ARM kernel:</p>
|
||||
</div>
|
||||
<div class="literalblock">
|
||||
<div class="content">
|
||||
<pre>mkdir aarch-system-201901106
|
||||
cd aarch-system-201901106
|
||||
wget http://www.gem5.org/dist/current/arm/aarch-system-201901106.tar.bz2
|
||||
tar xvf aarch-system-201901106.tar.bz2
|
||||
cd ..
|
||||
./run --arch aarch64 --emulator gem5 --linux-exec aarch-system-201901106/binaries/vmlinux.arm64</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="gem5-internals"><a class="anchor" href="#gem5-internals"></a><a class="link" href="#gem5-internals">19.20. gem5 internals</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>Internals under other sections:</p>
|
||||
</div>
|
||||
@@ -20396,7 +20452,7 @@ Indirect leak of 1346 byte(s) in 2 object(s) allocated from:
|
||||
</ul>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="gem5-eclipse-configuration"><a class="anchor" href="#gem5-eclipse-configuration"></a><a class="link" href="#gem5-eclipse-configuration">19.19.1. gem5 Eclipse configuration</a></h4>
|
||||
<h4 id="gem5-eclipse-configuration"><a class="anchor" href="#gem5-eclipse-configuration"></a><a class="link" href="#gem5-eclipse-configuration">19.20.1. gem5 Eclipse configuration</a></h4>
|
||||
<div class="paragraph">
|
||||
<p>In order to develop complex C++ software such as gem5, a good IDE setup is fundamental.</p>
|
||||
</div>
|
||||
@@ -20434,7 +20490,7 @@ Indirect leak of 1346 byte(s) in 2 object(s) allocated from:
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="gem5-python-c-interaction"><a class="anchor" href="#gem5-python-c-interaction"></a><a class="link" href="#gem5-python-c-interaction">19.19.2. gem5 Python C++ interaction</a></h4>
|
||||
<h4 id="gem5-python-c-interaction"><a class="anchor" href="#gem5-python-c-interaction"></a><a class="link" href="#gem5-python-c-interaction">19.20.2. gem5 Python C++ interaction</a></h4>
|
||||
<div class="paragraph">
|
||||
<p>The interaction uses the Python C extension interface <a href="https://docs.python.org/2/extending/extending.html" class="bare">https://docs.python.org/2/extending/extending.html</a> interface through the pybind11 helper library: <a href="https://github.com/pybind/pybind11" class="bare">https://github.com/pybind/pybind11</a></p>
|
||||
</div>
|
||||
@@ -20600,7 +20656,7 @@ static EmbeddedPyBind embed_obj("BadDevice", module_init, "BasicPioDevice");</pr
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="gem5-entry-point"><a class="anchor" href="#gem5-entry-point"></a><a class="link" href="#gem5-entry-point">19.19.3. gem5 entry point</a></h4>
|
||||
<h4 id="gem5-entry-point"><a class="anchor" href="#gem5-entry-point"></a><a class="link" href="#gem5-entry-point">19.20.3. gem5 entry point</a></h4>
|
||||
<div class="paragraph">
|
||||
<p>The main is at: <code>src/sim/main.cc</code>. It calls:</p>
|
||||
</div>
|
||||
@@ -20689,7 +20745,7 @@ exec filecode in scope</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="gem5-event-queue"><a class="anchor" href="#gem5-event-queue"></a><a class="link" href="#gem5-event-queue">19.19.4. gem5 event queue</a></h4>
|
||||
<h4 id="gem5-event-queue"><a class="anchor" href="#gem5-event-queue"></a><a class="link" href="#gem5-event-queue">19.20.4. gem5 event queue</a></h4>
|
||||
<div class="paragraph">
|
||||
<p>gem5 is an event based simulator, and as such the event queue is of of the crucial elements in the system.</p>
|
||||
</div>
|
||||
@@ -20749,7 +20805,7 @@ exec filecode in scope</pre>
|
||||
<p>This calls the <code>Event::process</code> method of the event.</p>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="gem5-event-queue-atomicsimplecpu-syscall-emulation-freestanding-example-analysis"><a class="anchor" href="#gem5-event-queue-atomicsimplecpu-syscall-emulation-freestanding-example-analysis"></a><a class="link" href="#gem5-event-queue-atomicsimplecpu-syscall-emulation-freestanding-example-analysis">19.19.4.1. gem5 event queue AtomicSimpleCPU syscall emulation freestanding example analysis</a></h5>
|
||||
<h5 id="gem5-event-queue-atomicsimplecpu-syscall-emulation-freestanding-example-analysis"><a class="anchor" href="#gem5-event-queue-atomicsimplecpu-syscall-emulation-freestanding-example-analysis"></a><a class="link" href="#gem5-event-queue-atomicsimplecpu-syscall-emulation-freestanding-example-analysis">19.20.4.1. gem5 event queue AtomicSimpleCPU syscall emulation freestanding example analysis</a></h5>
|
||||
<div class="paragraph">
|
||||
<p>Let’s now analyze every single event on a minimal <a href="#gem5-syscall-emulation-mode">gem5 syscall emulation mode</a> in the <a href="#gem5-cpu-types">simplest CPU that we have</a>:</p>
|
||||
</div>
|
||||
@@ -20940,7 +20996,7 @@ AtomicSimpleCPU::tick() at atomic.cc:757 0x55555907834c</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis"><a class="anchor" href="#gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis"></a><a class="link" href="#gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis">19.19.4.2. gem5 event queue TimingSimpleCPU syscall emulation freestanding example analysis</a></h5>
|
||||
<h5 id="gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis"><a class="anchor" href="#gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis"></a><a class="link" href="#gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis">19.20.4.2. gem5 event queue TimingSimpleCPU syscall emulation freestanding example analysis</a></h5>
|
||||
<div class="paragraph">
|
||||
<p>TODO: analyze better what each of the memory event mean. For now, we have just collected a bunch of data there, but needs interpreting. The CPU specifics in this section are already insightful however.</p>
|
||||
</div>
|
||||
@@ -21347,7 +21403,7 @@ TimingSimpleCPU::IcachePort::ITickEvent::process()
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis-with-caches"><a class="anchor" href="#gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis-with-caches"></a><a class="link" href="#gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis-with-caches">19.19.4.3. gem5 event queue TimingSimpleCPU syscall emulation freestanding example analysis with caches</a></h5>
|
||||
<h5 id="gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis-with-caches"><a class="anchor" href="#gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis-with-caches"></a><a class="link" href="#gem5-event-queue-timingsimplecpu-syscall-emulation-freestanding-example-analysis-with-caches">19.20.4.3. gem5 event queue TimingSimpleCPU syscall emulation freestanding example analysis with caches</a></h5>
|
||||
<div class="paragraph">
|
||||
<p>Let’s just add --caches to see if things go any faster:</p>
|
||||
</div>
|
||||
@@ -21386,7 +21442,7 @@ info: Entering event queue @ 0. Starting simulation...
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="gem5-event-queue-minorcpu-syscall-emulation-freestanding-example-analysis"><a class="anchor" href="#gem5-event-queue-minorcpu-syscall-emulation-freestanding-example-analysis"></a><a class="link" href="#gem5-event-queue-minorcpu-syscall-emulation-freestanding-example-analysis">19.19.4.4. gem5 event queue MinorCPU syscall emulation freestanding example analysis</a></h5>
|
||||
<h5 id="gem5-event-queue-minorcpu-syscall-emulation-freestanding-example-analysis"><a class="anchor" href="#gem5-event-queue-minorcpu-syscall-emulation-freestanding-example-analysis"></a><a class="link" href="#gem5-event-queue-minorcpu-syscall-emulation-freestanding-example-analysis">19.20.4.4. gem5 event queue MinorCPU syscall emulation freestanding example analysis</a></h5>
|
||||
<div class="paragraph">
|
||||
<p>The events <a href="#gem5-event-queue-atomicsimplecpu-syscall-emulation-freestanding-example-analysis">for the Atomic CPU</a> were pretty simple: basically just ticks.</p>
|
||||
</div>
|
||||
@@ -21413,7 +21469,7 @@ info: Entering event queue @ 0. Starting simulation...
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="gem5-stats-internals"><a class="anchor" href="#gem5-stats-internals"></a><a class="link" href="#gem5-stats-internals">19.19.5. gem5 stats internals</a></h4>
|
||||
<h4 id="gem5-stats-internals"><a class="anchor" href="#gem5-stats-internals"></a><a class="link" href="#gem5-stats-internals">19.20.5. gem5 stats internals</a></h4>
|
||||
<div class="paragraph">
|
||||
<p>This describes the internals of the <a href="#gem5-m5out-stats-txt-file">gem5 m5out/stats.txt file</a>.</p>
|
||||
</div>
|
||||
@@ -21486,7 +21542,7 @@ Text::end()
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="gem5-code-generation"><a class="anchor" href="#gem5-code-generation"></a><a class="link" href="#gem5-code-generation">19.19.6. gem5 code generation</a></h4>
|
||||
<h4 id="gem5-code-generation"><a class="anchor" href="#gem5-code-generation"></a><a class="link" href="#gem5-code-generation">19.20.6. gem5 code generation</a></h4>
|
||||
<div class="paragraph">
|
||||
<p>gem5 uses a ton of code generation, which makes the project horrendous:</p>
|
||||
</div>
|
||||
@@ -21531,7 +21587,7 @@ Text::end()
|
||||
<p>But it has been widely overused to insanity. It likely also exists partly because when the project started in 2003 C++ compilers weren’t that good, so you couldn’t rely on features like templates that much.</p>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="gem5-the-isa"><a class="anchor" href="#gem5-the-isa"></a><a class="link" href="#gem5-the-isa">19.19.6.1. gem5 THE_ISA</a></h5>
|
||||
<h5 id="gem5-the-isa"><a class="anchor" href="#gem5-the-isa"></a><a class="link" href="#gem5-the-isa">19.20.6.1. gem5 THE_ISA</a></h5>
|
||||
<div class="paragraph">
|
||||
<p>Generated code at: <code>build/<ISA>/config/the_isa.hh</code> which contains amongst other lines:</p>
|
||||
</div>
|
||||
@@ -21558,9 +21614,9 @@ enum class Arch {
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="gem5-build-system"><a class="anchor" href="#gem5-build-system"></a><a class="link" href="#gem5-build-system">19.19.7. gem5 build system</a></h4>
|
||||
<h4 id="gem5-build-system"><a class="anchor" href="#gem5-build-system"></a><a class="link" href="#gem5-build-system">19.20.7. gem5 build system</a></h4>
|
||||
<div class="sect4">
|
||||
<h5 id="gem5-polymorphic-isa-includes"><a class="anchor" href="#gem5-polymorphic-isa-includes"></a><a class="link" href="#gem5-polymorphic-isa-includes">19.19.7.1. gem5 polymorphic ISA includes</a></h5>
|
||||
<h5 id="gem5-polymorphic-isa-includes"><a class="anchor" href="#gem5-polymorphic-isa-includes"></a><a class="link" href="#gem5-polymorphic-isa-includes">19.20.7.1. gem5 polymorphic ISA includes</a></h5>
|
||||
<div class="paragraph">
|
||||
<p>E.g. <code>src/cpu/decode_cache.hh</code> includes:</p>
|
||||
</div>
|
||||
@@ -21639,7 +21695,7 @@ build/ARM/config/the_isa.hh
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect4">
|
||||
<h5 id="why-are-all-c-symlinked-into-the-gem5-build-dir"><a class="anchor" href="#why-are-all-c-symlinked-into-the-gem5-build-dir"></a><a class="link" href="#why-are-all-c-symlinked-into-the-gem5-build-dir">19.19.7.2. Why are all C++ symlinked into the gem5 build dir?</a></h5>
|
||||
<h5 id="why-are-all-c-symlinked-into-the-gem5-build-dir"><a class="anchor" href="#why-are-all-c-symlinked-into-the-gem5-build-dir"></a><a class="link" href="#why-are-all-c-symlinked-into-the-gem5-build-dir">19.20.7.2. Why are all C++ symlinked into the gem5 build dir?</a></h5>
|
||||
<div class="paragraph">
|
||||
<p>Some scons madness.</p>
|
||||
</div>
|
||||
@@ -21668,6 +21724,33 @@ build/ARM/config/the_isa.hh
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="gem5-bootloaders"><a class="anchor" href="#gem5-bootloaders"></a><a class="link" href="#gem5-bootloaders">19.21. gem5 bootloaders</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>Certain ISAs like ARM have bootloaders that are automatically run before the main image to setup basic system state.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>We cross compile those bootloaders from source automatically during <code>./build-gem5</code>.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>As of gem5 bcf041f257623e5c9e77d35b7531bae59edc0423, the source code of the bootloaderes can be found under:</p>
|
||||
</div>
|
||||
<div class="literalblock">
|
||||
<div class="content">
|
||||
<pre>system/arm/</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>and their selection can be seen under: <code>src/dev/arm/RealView.py</code>, e.g.:</p>
|
||||
</div>
|
||||
<div class="literalblock">
|
||||
<div class="content">
|
||||
<pre> def setupBootLoader(self, cur_sys, loc):
|
||||
if not cur_sys.boot_loader:
|
||||
cur_sys.boot_loader = [ loc('boot_emm.arm64'), loc('boot_emm.arm') ]</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
|
||||
Reference in New Issue
Block a user