Skip to main content

Portfolio OS

C-based operating system embraces low-level input/output operations and keyboard input handling to deliver a seamless user experience. Developed for the 32-bit ix86 architecture. From here you can start qemu emulator to Portfolio OS (Note: This might take up to a minute)

Bootstrapping the Kernel

The birth of this operating system began with the assembly code that bootstraps the kernel. Using the multiboot standard, a specific structure was placed at the beginning of the kernel's image to mark the program as a kernel. This structure, recognized by the bootloader, contains magic values that guide the bootloader in loading and executing the kernel. A 16KB stack space was also allocated within the kernel, which is necessary as languages such as C cannot function without a stack.


Students at the University of New South Wales using the new collaborative annotation features

from Assembly to Kernel Space

Once loaded, the bootloader jumps to the "_start" label in the kernel, marking the entry point of the kernel. In this stage, crucial processor states were initialized and a stack was set up for the processor by assigning the top of the stack to the esp register. This allows the transition from the realm of assembly to the high-level operations of the kernel written in C.

Building the High-Level Kernel

The heart of the operating system, the kernel, was written in C, providing a higher level of abstraction from the hardware compared to assembly. The kernel's primary function, "kernel_main", is the entry point for the high-level operations of the operating system. It is in this function that the kernel is set up to handle important functionalities such as interrupt handling, process management, and memory management.

The kernel is also in charge of managing and controlling the hardware of the system. This was done using a combination of Assembly (for low-level hardware control) and C (for high-level abstraction). The kernel provides its own implementations for critical functions like 'printf', as there are no standard library functions available in this environment. This allows for a more fine-grained control over system resources and hardware.

Shelling Out

A shell was developed in C as the primary user interface for the operating system. It interprets user commands and invokes the corresponding kernel routines. Given the lack of standard library functions, I had to implement various utilities, including basic string manipulation and memory management functions. The shell serves as the bridge between the user and the kernel, providing an interactive medium for users to communicate with the operating system.


Shell of the operating system