# Linux Kernel Module Cheat

##### 24.3.3.3. gem5 DRAM setup

This can be explored pretty well from gem5 config.ini.

se.py just has a single `DDR3_1600_8x8` DRAM with size given as Memory size and physical address starting at 0.

fs.py also has that `DDR3_1600_8x8` DRAM, but can have more memory types. Notably, aarch64 has as shown on RealView.py `VExpress_GEM5_Base`:

    0x00000000-0x03ffffff: (  0     -  64 MiB) Boot memory (CS0)
    0x04000000-0x07ffffff: ( 64 MiB - 128 MiB) Reserved
    0x08000000-0x0bffffff: (128 MiB - 192 MiB) NOR FLASH0 (CS0 alias)
    0x0c000000-0x0fffffff: (192 MiB - 256 MiB) NOR FLASH1 (Off-chip, CS4)
    0x80000000-XxXXXXXXXX: (  2 GiB -        ) DRAM

We place the entry point of our baremetal executables right at the start of DRAM with our Baremetal linker script.

This can be seen indirectly with:

    ./getvar --arch aarch64 --emulator gem5 entry_address

which gives 0x80000000 in decimal, or more directly with some some gem5 tracing:

    ./run \
      --arch aarch64 \
      --baremetal baremetal/arch/aarch64/no_bootloader/exit.S \
      --emulator gem5 \
      --trace ExecAll,-ExecSymbol \
      --trace-stdout \
    ;

and we see that the first instruction runs at 0x80000000:

          0: system.cpu: A0 T0 : 0x80000000

TODO: what are the boot memory and NOR FLASH used for?