# abdooowd/abdooos-64bit architecture

> Architecture diagram of the GitHub repository abdooowd/abdooos-64bit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdooowd/abdooos-64bit
- Repository: https://github.com/abdooowd/abdooos-64bit

## Overview

##### Main System Components

a) Kernel Core (src/kernel/)
- GDT (Global Descriptor Table)
- Hardware Abstraction Layer (HAL)
- Shell interface

b) Memory Management (src/mm/)
- Physical Memory Manager (PMM)
- This directly to the kernel core

c) CPU Management (src/cpu/)
- CPU initialization
- PIC (Programmable Interrupt Controller)
- Direct connection to kernel

d) Interrupt System (src/interrupts/)
- IDT (Interrupt Descriptor Table)
- IRQ (Interrupt Request) handling
- ISR (Interrupt Service Routines)
- PIT (Programmable Interval Timer)

e) Drivers Layer (src/drivers/)
- Keyboard driver
- Screen driver
- To HAL

f) File Systems (src/fs/)
- VFS (Virtual File System)
- FAT32 implementation
- IMFS (In-Memory File System)
- Connection to kernel through VFS interface

g) Library Layer (src/lib/)
- Memory operations
- String handling
- Formatting
- Utility functions

##### Key Relationships to Highlight

- How interrupts flow from hardware through the PIC to the interrupt handlers
- Demonstrate the VFS abstraction over concrete filesystem implementations
- How drivers interact with hardware through the HAL
- Memory management's relationship with the kernel and other components

##### Additional Elements

Important aspects:
- Boot process flow (Limine bootloader)
- System initialization sequence
- Memory layout
- Device management flow

##### Documentation Notes

- Component types
- Initialization order
- Key interfaces

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef hardware fill:#90EE90,stroke:#333,stroke-width:2px
    classDef kernel fill:#ADD8E6,stroke:#333,stroke-width:2px
    classDef filesystem fill:#FFD700,stroke:#333,stroke-width:2px
    classDef library fill:#D3D3D3,stroke:#333,stroke-width:2px
    classDef interrupt fill:#FFB6C1,stroke:#333,stroke-width:2px
    classDef driver fill:#98FB98,stroke:#333,stroke-width:2px

    %% Hardware Layer
    subgraph Hardware
        HW[Hardware Components]:::hardware
        CPU[CPU]:::hardware
        KB[Keyboard]:::hardware
        DISP[Display]:::hardware
    end

    %% Core Kernel Layer
    subgraph KernelCore
        KERN[Kernel Core]:::kernel
        click KERN "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/kernel/kernel.c"
        GDT[Global Descriptor Table]:::kernel
        click GDT "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/kernel/gdt.c"
        HAL[Hardware Abstraction Layer]:::kernel
        click HAL "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/kernel/hal/hal.c"
        SHELL[Shell Interface]:::kernel
        click SHELL "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/kernel/shell.c"
    end

    %% Memory Management
    subgraph MemoryMgmt
        PMM[Physical Memory Manager]:::kernel
        click PMM "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/mm/pmm.c"
    end

    %% CPU Management
    subgraph CPUMgmt
        CPUINIT[CPU Initialization]:::kernel
        click CPUINIT "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/cpu/cpu.c"
        PIC[Programmable Interrupt Controller]:::kernel
        click PIC "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/cpu/pic.c"
    end

    %% Interrupt System
    subgraph InterruptSystem
        IDT[Interrupt Descriptor Table]:::interrupt
        click IDT "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/interrupts/idt.c"
        IRQ[Interrupt Request Handler]:::interrupt
        click IRQ "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/interrupts/irq.c"
        ISR[Interrupt Service Routines]:::interrupt
        click ISR "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/interrupts/isr.c"
        PIT[Programmable Interval Timer]:::interrupt
        click PIT "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/interrupts/pit.c"
    end

    %% Drivers Layer
    subgraph Drivers
        KBD[Keyboard Driver]:::driver
        click KBD "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/drivers/keyboard.c"
        SCREEN[Screen Driver]:::driver
        click SCREEN "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/drivers/screen.c"
    end

    %% File Systems
    subgraph FileSystems
        VFS[Virtual File System]:::filesystem
        click VFS "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/fs/vfs.c"
        FAT32[FAT32]:::filesystem
        click FAT32 "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/fs/fat32.c"
        IMFS[In-Memory File System]:::filesystem
        click IMFS "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/fs/imfs.c"
    end

    %% Library Layer
    subgraph Libraries
        MEMLIB[Memory Operations]:::library
        click MEMLIB "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/lib/mem.c"
        STRLIB[String Handling]:::library
        click STRLIB "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/lib/string.c"
        FMTLIB[Formatting]:::library
        click FMTLIB "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/lib/formatter.c"
        UTILLIB[Utilities]:::library
        click UTILLIB "https://github.com/AbdooOwd/AbdooOS-64bit/blob/main/src/lib/util/util.h"
    end

    %% Relationships
    CPU --> CPUINIT
    CPUINIT --> KERN
    PIC --> InterruptSystem
    KB --> KBD
    DISP --> SCREEN
    KBD --> HAL
    SCREEN --> HAL
    HAL --> KERN
    PMM --> KERN
    GDT --> KERN
    IDT --> KERN
    IRQ --> IDT
    ISR --> IDT
    PIT --> IRQ
    VFS --> KERN
    FAT32 --> VFS
    IMFS --> VFS
    SHELL --> KERN
    MEMLIB --> KERN
    STRLIB --> KERN
    FMTLIB --> KERN
    UTILLIB --> KERN

    %% Legend
    subgraph Legend
        L1[Hardware Components]:::hardware
        L2[Kernel Components]:::kernel
        L3[File Systems]:::filesystem
        L4[Libraries]:::library
        L5[Interrupt System]:::interrupt
        L6[Drivers]:::driver
    end
```
