horie1024 / book.rvemu

The book "Writing a RISC-V Emulator from Scratch in 10 Steps".

Home Page:https://book.rvemu.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Writing a RISC-V Emulator from Scratch in 10 Steps

Introduction

This is the book for writing a 64-bit RISC-V emulator from scratch in Rust. It shows us how to implement an emulator in 10 steps. You can run xv6, a simple Unix-like OS, in your emulator in the final step.

You'll learn the following basic computer architecture from making an emulator in Rust:

  • Basic RISC-V architecture
  • How to write code in Rust language
  • Privilege levels
  • Exceptions
  • Interrupts
  • Peripheral devices
  • Virtual memory system

The source code is available at d0iasm/rvemu-for-book.

Step Content
Step 1 Setup and Implement Two Instructions
Step 2 RV64I Base Integer Instruction Set
Step 3 Control and Status Registers
Step 4 Privileged Instruction Set
Step 5 Exceptions
Step 6 PLIC (a platform-level interrupt controller) and CLINT (a core-local interrupter)
Step 7 UART (a universal asynchronous receiver-transmitter)
Step 8 Interrupts
Step 9 Virtio
Step 10 Virtual Memory System

Congratulations🎉 Now you can run xv6 in your emulator!

The author is @d0iasm and please feel free to ask and request anything to me via Twitter or GitHub issues!

About

The book "Writing a RISC-V Emulator from Scratch in 10 Steps".

https://book.rvemu.app/

License:MIT License