Overview

FreeWorld OS uses a hybrid architecture combining low-level boot components (ASM/C/C++) with a high-level Node.js runtime for the core system.

Architecture Layers

Layer 1: Boot Layer (ASM/C/C++)

  • BOOTMGR: Boot manager (Assembly, 16-bit real mode)
  • BCD: Boot Configuration Data (C)
  • freeload.exe: OS loader (C)
  • fwoskrnl.exe: Kernel executive
    • kernel_entry.asm: Assembly boot code (16-bit → 32-bit → 64-bit transition)
    • fwoskrnl.c: C kernel executive (32-bit protected mode, transitioning to 64-bit)
    • arch/x64/: 64-bit architecture support (long mode transition, 64-bit kernel)
  • hal.dll: Hardware Abstraction Layer (C)
Status: Protected mode and long mode transitions are working. The kernel successfully transitions from 16-bit real mode to 32-bit protected mode, and then to 64-bit long mode. Full 64-bit support is implemented.

Layer 2: System Services (C)

  • smss.exe: Session Manager
  • csrss.exe: Client Server Runtime
  • freeworldlogon.exe: Login Manager

Layer 3: User Interface (C)

  • shell.exe: Command-line shell
  • wanderer.exe: File manager

Layer 4: Node.js Runtime

  • system/index.js: Core system entry point
  • system/window.js: Window management API
  • system/desktop.js: Desktop environment
  • system/api.js: System API
  • system/filesystem.js: Filesystem API

Supported Architectures

  • x86_64: Primary architecture
    • Boot: 16-bit real mode (x86 compatibility)
    • Kernel: 32-bit protected mode (current implementation)
    • Future: 64-bit long mode
  • ARM64: ARM 64-bit support (planned)
  • RISC-V: RISC-V architecture support (planned)
  • Future: Extensible for new architectures

CPU Modes & Transitions

Boot Sequence

  1. Real Mode (16-bit):
    • BIOS loads boot sector at 0x7C00
    • BOOTMGR executes in 16-bit real mode
    • Kernel entry point starts in 16-bit real mode
  2. Protected Mode (32-bit):
    • GDT setup (flat memory model, 4GB segments)
    • A20 line enable
    • CR0.PE bit set
    • 32-bit far jump to protected mode entry point
    • Segment registers reloaded with protected mode selectors
    • IDT initialized
  3. Long Mode (64-bit): Planned for future

Filesystem Structure

FreeWorld uses a Linux-like filesystem structure:

  • /bin - Essential binaries
  • /boot - Boot files
  • /dev - Device files
  • /etc - Configuration files
  • /home - User home directories
  • /lib - Shared libraries
  • /mnt - Mount points
  • /opt - Optional software
  • /proc - Process information
  • /root - Root user home
  • /sbin - System binaries
  • /sys - System information
  • /tmp - Temporary files
  • /usr - User programs
  • /var - Variable data

Window Management

FreeWorld provides an HWND-like API for window management:

  • Window Handles: Format "FW_HWND_<id>"
  • Window Classes: Window, WindowManager
  • Message Loop: Handled by CSRSS
  • Desktop Environment: Similar to KDE, GNOME, Windows

Cross-Platform Support

FreeWorld supports both Windows and Linux file operations:

  • Path separators handled automatically
  • File permissions supported
  • Long file names supported
  • Case sensitivity handled