Hardware Support Configuration
This document explains how to configure SlayerOS for different hardware platforms and devices. Proper hardware configuration is essential for optimal performance and compatibility.
Supported Hardware
SlayerOS currently supports the following hardware:
- CPU Architecture: x86_64 (64-bit)
- Boot: BIOS and UEFI via Limine bootloader
- Graphics: VESA/VBE framebuffer
- Input: PS/2 keyboard and mouse
- Storage: Basic ATA/IDE support
- Serial: 16550 UART
CPU Configuration
x86_64 Features
You can configure which CPU features to use in src/kernel/arch/cpu.cxx
:
// CPU feature configuration
#define USE_SSE 1 // Streaming SIMD Extensions
#define USE_AVX 0 // Advanced Vector Extensions
#define USE_XSAVE 0 // Extended State Save/Restore
SMP Configuration
Symmetric Multiprocessing can be configured in src/kernel/arch/smp.cxx
:
// SMP configuration
#define MAX_CPUS 16 // Maximum number of CPU cores supported
#define SMP_ENABLED 1 // Enable SMP support
Memory Configuration
Physical Memory
Configure physical memory limits in src/include/host/flags.h
:
// Physical memory configuration
#define MAX_PHYSICAL_MEMORY (4ULL * 1024 * 1024 * 1024) // 4GB max physical memory
Virtual Memory
Configure virtual memory layout in misc/linkage.ld
and src/mem/paging.cxx
:
// Virtual memory layout
#define KERNEL_VIRT_BASE 0xFFFFFFFF80000000 // Kernel base address
#define KERNEL_HEAP_START 0xFFFFFFFFA0000000 // Kernel heap start
#define USER_SPACE_END 0x00007FFFFFFFFFFF // User space end
Graphics Configuration
Framebuffer
Configure framebuffer settings in src/drivers/fb_gfx/fb_driver.cxx
:
// Default framebuffer settings (fallback if bootloader doesn't provide)
#define DEFAULT_FB_WIDTH 800
#define DEFAULT_FB_HEIGHT 600
#define DEFAULT_FB_BPP 32
Input Device Configuration
Keyboard
Configure keyboard settings in src/drivers/kbd/keyboard.cxx
:
// Keyboard configuration
#define KEYBOARD_BUFFER_SIZE 16 // Size of keyboard input buffer
#define USE_US_LAYOUT 1 // Use US keyboard layout
Storage Configuration
Disk Controllers
Configure disk controller support in src/drivers/storage/ata.cxx
:
// ATA/IDE configuration
#define PRIMARY_ATA_BASE 0x1F0 // Primary ATA controller base I/O port
#define SECONDARY_ATA_BASE 0x170 // Secondary ATA controller base I/O port
#define ATA_IDENTIFY_TIMEOUT 1000 // Timeout for ATA identify command (ms)
Serial Port Configuration
Configure serial port settings in src/kernel/arch/serial.cxx
:
// Serial port configuration
#define COM1_PORT 0x3F8 // COM1 base port
#define COM2_PORT 0x2F8 // COM2 base port
#define SERIAL_BAUD_RATE 115200 // Baud rate
Hardware Detection
SlayerOS performs hardware detection during boot:
- CPU Features: Detected using CPUID instruction
- Memory Map: Provided by bootloader
- Devices: Basic detection for common devices
You can configure detection behavior in src/kernel/kern.cxx
:
// Hardware detection configuration
#define DETECT_ACPI 1 // Detect ACPI tables
#define DETECT_PCI 1 // Scan PCI bus
#define VERBOSE_DETECTION 0 // Verbose hardware detection
Hardware-Specific Optimizations
Cache Configuration
Configure cache usage in src/mem/cache.cxx
:
// Cache configuration
#define USE_WRITE_COMBINING 1 // Use write-combining for framebuffer
#define CACHE_LINE_SIZE 64 // CPU cache line size in bytes
I/O Configuration
Configure I/O access methods in src/kernel/arch/io.cxx
:
// I/O configuration
#define USE_MMIO_WHEN_AVAILABLE 1 // Prefer MMIO over port I/O when available
Testing Hardware Compatibility
To test hardware compatibility:
Build SlayerOS with verbose logging enabled:
bashmake DEBUG=1 VERBOSE=1
Run in QEMU with various hardware configurations:
bashmake run QEMU_EXTRA="-cpu host -smp 2"
Check serial output for hardware detection messages
Hardware Configuration Examples
Minimal Hardware Configuration
For minimal systems or maximum compatibility:
#define USE_SSE 0
#define SMP_ENABLED 0
#define DETECT_ACPI 0
#define DETECT_PCI 0
Modern Hardware Configuration
For modern systems with full feature support:
#define USE_SSE 1
#define USE_AVX 1
#define SMP_ENABLED 1
#define MAX_CPUS 32
#define USE_WRITE_COMBINING 1
Best Practices
- Start with conservative hardware settings for maximum compatibility
- Test thoroughly when enabling advanced hardware features
- Provide fallback mechanisms for hardware that lacks certain features
- Document hardware requirements for your specific configuration