|
AquilaOS documentation
How it works, and its code
|
| docs | |
| kernel | |
| kernel | |
| arch | |
| aarch64 | |
| cpu | |
| fpsimd.c | Aarch64: the FP/SIMD registers, switched lazily, as x86's FPU is (see docs/kernel/processes.md) |
| init.c | Aarch64: setting up the kernel, from where boot/head.S jumps to, up to kmain(), in the order that docs/kernel/booting.md's table gives (as x86's x86_cpu_init() does) |
| libc.c | The functions that the compiler calls on its own, to copy a structure or zero a big array: memcpy, memset, memmove and memcmp |
| trace.c | Aarch64: a panic's stack trace, from the frame records (AAPCS64): x29 points to the caller's x29 and its return address |
| trap.c | Aarch64: turning exceptions into the kernel's events (see docs/kernel/interrupts.md) |
| earlycon | |
| earlycon.c | Aarch64's early console: the PL011 UART, written to a character at a time by polling, until the terminals are up |
| include | |
| boot | |
| boot.h | |
| core | |
| arch.h | |
| system.h | |
| cpu | |
| cpu.h | |
| io.h | |
| mm | |
| mm.h | |
| pmap.h | |
| config.h | |
| mm | |
| pmap.c | Aarch64: the page tables, with 4 levels and 4 KiB pages |
| platform | |
| virt | |
| include | |
| platform | |
| virt.h | |
| devices.c | The virt machine's devices that no bus finds (see dev/platform.h): where QEMU puts them (hw/arm/virt.c), as its devicetree also says |
| fdt.c | Reading the devicetree that the boot loader passes (a flattened one, an FDT) into the kernel's struct boot: the RAM (/memory's reg property), the initrd (/chosen's linux,initrd-start and linux,initrd-end), and the command line (/chosen's bootargs) |
| gic.c | The virt machine's interrupt controller: ARM's GICv2 |
| init.c | QEMU's virt machine: setting up its interrupt controller and its PCI Express host bridge |
| irq.c | The interrupts' handlers on the virt machine, installed by their drivers (see dev/irq.h) |
| psci.c | Restarting and powering off the machine, by PSCI calls to the firmware (QEMU's), made with hvc, as the virt machine's devicetree says (/psci: method "hvc") |
| rtc.c | The date and time: the virt machine's PL031 real time clock, which counts seconds since the epoch |
| timer.c | The tick: the virtual timer of ARM's generic timer, which is each CPU's own (PPI 27) |
| sys | |
| execve.c | Aarch64: where a new program starts, for execve() |
| fork.c | Aarch64: fork()'s child thread, which returns to user mode as its parent does, from a copy of its parent's saved registers at the top of its own kernel stack |
| proc.c | Aarch64: init, the first process: its thread, and where its program starts |
| sched.c | Aarch64: the timer tick, the idle loop, and the running thread giving up its CPU |
| signal.c | Aarch64: signals on the way back to user mode, and the signal handler's frame |
| smp.c | Aarch64 runs on one CPU only, so far |
| syscall.c | Aarch64: system calls |
| thread.c | Aarch64: making threads, starting them, switching to them, and ending them |
| i386 | |
| boot | |
| init.c | I386: the kernel's first steps in C, moving itself to the higher half |
| cpu | |
| arith.c | I386: 64-bit division, for the code GCC generates |
| cpu.h | |
| fpu.c | X86: the FPU and SSE registers, switched lazily between threads |
| gdt.c | X86: the Global Descriptor Table (GDT) and the TSS |
| idt.c | X86: the Interrupt Descriptor Table (IDT), which says where each interrupt and exception vector goes |
| init.c | X86: setting up the boot CPU and memory, then on to the kernel |
| isr.c | X86: exceptions and system calls |
| smp.c | X86: starting the other CPUs, the application processors (APs) |
| trace.c | X86: a panic's stack trace |
| earlycon | |
| earlycon.c | X86: the early console, where printk() writes before the kernel's terminals exist |
| fb.c | X86: the early console on the boot loader's framebuffer |
| font.h | 8x16 font, the characters of code page 437 in order: generated by mkfont.py from unscii-16 by Viznut (public domain, https://viznut.fi/unscii/) |
| uart.c | X86: the early console on the first serial port (COM1, port 0x3F8), polled: each character waits until the UART can take it |
| vga.c | X86: the early console in VGA text mode, written straight into the text buffer at 0xB8000 (through the kernel's mapping of low memory, VMA(), which i386 and x86_64 both have) |
| include | |
| boot | |
| boot.h | |
| multiboot.h | Multiboot.h - Multiboot header file |
| core | |
| arch.h | |
| panic.h | |
| platform.h | |
| system.h | |
| cpu | |
| cpu.h | |
| io.h | |
| msr.h | |
| sdt.h | |
| smp.h | |
| mm | |
| mm.h | |
| pmap.h | |
| platform | |
| misc.h | |
| config.h | |
| mm | |
| i386.c | I386: page tables, with 32-bit paging (two levels, 4 KiB pages) |
| i386.h | |
| mm.c | X86: what the architecture adds to setting up memory at boot |
| tlb.c | X86: keeping the CPUs' TLBs up to date when a mapping changes |
| x86_64.c | X86_64: page tables, with 4-level paging |
| platform | |
| misc | |
| acpi.c | X86: ACPI's tables, and powering off |
| apic.c | X86: the APIC, the local APICs and the I/O APICs |
| cmos.c | X86: the PC's real time clock, in the CMOS: the date and time, which the kernel reads to set its clock at boot (arch_time_get()) |
| hpet.c | X86: the High Precision Event Timer (HPET), as a clock |
| irq.c | X86: devices' interrupts (IRQs), whichever controller brings them: the 8259s or the APIC, each an x86_irq_chip |
| pic.c | X86: the PC's two 8259 programmable interrupt controllers (PICs) |
| pit.c | X86: the 8254 programmable interval timer (PIT) |
| pc | |
| devices.c | The PC's devices that no bus finds (see dev/platform.h), at the ports and ISA interrupts that every PC has them on |
| init.c | The PC platform: its interrupt controllers, its timers, its PCI bus and its real time clock, set up at boot, and the tick |
| reboot.c | The PC: restarting, halting and powering off |
| sys | |
| clock.c | X86: the clock, arch_rtime_ns(), the nanoseconds since it started |
| execve.c | X86: where a new program starts, for execve() |
| fork.c | X86: the child's thread, for fork() |
| proc.c | X86: the first process's thread |
| sched.c | X86: the scheduler's architecture side: the tick, the idle loop, and a thread that sleeps, yields or ends |
| signal.c | X86: signals, on the way back to user mode, and a handler's frame |
| sys.h | |
| syscall.c | X86: system calls |
| thread.c | X86: a thread's CPU state, its kernel stack, and switching to it |
| core | |
| kargs.c | The kernel's command line: the arguments the boot loader passed, such as root=/dev/hda2 or apic=off |
| main.c | The kernel's generic entry point, kmain() |
| module.c | The built-in modules: the drivers and filesystems that are part of the kernel |
| printk.c | printk(): the kernel's messages |
| snprintf.c | snprintf() and vsnprintf(): formatting into a buffer, with the formats printk() has: c, s, d and u (32-bit), ld and lu (64-bit), x and lx (hexadecimal), b (binary) and p |
| ssp.c | What the compiler's stack protector (-fstack-protector) needs: the canary value it puts on the stack, and the function it calls when a function returns with that value overwritten |
| time.c | The wall clock: the date and time of day |
| dev | |
| ata | |
| ata.c | The ATA driver: hard disks on the IDE controller, as block device 3 (/dev/hda and up) |
| ata.h | |
| dma.c | ATA bus master DMA, for IDE controllers that can (such as QEMU's PIIX) |
| pio.c | ATA programmed I/O (PIO): the CPU moves the data itself |
| fb | |
| fbdev | |
| fbdev.c | The framebuffer devices: /dev/fb0 and up (character device 29, as on Linux) |
| vesa | |
| vesa.c | The VESA framebuffer: the linear framebuffer that the boot loader set up, as /dev/fb0 |
| input | |
| i8042.c | The driver for the i8042, the PC's keyboard controller |
| kbd | |
| ps2kbd.c | The PS/2 keyboard driver |
| mem | |
| kmsg.c | /dev/kmsg (character device 1, 11): the kernel's messages |
| memdev.c | The memory devices: the character devices of major 1, as on Linux |
| memdev.h | |
| null.c | /dev/null (character device 1, 3): reading it gives nothing, the end of the file at once, and what is written to it is thrown away |
| random.c | Random numbers: /dev/random and /dev/urandom (character devices 1, 8 and 1, 9), which are the same, and random_get() for the kernel |
| zero.c | /dev/zero (character device 1, 5): reading it gives as many zero bytes as asked for, and what is written to it is thrown away |
| mouse | |
| ps2mouse.c | The PS/2 mouse driver: /dev/mouse (character device 10, 1) |
| net | |
| e1000.c | The driver for Intel's 8254x (e1000) and 82574L Ethernet controllers |
| pci | |
| conf1.c | PCI configuration space through configuration mechanism #1, the PC's |
| ecam.c | PCI configuration space through ECAM, the Enhanced Configuration Access Mechanism of PCI Express |
| pci.c | The PCI bus: finding devices, and reading and writing their configuration space |
| rd | |
| ramdisk.c | The RAM disk: the initial RAM disk the boot loader loaded, as block device 1, 0 |
| tty | |
| pty | |
| pty.c | Pseudo-terminals: /dev/ptmx and /dev/pts/N |
| uart | |
| 8250 | |
| 8250.c | The driver for the 8250 UART and its successors, such as the 16550 with its FIFOs: the PC's serial ports, /dev/ttyS0 and up |
| pl011 | |
| pl011.c | The driver for ARM's PrimeCell UART (PL011), the serial port of QEMU's virt machine: /dev/ttyS0, and /dev/console when there are no virtual terminals |
| uart.c | Serial ports as terminals: /dev/ttyS0 and up (character device 4, 64 and up) |
| vt | |
| fb.c | Virtual terminals on the framebuffer |
| keyboard.c | The keyboard of the virtual terminals |
| term.c | The terminal emulator of the virtual terminals |
| vga.c | Virtual terminals in VGA text mode, when there is no framebuffer |
| vt.c | Virtual terminals: /dev/tty1 to /dev/tty6 (character device 4, 1 to 6), and /dev/console, which is the first one |
| generic.c | The terminal layer: the line discipline, and job control |
| tty.c | The terminal devices' numbers: which driver each one is |
| blkcache.c | The block cache: what the disks read and write, kept in 4 KiB blocks |
| kdev.c | The device layer: devices by their numbers, and what calls them |
| platform.c | The platform's devices: those that no bus can find (see dev/platform.h) |
| fs | |
| devfs | |
| devfs.c | Devfs: the filesystem of device nodes, usually mounted on /dev |
| devpts | |
| devpts.c | Devpts: the filesystem of the pseudo-terminals' slave devices, usually mounted on /dev/pts |
| ext2 | |
| block.c | Ext2: reading and writing the disk, the block group descriptors, and allocating and freeing blocks in the groups' block bitmaps |
| dentry.c | Ext2: directory entries |
| ext2.c | Ext2: loading and mounting the filesystem, and the vnodes of its inodes |
| ext2.h | |
| inode.c | Ext2: inodes, and the blocks of a file |
| remove.c | Ext2: removing, linking and renaming entries, and freeing what a file used |
| super.c | Ext2: writing the superblock back to the disk |
| vops.c | Ext2: the vnode operations: reading and writing files, directories, making nodes, truncating, and attributes |
| initramfs | |
| cpio | |
| cpio.c | Cpiofs: the RAM disk as a filesystem, read straight from an archive in the old binary cpio format |
| cpio.h | |
| initramfs.c | Initramfs: the root filesystem from the RAM disk the boot loader loaded |
| minix | |
| block.c | Minix: allocating and freeing data blocks (zones), and reading and writing them, through the block cache for the ones read often |
| dentry.c | Minix: directory entries, a name and an inode number each, in the directory's blocks |
| inode.c | Minix: inodes, and the zones of a file |
| minix.c | Minix: loading and mounting the filesystem, and the vnodes of its inodes |
| minix.h | |
| super.c | Minix: writing the superblock back to the disk |
| vops.c | Minix: the vnode operations: reading and writing files, directories, making nodes, and truncating |
| posix | |
| close.c | The generic close operation for files that are vnodes |
| helpers.c | Generic answers, for regular files, to whether a read is at the end of the file |
| ioctl.c | The generic ioctl operation for files that are vnodes |
| lseek.c | The generic lseek operation for files that are vnodes, as POSIX (IEEE Std 1003.1) describes it |
| open.c | The generic open operation for files that are vnodes |
| read.c | The generic read operation for files that are vnodes: regular files, and devices, pipes and FIFOs, which may have to wait for data |
| readdir.c | The generic readdir operation for directories that are vnodes |
| trunc.c | The generic truncate operation for files that are vnodes |
| write.c | The generic write operation for files that are vnodes: regular files, and devices, pipes and FIFOs, which may have to wait for room |
| procfs | |
| procfs.c | Procfs: the kernel's and the processes' state as files, usually mounted on /proc |
| pseudofs | |
| pseudofs.c | Pseudofs: the directories of the filesystems that live in memory (tmpfs, and so devfs and devpts) |
| tmpfs | |
| tmpfs.c | Tmpfs: a filesystem in memory, gone when the system stops |
| attr.c | Changing a vnode's attributes: its mode (chmod()), its owner (chown()) and its times (utimensat()) |
| bcache.c | The block cache: a filesystem's blocks kept in memory, by a number the filesystem chooses (minix uses the block number), so that a block read again and again is read once |
| close.c | Closing a vnode: dropping a reference to it |
| file.c | Open files (struct file, in fs/vfs.h): what open(), pipe(), socket() and accept() make, and what descriptors refer to |
| flock.c | Advisory locks on whole files, for flock() |
| fops.c | The operations on open files: each goes to the socket layer, the device's driver, or the vnode's filesystem (its fops) |
| iobuf.c | Iobufs: moving bytes into and out of the buffer of a read or a write, which may be in user memory (see fs/iobuf.h) |
| ioctl.c | ioctl() on a vnode: passed on to its device or its filesystem |
| link.c | Links by path: hard links (link()), symbolic links (symlink(), readlink()), and renaming (rename()) |
| lookup.c | Path lookup: walking a path one component at a time, from vnode to vnode |
| mknod.c | Making a filesystem node by its path: a file, a directory, a device node, a FIFO or a symbolic link |
| mount.c | Mounting: a filesystem on a directory, by type (mount()), and the root filesystem from a disk partition |
| pipe.c | Pipes, and FIFOs: a ring buffer in memory, written at one end and read at the other |
| read.c | Reading from a vnode: from its device, or through its filesystem |
| readdir.c | Reading a directory's entries, and finding one by name |
| rofs.c | The operations of a read-only filesystem that would change it: each fails with EROFS |
| stat.c | stat(): a vnode's attributes, in the structure user space gets |
| sync.c | Syncing vnodes and filesystems to their disks |
| trunc.c | Truncating a vnode: changing a file's length |
| unlink.c | Removing a name by its path: unlink() and rmdir() |
| vcache.c | The vnode cache: a filesystem's vnodes that are in use, by inode number, so that a file opened twice gets the same vnode |
| vfs.c | The virtual filesystem (VFS): the filesystems that are installed, the root, mounting one filesystem on a directory of another, and permissions |
| vm_object.c | The page cache: a file's pages in memory, for mmap() |
| vops.c | The vnode operations that work on a directory and a name, or on a vnode's inode: each checks its arguments, then calls the filesystem's operation (vops) |
| write.c | Writing to a vnode: to its device, or through its filesystem |
| include | |
| boot | |
| boot.h | |
| console | |
| earlycon.h | |
| core | |
| arch.h | |
| assert.h | |
| kargs.h | |
| module.h | |
| panic.h | |
| printk.h | |
| qsort.h | |
| string.h | |
| system.h | |
| time.h | |
| types.h | |
| cpu | |
| cpu.h | |
| io.h | |
| dev | |
| blkcache.h | |
| dev.h | |
| fbdev.h | |
| i8042.h | |
| irq.h | |
| kbd.h | |
| pci.h | |
| platform.h | |
| ramdev.h | |
| random.h | |
| tty.h | |
| ttydev.h | |
| uart.h | |
| vt.h | |
| ds | |
| bitmap.h | |
| buddy.h | |
| hashmap.h | |
| list.h | |
| queue.h | |
| ringbuf.h | |
| fs | |
| bcache.h | |
| devfs.h | |
| devpts.h | |
| initramfs.h | |
| iobuf.h | |
| mbr.h | |
| pipe.h | |
| posix.h | |
| pseudofs.h | |
| rofs.h | |
| stat.h | |
| tmpfs.h | |
| vcache.h | |
| vfs.h | |
| mm | |
| buddy.h | |
| kvmem.h | |
| mm.h | |
| pmap.h | |
| vm.h | |
| vmem.h | |
| net | |
| byteorder.h | |
| inet.h | |
| netbuf.h | |
| netif.h | |
| socket.h | |
| tcp.h | |
| sys | |
| binfmt.h | |
| callout.h | |
| cpu.h | |
| elf.h | |
| kthread.h | |
| lock.h | |
| proc.h | |
| reboot.h | |
| sched.h | |
| signal.h | |
| syscall.h | |
| thread.h | |
| uaccess.h | |
| waitq.h | |
| video | |
| vbe.h | |
| vesa.h | |
| config.h | |
| stdarg.h | |
| stddef.h | |
| stdint.h | |
| mm | |
| buddy.c | The buddy allocator: physical memory, in blocks of 2^n pages |
| fault.c | Page faults: a process's page brought in when it first touches it |
| kvmem.c | kmalloc() and kfree(): the kernel's memory for its own structures |
| mm.c | Physical memory: setting it up at boot, and the pages of it |
| slab.c | Slabs: the kernel's small objects |
| vm_anon.c | Anons: the pages a process has written to, in one of its mappings |
| vm_entry.c | Map entries: the mappings of an address space |
| vm_object.c | Vm objects: what a mapping's pages come from, such as a file |
| vm_space.c | Address spaces: a process's mappings (map entries), kept in address order, and its page tables (pmap) |
| vmem.c | Vmem, an allocator of ranges of addresses (see mm/vmem.h) |
| vmm.c | Mapping and unmapping a map entry's range in an address space, and the kernel's own address space (kvm_space) |
| net | |
| inet | |
| arp.c | ARP: finding the hardware (MAC) address of an IPv4 address on the link |
| ether.c | Ethernet, and the Internet checksum |
| icmp.c | ICMP |
| ifioctl.c | The network interfaces' ioctl() requests, made on an AF_INET socket |
| ipv4.c | IPv4 |
| socket.c | AF_INET datagram sockets: UDP (SOCK_DGRAM), and ping sockets (SOCK_DGRAM with IPPROTO_ICMP), which send echo requests and receive the replies, without needing root |
| tcp_input.c | TCP input (RFC 9293 3.10.7, "SEGMENT ARRIVES") |
| tcp_output.c | TCP output |
| tcp_socket.c | TCP connections (struct tcp_pcb) and their sockets (SOCK_STREAM) |
| udp.c | UDP input |
| unix | |
| unix.c | Unix domain sockets (AF_UNIX): stream sockets between processes of this machine, named by a path in the file system |
| unix.h | |
| netbuf.c | Packet buffers (see net/netbuf.h) |
| netif.c | Network interfaces (see net/netif.h) |
| socket.c | Sockets: what every domain's sockets share |
| sys | |
| binfmt | |
| binfmt.c | Loading a program into a process, for execve() |
| elf.c | The ELF loader |
| callout.c | Callouts: functions to call at a time to come (see sys/callout.h) |
| execve.c | execve(): a process runs another program |
| fork.c | fork(): a copy of the calling process |
| kthread.c | Kernel threads |
| lock.c | The kernel lock |
| proc.c | Processes: making them and ending them, their IDs, their descriptors, and their sessions and process groups |
| reboot.c | Restarting, halting and powering off the machine (reboot()), and Ctrl+Alt+Del |
| sched.c | The scheduler: which thread runs next, and the tick |
| signal.c | Signals: sending them, and taking them on the way back to user mode |
| sys_file.c | System calls on files: opening, reading and writing them, their names and attributes, directories, links, mounts and locks |
| sys_net.c | System calls on sockets: making them, binding, listening, accepting and connecting, sending and receiving, their names and options |
| sys_poll.c | System calls that wait for any of several descriptors: select() (and pselect()) and poll() |
| sys_proc.c | System calls about processes and threads: exit(), execve(), fork(), waitpid(), threads, IDs, process groups and sessions, memory (sbrk(), mmap(), munmap()), and the machine (uname(), reboot(), sethostname()) |
| sys_signal.c | System calls about signals, timers and the time: kill(), sigaction(), the signal mask, sigsuspend() and sigreturn(), setitimer(), nanosleep(), and the clocks |
| syscall.c | System calls: what the architecture calls when user mode makes one (syscall_dispatch()), the table of them, and the helpers that several kinds of calls share, for the user memory and descriptors they take |
| syscalls.h | |
| thread.c | Threads: making one in a process, and ending one |
| waitq.c | Wait queues (see sys/waitq.h) |