This project is a simple operating system written in assembly. It includes a bootloader, a protected mode kernel, and a transition to long mode with basic paging. The OS displays "HELLO WORLD" in protected mode and a blue screen in long mode.
- A bootloader that loads the kernel into memory.
- Transition to protected mode and long mode.
- Basic paging setup for identity mapping.
- CPUID and long mode detection.
- Displays "HELLO WORLD" in protected mode.
- Displays a blue screen in long mode.
- Assembler:
nasm(Netwide Assembler) - Emulator:
qemu-system-x86_64
Install them on Linux:
sudo apt install nasm qemu-system-x86OS/
├── Makefile # Build automation
├── build_and_run.sh # Script to build and run the OS
├── Sector1/ # Bootloader and utility functions
│ ├── bootloader.asm # Bootloader code
│ ├── DiskRead.asm # Disk reading function
│ └── print.asm # Print function for debug messages
├── Sector2+/ # Kernel and supporting files
│ ├── ExtendedProgram.asm # Main kernel code
│ ├── gdt.asm # Global Descriptor Table setup
│ ├── CPUID.asm # CPUID and long mode detection
│ └── SimplePaging.asm # Paging setup for long mode
- Build the OS:
make
- Run the OS in QEMU:
make run
- Clean up build files:
make clean
- Run the build and execution script:
./build_and_run.sh
-
Bootloader:
- Loads the kernel (Extended Program) into memory.
- Jumps to the kernel at
0x7e00.
-
Kernel:
- Detects CPUID and long mode support.
- Transitions to protected mode and sets up the GDT.
- Sets up paging and transitions to long mode.
- Displays "HELLO WORLD" in protected mode.
- Displays a blue screen in long mode.
To debug the OS, run QEMU with GDB support:
qemu-system-x86_64 -drive format=raw,file=os-img.bin -boot c -S -gdb tcp::1234Then connect with GDB:
gdb
target remote localhost:1234This project is licensed under the MIT License. See the LICENSE file for details.