Git Product home page Git Product logo

pseudos's Introduction

PseudOS

PseudOS is a toy operating system based on the following resources:

Prerequisites

PseudOS runs on QEMU and needs a riscv64 toolchain to compile. See https://www.qemu.org/docs/master/system/riscv/virt.html for more details

Compiling the bootloader

Running make should take care of everything

See the makefile for compilation details

Running

Again, make should automatically run the OS. If you're constantly iterating on the code (like I am) and QEMU doesn't auto-quit on OS crash, I've included a qemu destroyer bash script which can run in another terminal tab and continuously pkills qemu. Just a quality of life thing.

Debugging

pseudOS gdb thumbnail

If you want to inspect QEMU to see what's going on under the hood, use the following commands:

First, run

make pseudOS_debug

which will compile the OS with debugging symbols on and no optimizations. The -S command in the makefile will hold QEMU on startup and not execute any code until we've connected with gdb.

In a separate terminal window, start gdb: riscv64-unknown-elf-gdb build/kernel.elf

Connect to the QEMU session with the command

(gdb) target remote localhost:9000

Use this command to activate GDB's display of source and registers

(gdb) tui reg general

Skip to some interesting code with with

(gdb) advance _move_to_supervisor_mode

Get the status of specific CSR registers

(gdb) info registers mstatus

(Optional) Set up gdbgui (https://www.gdbgui.com/) to have a GUI not from the 80s. It also supports vim keybindings for those who prefer it to gdb's emacs bindings.

/usr/local/bin/python3.9 -m pipx run gdbgui

Ref:

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.