🍗 Wiki

CPU

Central Processing Unit

CPU: Central Processing Unit

Of course, I don’t want to write what is CPUs and which kind of CPUs are

But I’d like to write some details about how the CPUs work, and do manually write a code of simple virtual CPU and program the CPU can run to explain it.

1. Writing a simple vCPUs

1.1. Von Neumann Architecture

  • ALU; Arithmetic and Logical Unit

  • Registers

  • Inputs and Outputs

1.3. Which programming language should I use …​?

It doesn’t matter. Use what you want.

2. Side-channel Attack

2.1. Branch Prediction

Branch Prediction is a method of optimization that CPUs use. It is useful if CPUs have to deal with if-case clauses.

If the prediction fails, in case of misprediction, the CPU rolls the predictively executed operations(opcodes) back. Sometimes CPUs do not check the memory was modified and it is successfully rolled back, there are no cached or garbage data in CPUs, that is why some CPU have data revealation vulnerabilities. (Spectre and Meltdown etc.)[2]

3. Reference

  • SpecDoctor: Differential Fuzz Testing to Find Transient Execution Vulnerabilites (SSTF 2023, invited talk)

    Good animation of branch prediction and how such vulnerability can be triggered.


1. I’m not so sure it is right, and the explanation is correct and easy to understand. I would rewrite this sentence soon.
2. I’m not so sure it is right, and the explanation is correct and easy to understand. I would rewrite this sentence soon.