Jaiaid / os_from_scratch

Experiment on creating OS from scratch for x86 protected mode. For hardware configuration (port address, mmio addresss) IBM PC system is assumed

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Experimental coding to build OS from scratch

These codes are written following different tutorial on devloping OS from scratch for an intel x86 based IBM PC architecture. By IBM PC architecture, it is meant that what chips are present in the system (e.g. timer, PIC, keyboard chip), I/O port addresses (e.g. timer, PIC, PCI controller, keyboard controller) are assumed according to this architecture. For processor intel80386 is assumed.

Written code boots pc at 16bit real mode and then switches to 32bit protected mode. In 32bit mode paged memory addressing activation is done but it is not complete (seg. fault handler code, using disk as memory is not done. Actually, disk driver is not implemented at all). Any intel x86_64 based system following IBM PC architecture should be backward compatible with this experiment code. Currently bootloader and kernel is tightly coupled, means it is not attempted to load with grub or other bootloader.

Following sites and books are heavily followed

Build

To build raw harddisk image harddisk.bin, run

make

Build Prerequisites

To clean the build,

make clean

Simulation

Simulation is done with bochs-2.6. To simulate, run simulate.sh script

./simulate.sh

As machine configuration, machineconf.txt is used. Currently memory management code is incomplete and RAM amount is hardcoded. So, code may break if ram amount is reduced.

Virtualbox may also be used to simulate, if host environment is compatible. To turn built disk image into virtualbox compatible harddisk image, run

VBoxManage convertfromraw harddisk.bin virtual_disk.vhd --format vhd

Create a device according to machineconf.txt with storage set as virtual_disk.vhd. Then run the created virtual machine.

About

Experiment on creating OS from scratch for x86 protected mode. For hardware configuration (port address, mmio addresss) IBM PC system is assumed


Languages

Language:C 65.9%Language:Assembly 21.3%Language:Makefile 8.2%Language:C++ 3.7%Language:Shell 1.0%