# Linux Kernel Module Cheat

### 24.17. gem5 CPU types

gem5 has a few in tree CPU models for different purposes.

In fs.py and se.py, those are selectable with the `--cpu-type` option.

The information to make highly accurate models isn’t generally public for non-free CPUs, so either you must either rely vendor provided models or on experiments/reverse engineering.

There is no simple answer for "what is the best CPU", in theory you have to understand each model and decide which one is closer your target system.

Whenever possible, stick to:

- vendor provide ones obviously, e.g. ARM Holdings models of ARM cores, unless there is good reason not to, as they are the most likely to be accurate

- newer models instead of older models

Both of those can be checked with `git log` and `git blame`.

All CPU types inherit from the `BaseCPU` class, and looking at the class hierarchy in Eclipse gives a good overview of what we have:

- `BaseCPU`

  - `BaseKvmCPU`

  - `BaseSimpleCPU`: gem5 `BaseSimpleCPU`

    - `AtomicSimpleCPU`

    - `TimingSimpleCPU`

  - `MinorO3CPU`: gem5 MinorCPU

  - `BaseO3CPU`

    - `FullO3CPU`

      - `DerivO3CPU : public FullO3CPU<O3CPUImpl>`: gem5 `DerivO3CPU`

From this we see that there are basically only 4 C++ CPU models in gem5: Atomic, Timing, Minor and O3. All others are basically parametrizations of those base types.

- List of gem5 CPU types

- gem5 ARM RSK