AdrOS is a multi-architecture operating system developed for research and academic purposes. The goal is to build a secure, monolithic kernel from scratch, eventually serving as a platform for security testing and exploit development.
- x86 (32-bit & 64-bit)
- ARM (32-bit & 64-bit)
- MIPS
- RISC-V (32-bit & 64-bit)
- Language: C/C++ and Assembly
- Bootloader: GRUB2 (Multiboot2 compliant)
- Build System: Make + Cross-Compilers
- Multi-arch build system
make ARCH=x86|arm|riscv|mips- x86 is the primary, working target
- x86 (i386) boot & memory layout
- Multiboot2 (via GRUB)
- Higher-half kernel mapping (3GB+)
- Early paging + VMM initialization
- W^X-oriented userspace layout (separate RX/R and RW segments)
- Non-executable stack markers in assembly (
.note.GNU-stack)
- Memory management
- Physical Memory Manager (PMM)
- Virtual Memory Manager (x86)
- Kernel heap allocator (
kmalloc/kfree)
- Basic drivers & console
- UART serial console logging
- VGA text console (x86)
- Keyboard driver + input callback
- PIT timer + periodic tick
- Kernel services
- Simple scheduler / multitasking (kernel threads)
- Minimal process lifecycle: parent/child tracking, zombies,
waitpid - Basic shell with built-in commands (fallback when userspace fails)
- InitRD + VFS + mounts
- InitRD image in TAR/USTAR format (with directory support)
- InitRD-backed filesystem node tree (
fs_node_t+finddir) - Absolute path lookup (
vfs_lookup("/bin/init.elf")) - Mount table support (
vfs_mount) +tmpfsandoverlayfs
- File descriptors + syscalls (x86)
int 0x80syscall gateSYSCALL_WRITE,SYSCALL_EXIT,SYSCALL_GETPID,SYSCALL_GETPPID,SYSCALL_OPEN,SYSCALL_READ,SYSCALL_CLOSESYSCALL_LSEEK,SYSCALL_STAT,SYSCALL_FSTATSYSCALL_DUP,SYSCALL_DUP2,SYSCALL_PIPESYSCALL_FORK,SYSCALL_EXECVE(with minimal argv/envp stack setup)SYSCALL_SELECT,SYSCALL_POLLSYSCALL_SIGACTION,SYSCALL_SIGPROCMASK,SYSCALL_KILLSYSCALL_SETSID,SYSCALL_SETPGID,SYSCALL_GETPGRP- Per-process fd table (starting at fd=3)
- Centralized user-pointer access API (
user_range_ok,copy_from_user,copy_to_user) - Ring3 init program (
/bin/init.elf) exercising IO + process + exec smoke tests - Error returns use negative errno codes (Linux-style)
- TTY (canonical line discipline)
- Keyboard -> TTY input path
- Canonical mode input (line-buffered until
\n) - Echo + backspace handling
- Blocking reads with a simple wait queue (multiple waiters)
fd=0wired totty_read,fd=1/2wired totty_write- Minimal termios/ioctl support (
TCGETS,TCSETS,TIOCGPGRP,TIOCSPGRP) - Basic job control enforcement (
SIGTTIN/SIGTTOUwhen background pgrp touches the controlling TTY)
- Devices (devfs)
/devmount/dev/null/dev/tty
- Persistent storage (x86 / QEMU)
- ATA PIO driver (primary master IDE)
- Minimal on-disk persistence filesystem mounted at
/persist(singlecounterfile used by smoke tests)
- W^X (Option 1) for user ELFs (x86)
- User segments are mapped RW during load, then write permissions are dropped for non-writable segments
- This provides "text is read-only" hardening without requiring NX/PAE
make ARCH=x86 isomake ARCH=x86 run- Logs:
serial.log: kernel UART outputqemu.log: QEMU debug output when enabled
QEMU debug helpers:
make ARCH=x86 run QEMU_DEBUG=1make ARCH=x86 run QEMU_DEBUG=1 QEMU_INT=1
- Multi-architecture kernel bring-up
- Implement VMM/interrupts/scheduler for ARM/RISC-V/MIPS
- Standardize arch entrypoint behavior (
arch_early_setup) across architectures
- Userspace / POSIX process model
brk/sbrk- Signal return ABI (
sigreturn) and default actions for more signals (current support is minimal)
- Syscalls / ABI
getcwd,chdir- Userspace
errnovariable + libc-style wrappers (-1return +errnoset)
- Virtual memory hardening
- Option 2: PAE + NX enforcement (execute disable for data/stack)
- Guard pages, and tighter user/kernel separation checks
- Filesystem
- Expand persisted storage beyond the current minimal
/persistfilesystem - Permissions/ownership (
uid/gid, mode bits) andumask - Special files: block devices,
/proc - Real on-disk fs (ext2/fat)
- Expand persisted storage beyond the current minimal
- TTY / PTY
- Termios-like mode flags (canonical/raw, echo, erase, intr)
- Sessions / process groups / controlling terminal
- PTYs for userland shells
- Observability & tooling
- Better memory stats (
memshell command) - Debug facilities (panic backtraces, symbolization, structured logs)
- CI-ish targets:
cppcheck,scan-build,mkinitrd-asan
- Better memory stats (
src/kernel/- Architecture-independent kernel codesrc/arch/- Architecture-specific code (boot, context switch, interrupts)src/drivers/- Device driversinclude/- Header files