Code Monkey home page Code Monkey logo

koerix's Introduction

Koerix

What is Koerix?

Koerix is a Unix-like hobby OS written in C++. I am mainly targeting the x86_64 (on PC) and the armv6a and AArch64 (on raspi/raspi4) architectures. This repo is the patched-together result of ~4 years of on/off work on my OS projects (turns out OS development is real hard, so I started over again a few times). It's not the most stable, yet, (especially on real hardware) but I'm getting there.

Version 1.0 will be shipped as soon as bash and busybox are up and running :)

Screenshot

In the image, you can see the userspace program textcon in action. the terminal to the left shows the serial output. textcon will print everything on the screen it reads from it's stdin (in this case, the serial console).

Licensing

While the kernel (directories arch/, platform/, kernel/) and userspace environment programs (env/) is licensed under the terms of the GNU Lesser General Public License, the directory libc/ contains large parts of the Musl libc, which is provided under the terms of the MIT license. Additionally, all files should have a SPDX comment at the top stating the exact license and copyright holder. If they don't: please tell me or open a pull request.

Roadmap

Now that the OS actually runs quite nicely on real hardware, it's time to implement some new features:

  • Fixing any stability issues (race conditions)
  • Add APIC and SMP support (supported by limine bootloader): I want to add it as soon as possible in order to be able to detect synchronization issues early.
  • Writing a driver for SATA drives and implementing ext2 filesystem support: pretty much a must-have for any serious OS. After that, I can start thinking about porting some actually useful software, like bash.
  • raspi1 port (BCM2835/armv6), since I have some old 32bit pis that are too slow for anything else and I think that's a nice re-use application.

Recently, I completely dropped support for 32bit x86 (i386 architecture), since I think supporting it would be too much added complexity that I don't want (cannot map the whole physical RAM in the upper half, jumping to higher half requires some extra magic), given that I don't even own corresponding hardware anymore. However, I will eventually support executing 32bit code in userspace (compatibility mode).

Current Kernel Features

  • x86_64 kernel (64bit) written in C++, C as well as some GNU Assembler
  • preemptive multitasking (single core), Mutexes and Spinlocks
  • full paged Virtual Memory support
  • POSIX fork() with multi-level copy-on-write
  • read(), write(), open(), close() via Virtual file system (WIP)
  • system calls via software interrupt 0x80
  • limine bootloader
  • POSIX pipes (create by calling pipe pipe(), use by fork()ing)
  • Processes and Threads (but no exec() so far)
  • OS support for FPU/SSE

Drivers

  • PC Serial port driver (for getting a shell and some debug output)
  • Rudimentary support for PS/2 keyboard

Userspace features

  • Standard C-library (by copying and modifying sources from musl libc as needed)
  • Access to full resolution framebuffer, font rendering and draw functions via libc in userspace.
  • Create userspace threads with functions from koerix/threads.h

Available Software

  • textcon: A userspace program that prints everything it reads from stdin to the framebuffer providing a text console. It also opens the keyboard device and prints everything it reads from there to stdout.

Runtime configuration

The kernel can be configured at boot time (via the kernel command line) to do a few things. For example:

  • console=/dev/uart0 will open a serial console on uart0 (first serial port)
  • init=/bin/init will load the specified binary from disk and run it after booting
  • init=@some_mod will load the specified module passed via the bootloader and run it after booting

Building

Building the kernel and userspace binaries:

$ git clone --recursive https://github.com/ulmer-a/koerix
$ mkdir -p koerix/build && cd koerix/build
$ cmake ..
$ make -j

Assembling a diskimage:

$ make disk    # this will build the limine bootloader
               # from source and generate a disk image
$ make qemu    # this will start your diskimage in QEMU

koerix's People

Contributors

ulmer-a avatar wegwart avatar

Stargazers

Eugen Neumann avatar Mathias Rieder avatar zoomer avatar

Watchers

 avatar

Forkers

wegwart

koerix's Issues

Upgrade `lib::map` container to red-black map

The map container in the kernel support library is implemented as a plain and simple binary search tree. Nothing too complicated and works well. However, time complexity for the search operation could be improved by making the tree balanced (for example using a red-black tree, like in std::map).

This can be done independently from the rest of the kernel (no other kernel components need to be touched except map.h)

Implement syscall 0x80

Fix exception when returning from user space

Welcome from the idle task!
(!!) exception #13 (General protection fault)
rip=0x1000008, rsp=0x7ffffffffff0, err=0x802
**** kernel panic: unhandled exception

Unmap virtual address space when a process terminates

Implement a destructor for the AddrSpace class:

  • iterate over all four levels of page tables using a nested for-loop
  • free the tables and pages you encounter using PageMap::free()
  • make sure you correctly use locking mechanisms

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.