# vinc/moros architecture

> Architecture diagram of the GitHub repository vinc/moros, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vinc/moros
- Repository: https://github.com/vinc/moros

## Overview

MOROS is a Rust hobby operating system for x86-64, centered on a command-line environment. Its principal workflow is to boot into the kernel, initialize hardware and storage, start a userspace shell, and execute commands through userspace APIs and kernel services. Major branches include the custom filesystem, process and syscall support, networking, graphics and sound, plus shell, Lisp, editor, and other utilities. The graph reflects the README and source-index references; unsampled implementation details are not treated as verified call relationships.

Main entry points: [`src/api`](https://github.com/vinc/moros/tree/trunk/src/api) (Userspace API), [`src/sys`](https://github.com/vinc/moros/tree/trunk/src/sys) (Hardware support), [`src/main.rs`](https://github.com/vinc/moros/blob/trunk/src/main.rs) (Kernel entry), [`src/usr/shell/mod.rs`](https://github.com/vinc/moros/blob/trunk/src/usr/shell/mod.rs) (Shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Boot and kernel"]
  node_bootloader["External bootloader"]
  node_boot["Boot support"]
  node_kernel["Kernel entry<br/>[main.rs]"]
end

subgraph group_hardware["Hardware and devices"]
  node_hardware["Hardware support"]
  node_display["Console and VGA<br/>[console.rs]"]
  node_sound["Sound drivers"]
  node_ata["ATA storage<br/>[ata.rs]"]
end

subgraph group_core["Kernel services"]
  node_memory["Memory management"]
  node_filesystem[("Filesystem")]
  node_process["Process management<br/>[mod.rs]"]
  node_ksyscall["Kernel syscalls"]
end

subgraph group_userland["Userspace"]
  node_api["Userspace API"]
  node_shell["Shell<br/>[mod.rs]"]
  node_command_exec["Command execution<br/>[exec.rs]"]
  node_commands["Utilities and games"]
  node_lisp["Lisp interpreter<br/>[mod.rs]"]
  node_editor["Text editor<br/>[edit.rs]"]
end

subgraph group_network["Networking"]
  node_network_stack["Network stack"]
  node_nic["Network drivers"]
  node_network_apps["Network applications"]
end

node_operator(("Computer user"))

node_operator -.->|"starts system"| node_bootloader
node_bootloader -.->|"loads kernel"| node_boot
node_boot -.->|"initializes"| node_kernel
node_kernel -.->|"initializes subsystems"| node_hardware
node_kernel -.->|"exposes userspace"| node_api
node_hardware -->|"provides console"| node_display
node_hardware -->|"registers drivers"| node_sound
node_hardware -->|"includes ATA support"| node_ata
node_hardware -->|"includes networking"| node_network_stack
node_filesystem -->|"mounts ATA disks"| node_ata
node_process -->|"uses address spaces"| node_memory
node_process -->|"handles syscall context"| node_ksyscall
node_ksyscall -->|"serves filesystem operations"| node_filesystem
node_api -->|"issues syscalls"| node_ksyscall
node_api -->|"accesses files"| node_filesystem
node_api -->|"manages processes"| node_process
node_operator -.->|"uses"| node_shell
node_shell -->|"dispatches commands"| node_command_exec
node_command_exec -->|"runs utilities"| node_commands
node_shell -->|"uses userspace services"| node_api
node_operator -.->|"invokes interpreter"| node_lisp
node_operator -.->|"edits text"| node_editor
node_operator -.->|"runs network commands"| node_network_apps
node_network_stack -->|"uses device drivers"| node_nic
node_network_apps -.->|"uses userspace services"| node_api

click node_boot "https://github.com/vinc/moros/tree/trunk/src/sys/boot"
click node_kernel "https://github.com/vinc/moros/blob/trunk/src/main.rs"
click node_hardware "https://github.com/vinc/moros/tree/trunk/src/sys"
click node_display "https://github.com/vinc/moros/blob/trunk/src/sys/console.rs"
click node_sound "https://github.com/vinc/moros/tree/trunk/src/sys/snd"
click node_memory "https://github.com/vinc/moros/tree/trunk/src/sys/mem"
click node_filesystem "https://github.com/vinc/moros/tree/trunk/src/sys/fs"
click node_ata "https://github.com/vinc/moros/blob/trunk/src/sys/ata.rs"
click node_process "https://github.com/vinc/moros/blob/trunk/src/sys/process/mod.rs"
click node_ksyscall "https://github.com/vinc/moros/tree/trunk/src/sys/syscall"
click node_api "https://github.com/vinc/moros/tree/trunk/src/api"
click node_shell "https://github.com/vinc/moros/blob/trunk/src/usr/shell/mod.rs"
click node_command_exec "https://github.com/vinc/moros/blob/trunk/src/usr/shell/exec.rs"
click node_commands "https://github.com/vinc/moros/tree/trunk/src/usr"
click node_lisp "https://github.com/vinc/moros/blob/trunk/src/usr/lisp/mod.rs"
click node_editor "https://github.com/vinc/moros/blob/trunk/src/usr/edit.rs"
click node_network_stack "https://github.com/vinc/moros/tree/trunk/src/sys/net"
click node_nic "https://github.com/vinc/moros/tree/trunk/src/sys/net/nic"
click node_network_apps "https://github.com/vinc/moros/tree/trunk/src/usr"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_bootloader,node_boot,node_kernel,node_operator toneBlue
class node_hardware,node_display,node_sound,node_ata toneAmber
class node_memory,node_filesystem,node_process,node_ksyscall toneMint
class node_api,node_shell,node_command_exec,node_commands,node_lisp,node_editor toneRose
class node_network_stack,node_nic,node_network_apps toneIndigo
```

## Components

### Boot and kernel

- **External bootloader**
- [Boot support](https://github.com/vinc/moros/tree/trunk/src/sys/boot): `src/sys/boot`
- [Kernel entry](https://github.com/vinc/moros/blob/trunk/src/main.rs): `src/main.rs`

### Hardware and devices

- [Hardware support](https://github.com/vinc/moros/tree/trunk/src/sys): `src/sys`
- [Console and VGA](https://github.com/vinc/moros/blob/trunk/src/sys/console.rs): `src/sys/console.rs`
- [Sound drivers](https://github.com/vinc/moros/tree/trunk/src/sys/snd): `src/sys/snd`
- [ATA storage](https://github.com/vinc/moros/blob/trunk/src/sys/ata.rs): `src/sys/ata.rs`

### Kernel services

- [Memory management](https://github.com/vinc/moros/tree/trunk/src/sys/mem): `src/sys/mem`
- [Filesystem](https://github.com/vinc/moros/tree/trunk/src/sys/fs): `src/sys/fs`
- [Process management](https://github.com/vinc/moros/blob/trunk/src/sys/process/mod.rs): `src/sys/process/mod.rs`
- [Kernel syscalls](https://github.com/vinc/moros/tree/trunk/src/sys/syscall): `src/sys/syscall`

### Userspace

- [Userspace API](https://github.com/vinc/moros/tree/trunk/src/api): `src/api`
- [Shell](https://github.com/vinc/moros/blob/trunk/src/usr/shell/mod.rs): `src/usr/shell/mod.rs`
- [Command execution](https://github.com/vinc/moros/blob/trunk/src/usr/shell/exec.rs): `src/usr/shell/exec.rs`
- [Utilities and games](https://github.com/vinc/moros/tree/trunk/src/usr): `src/usr`
- [Lisp interpreter](https://github.com/vinc/moros/blob/trunk/src/usr/lisp/mod.rs): `src/usr/lisp/mod.rs`
- [Text editor](https://github.com/vinc/moros/blob/trunk/src/usr/edit.rs): `src/usr/edit.rs`

### Networking

- [Network stack](https://github.com/vinc/moros/tree/trunk/src/sys/net): `src/sys/net`
- [Network drivers](https://github.com/vinc/moros/tree/trunk/src/sys/net/nic): `src/sys/net/nic`
- [Network applications](https://github.com/vinc/moros/tree/trunk/src/usr): `src/usr`

### Other components

- **Computer user**

## Connections

- Computer user → External bootloader: starts system
- External bootloader → Boot support: loads kernel
- Boot support → Kernel entry: initializes
- Kernel entry → Hardware support: initializes subsystems (evidence: `src/sys/mod.rs`)
- Kernel entry → Userspace API: exposes userspace
- Hardware support → Console and VGA: provides console (evidence: `src/sys/mod.rs`)
- Hardware support → Sound drivers: registers drivers (evidence: `src/sys/mod.rs`)
- Hardware support → ATA storage: includes ATA support (evidence: `src/sys/mod.rs`)
- Hardware support → Network stack: includes networking (evidence: `src/sys/mod.rs`)
- Filesystem → ATA storage: mounts ATA disks (evidence: `src/sys/fs/mod.rs`)
- Process management → Memory management: uses address spaces (evidence: `src/sys/process/mod.rs`)
- Process management → Kernel syscalls: handles syscall context (evidence: `src/sys/process/mod.rs`)
- Kernel syscalls → Filesystem: serves filesystem operations (evidence: `src/sys/syscall/mod.rs`)
- Userspace API → Kernel syscalls: issues syscalls (evidence: `src/api/syscall.rs`)
- Userspace API → Filesystem: accesses files (evidence: `src/api/fs.rs`)
- Userspace API → Process management: manages processes (evidence: `src/api/process.rs`)
- Computer user → Shell: uses
- Shell → Command execution: dispatches commands (evidence: `src/usr/shell/mod.rs`)
- Command execution → Utilities and games: runs utilities (evidence: `src/usr/shell/exec.rs`)
- Shell → Userspace API: uses userspace services (evidence: `src/usr/shell/mod.rs`)
- Computer user → Lisp interpreter: invokes interpreter
- Computer user → Text editor: edits text
- Computer user → Network applications: runs network commands
- Network stack → Network drivers: uses device drivers (evidence: `src/sys/net/mod.rs`)
- Network applications → Userspace API: uses userspace services (evidence: `src/usr/lisp/mod.rs`)
