Arc
Introduction
Arc is a toy operating system for modern PCs with amd64 processors. It is written mostly in C11, with small amounts of Intel-style assembly where required. It can be loaded by any Multiboot 2-compliant boot loader, such as GNU GRUB.
Features
The current set of features, at a high level, is roughly:
- Symmetric multiprocessing (i.e. multiple processors/cores)
- Paging (and TLB shootdown)
- Physical memory allocation (several zones for DMA addressing limitations)
- Virtual memory allocation (in kernel- and user-space)
- Interrupt handling (dual 8259 PICs or local APIC)
- Interrupt routing (with I/O APIC and ACPI tables)
- Timing (8253/8254 PIT or local APIC)
- Processes (loaded as ELF64 Multiboot modules) and threads
- Scheduling (round-robin, preemptive)
- System calls (with
SYSCALL
/SYSRET
) - Fine-grained locking with spinlocks
Currently these are enough to boot up and execute some simple programs written in assembly language that directly make system calls to the kernel (there’s no C library yet!)
For example, the following ‘Hello, world!’ program can be seen running in the screenshot at the top of the page:
[section .text]
[global _start]
_start:
; sys_trace
mov rax, 0
mov rdi, hello_str
syscall
; sys_exit
mov rax, 1
syscall
jmp $
[section .data]
hello_str:
db "hello, world"
db 33, 10, 0
Source code
Arc is open-source software available under the terms of the ISC license, which
is similar to the 2-clause BSD license. The source code is hosted on
GitHub. The README
file contains instructions for building and
testing it.