diff --git a/index.html b/index.html index e882eed..b387ba5 100644 --- a/index.html +++ b/index.html @@ -1191,33 +1191,35 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
  • 19.18. gem5 ARM platforms
  • -
  • 19.19. gem5 internals +
  • 19.19. gem5 upstream images
  • +
  • 19.20. gem5 internals
  • +
  • 19.21. gem5 bootloaders
  • 20. Buildroot @@ -20378,7 +20380,61 @@ Indirect leak of 1346 byte(s) in 2 object(s) allocated from:
    -

    19.19. gem5 internals

    +

    19.19. gem5 upstream images

    +
    +

    Present at:

    +
    + +
    +

    Depending on which archive you download from there, you can find some of:

    +
    +
    +
      +
    • +

      Ubuntu based images

      +
    • +
    • +

      precompiled Linux kernels, with the gem5 arm Linux kernel patches for arm

      +
    • +
    • +

      precompiled gem5 bootloaders for ISAs that have them, e.g. ARM

      +
    • +
    • +

      precompiled DTBs if you don’t want to use autogeneration for some crazy reason

      +
    • +
    +
    +
    +

    Some of those images are also used on the gem5 unit tests continuous integration.

    +
    +
    +

    Could be used as an alternative to this repository. But why would you do that? :-)

    +
    +
    +

    E.g. to use a precompiled ARM kernel:

    +
    +
    +
    +
    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
    +
    +
    +
    +
    +

    19.20. gem5 internals

    Internals under other sections:

    @@ -20396,7 +20452,7 @@ Indirect leak of 1346 byte(s) in 2 object(s) allocated from:
    -

    19.19.1. gem5 Eclipse configuration

    +

    19.20.1. gem5 Eclipse configuration

    In order to develop complex C++ software such as gem5, a good IDE setup is fundamental.

    @@ -20434,7 +20490,7 @@ Indirect leak of 1346 byte(s) in 2 object(s) allocated from:
    -

    19.19.2. gem5 Python C++ interaction

    +

    19.20.2. gem5 Python C++ interaction

    The interaction uses the Python C extension interface https://docs.python.org/2/extending/extending.html interface through the pybind11 helper library: https://github.com/pybind/pybind11

    @@ -20600,7 +20656,7 @@ static EmbeddedPyBind embed_obj("BadDevice", module_init, "BasicPioDevice");
    -

    19.19.3. gem5 entry point

    +

    19.20.3. gem5 entry point

    The main is at: src/sim/main.cc. It calls:

    @@ -20689,7 +20745,7 @@ exec filecode in scope
    -

    19.19.4. gem5 event queue

    +

    19.20.4. gem5 event queue

    gem5 is an event based simulator, and as such the event queue is of of the crucial elements in the system.

    @@ -20749,7 +20805,7 @@ exec filecode in scope

    This calls the Event::process method of the event.

    -
    19.19.4.1. gem5 event queue AtomicSimpleCPU syscall emulation freestanding example analysis
    +
    19.20.4.1. gem5 event queue AtomicSimpleCPU syscall emulation freestanding example analysis

    Let’s now analyze every single event on a minimal gem5 syscall emulation mode in the simplest CPU that we have:

    @@ -20940,7 +20996,7 @@ AtomicSimpleCPU::tick() at atomic.cc:757 0x55555907834c
    -
    19.19.4.2. gem5 event queue TimingSimpleCPU syscall emulation freestanding example analysis
    +
    19.20.4.2. gem5 event queue TimingSimpleCPU syscall emulation freestanding example analysis

    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.

    @@ -21347,7 +21403,7 @@ TimingSimpleCPU::IcachePort::ITickEvent::process()
    -
    19.19.4.3. 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

    Let’s just add --caches to see if things go any faster:

    @@ -21386,7 +21442,7 @@ info: Entering event queue @ 0. Starting simulation...
    -
    19.19.4.4. gem5 event queue MinorCPU syscall emulation freestanding example analysis
    +
    19.20.4.4. gem5 event queue MinorCPU syscall emulation freestanding example analysis

    The events for the Atomic CPU were pretty simple: basically just ticks.

    @@ -21413,7 +21469,7 @@ info: Entering event queue @ 0. Starting simulation...
    -

    19.19.5. gem5 stats internals

    +

    19.20.5. gem5 stats internals

    This describes the internals of the gem5 m5out/stats.txt file.

    @@ -21486,7 +21542,7 @@ Text::end()
    -

    19.19.6. gem5 code generation

    +

    19.20.6. gem5 code generation

    gem5 uses a ton of code generation, which makes the project horrendous:

    @@ -21531,7 +21587,7 @@ Text::end()

    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.

    -
    19.19.6.1. gem5 THE_ISA
    +
    19.20.6.1. gem5 THE_ISA

    Generated code at: build/<ISA>/config/the_isa.hh which contains amongst other lines:

    @@ -21558,9 +21614,9 @@ enum class Arch {
    -

    19.19.7. gem5 build system

    +

    19.20.7. gem5 build system

    -
    19.19.7.1. gem5 polymorphic ISA includes
    +
    19.20.7.1. gem5 polymorphic ISA includes

    E.g. src/cpu/decode_cache.hh includes:

    @@ -21639,7 +21695,7 @@ build/ARM/config/the_isa.hh
    -
    19.19.7.2. Why are all C++ symlinked into the gem5 build dir?
    +
    19.20.7.2. Why are all C++ symlinked into the gem5 build dir?

    Some scons madness.

    @@ -21668,6 +21724,33 @@ build/ARM/config/the_isa.hh
    +
    +

    19.21. gem5 bootloaders

    +
    +

    Certain ISAs like ARM have bootloaders that are automatically run before the main image to setup basic system state.

    +
    +
    +

    We cross compile those bootloaders from source automatically during ./build-gem5.

    +
    +
    +

    As of gem5 bcf041f257623e5c9e77d35b7531bae59edc0423, the source code of the bootloaderes can be found under:

    +
    +
    +
    +
    system/arm/
    +
    +
    +
    +

    and their selection can be seen under: src/dev/arm/RealView.py, e.g.:

    +
    +
    +
    +
        def setupBootLoader(self, cur_sys, loc):
    +        if not cur_sys.boot_loader:
    +            cur_sys.boot_loader = [ loc('boot_emm.arm64'), loc('boot_emm.arm') ]
    +
    +
    +