Simple, self-contained, clean code, well-documented, hobbyist 64-bit operating system for Intel and AMD processors. It's written in Assembly (Intel syntax) and C (GNU99 Standard) in which I strive for adding comments to the source code as much as possible so it could be used as a reference for future OS developers.
It contains the following components written from scratch:
Component | Description | Source code |
---|---|---|
MBR | First stage bootloader | code |
Loader | Second stage bootloader | code |
Component | Description | Source code |
---|---|---|
PML4 | Paging Structure | code |
Buddy | Memory allocator System | code |
PrintK | printf-like string format parsing utility | code |
Serial Driver | send printk msgs via RS232 to help debugging | code |
Core Dump | Dump CPU registers for debugging purposes | code |
Syscall/Sysret | method chosen to jump to Ring 3 and back | code |
PIT | Programmable Interval Timer | code |
PIC | Programmable Interrupt Controller | code |
(x)delay | Based on tightloops given that I'm using PIT | code |
CMOS RTC | Real-time clock | code |
Scheduler | Simple Round-Robin scheduler | code |
functions are being added on-demand: code
More to come! Star/Watch this repo to stay tuned!
In order to build this app, you are expected to have make
and docker
installed in your machine. All of the other building dependencies should be taken care of automatically by the docker image created during this step.
To build it you have to run:
make build
In order to run this app, you are expected to have make
and qemu-system-x86_64
installed in your machine.
make test
To make sure I won't lose focus on what I want this OS to be able to do, I decided to write a list of features that I want to implement in the short to medium term.
- Serial port driver
- Early printk (contingent on serial port driver) -> will help debugging in real computers
- limited libc -> (It will always be "Work in progress" as I add functions as I need them)
- Userspace
- Rudimentary Bash-like terminal
Things that would be fantastic to have but I am not sure if I have what it takes to do within my lifetime.
- networking capabilities (I would be damn happy with UDP already..I wouldn't dare trying to implement TCP)
- Filesystem
- Scheduler / Time-sharing OS
These are all the references that helped me a lot during the development of AlmeidaOS
Forums:
Books:
- https://www.amazon.com/Understanding-Linux-Kernel-Third-Daniel/dp/0596005652
- https://www.amazon.com/Linux-Device-Drivers-Jonathan-Corbet/dp/0596005903/
- https://www.amazon.com/Hackers-Delight-2nd-Henry-Warren/dp/0321842685 - (thanks @igorlg)
- https://www.amazon.com/Understanding-Using-Pointers-Techniques-Management/dp/1449344186
Existing OSes:
Courses: