Giter VIP home page Giter VIP logo

riscv-step-by-step's Introduction

技術書典7 RISC-V step-by-step サポート情報はこちら

はじめに

小さなオリジナルの kernel を実装しながら RISC-V のアーキテクチャを理解することを目的として書かれています. ステップと呼ばれる章を順番に進めていくことで, 次第に実装が kernel に近づいていく様子が分かります. ステップ間の差分はできるだけ小さくなるように実装し, いつの間にか kernel ができた, を目指します. CPU アーキテクチャを理解するためにはその CPU アーキテクチャを使って自ら実装してみるのが一番ですが, その実装の対象として kernel は最も適した題材だと考えます.

まず最初のステップで環境を構築し, 以降のステップで, 割り込み/例外のハンドリング, タイマー割り込み, 実行ファイルのロード, ユーザーモード, システムコール, 仮想アドレス変換, 複数ユーザーモード, 遅延ロード, タスク状態管理, スレッド, 最後にミューテックスについて説明します.

References

The RISC-V Instruction Set Manual Volume II: Privileged Architecture

https://github.com/riscv/riscv-isa-manual/releases/download/archive/riscv-privileged-v1.10.pdf

The RISC-V Instruction Set Manual Volume I: User-Level ISA Document

https://github.com/riscv/riscv-isa-manual/releases/download/archive/riscv-spec-v2.2.pdf

SiFive FE310-G000 Manual v2p3

https://sifive.cdn.prismic.io/sifive%2F4d063bf8-3ae6-4db6-9843-ee9076ebadf7_fe310-g000.pdf

RISC-V Assembly Programmer's Manual

https://github.com/riscv/riscv-asm-manual/blob/master/riscv-asm.md

RISC-V ELF psABI specification

https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md

riscv-qemu wiki

https://github.com/riscv/riscv-qemu/wiki

riscv-qemu change log

https://wiki.qemu.org/ChangeLog

riscv-step-by-step's People

Contributors

otamajakusi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

riscv-step-by-step's Issues

QEMU: atomic test sometimes fail when --singlestep

on steps/13, run qemu as:
qemu-system-riscv32 -nographic -machine virt -kernel m.elf --singlestep
sometimes fails with ++++++++82: "ret" != "1"

$ qemu-system-riscv32 --version
QEMU emulator version 4.1.50 (v4.1.0-838-ge43dc48e6e-dirty)
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers

qemu 4.0 (or higher) support

$ pwd
/path/to/steps/8/m
$ timeout 3 make run
qemu-system-riscv32 -nographic -machine sifive_u -kernel m.elf
Hello RISC-V M-Mode.
unknown exception or interrupt: 0000000f, 0000001c, 00000000

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.