Code Monkey home page Code Monkey logo

jos's Introduction

jos

My own minimal OS.
This is very much a learning project, it will probably never go beyond that. My ultimate goal is to get it to a point where I can switch to 64-bit long mode and have full MP APIC support so that I can play with timers and perf in various VM environments.
Beyond that, who knows...

Some features (some done, some constantly in flux)

  • 32-bit protected mode kernel, virtual memory mapped ("high" kernel).
  • PIC and PIT support (clock and interrupts).
  • libc functionality (like printf).
  • memory management (arenas, pools).
  • basic task management (in-kernel switching only).
  • multi-cpu support.

Built on knowledge from:

Dependencies/Tools used

Dev setup

The kernel itself is built in Ubuntu running in WSL, using the locally built GCC cross compiler (9.2.0 at the time of writing). I edit the code in VSCode or VisualStudio, using the latter for the "lab" project which is where I experiment with various pieces of functionality in a more easy-to-debug-and-test environment (at least for me).
The project itself is managed using makefiles and built using a couple of bash scripts, build.sh and iso.sh being the main ones.
To debug I use a mix of bochsdbg and gdb, the former runs directly in Windows and is quick to get up and running and since it's an emulator it is ideal for debugging hardware state issues. In the code I use a macro _JOS_BOCHS_DBGBREAK to break at particular points, this works but is of course not as smooth as in-debugger source level breakpoints. For that you need GDB.
To use GDB I run the kernel in qemu, in a VMWare Ubuntu VM, and start it in suspended listening mode with the parameters -s -S. The debug build configuration for the kernel outputs a symbol file (as jos.sym) which I load into GDB for source level debugging.
In addition I use serial port tracing (K_TRACE in the code) and good ol' printf.

Reading the code

The best place to start is in kernel\arch\i386\kernel_loader.asm. This is where the kernel is first loaded by GRUB and where it sets up the initial descriptor tables, memory mappings, and switches to protected mode. It invokes code in kernel\kernel\kernel.c which is where all the kernel subsystems are initialised and test code runs, etc.

jos's People

Contributors

jarlostensen avatar

Stargazers

 avatar Lucas Marsh avatar Florian Wilhelm avatar Scott Perham avatar

Watchers

 avatar

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.