You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mectov OS v25.0 — The IntelliMouse, SB16 Audio & Shared Library Update
The Mectov Kernel — an operating system kernel written from scratch in C and Assembly. No external libraries, no libc, no POSIX — every byte runs directly on hardware.
About
Mectov OS is a hobby operating system designed as a learning project and technical showcase. It boots via GRUB Multiboot, sets up protected mode with paging, and provides a fully graphical desktop environment with floating windows, custom static wallpapers, persistent draggable icons, hardware detection, standalone Ring 3 user applications, and real internet connectivity.
The v25.0 release delivers a massive ergonomics, audio, and architectural upgrade:
Physical Mouse Scroll Support: IntelliMouse 4-byte protocol driver with custom rate-negotiation, kernel event loop propagation, and scroll events delivered directly to Ring 3 user-space applications (Browser, Explorer, PCI Manager, Volume Control).
Dynamic Sound & Music (SB16): Upgraded kernel audio sub-system to drive Sound Blaster 16 ISA registers, playing and rendering .wav audio files smoothly in the new Graphical Music Player (mplayer.mct).
Homegrown Shared Library System (libc.mct): Homegrown dynamic linking DLL-style loader that lets Ring 3 user applications share a single runtime libc.mct library in the virtual file system, shrinking application sizes down to ~1KB.
Enhanced Kernel Stability & Network: Increased user stack size to 64KB (from 8KB) to fully isolate heavy network and DNS payload buffers, and updated DNS querying to route over QEMU's virtual gateway (10.0.2.3).
TCP Real-time Debugging: Replaced files-only logging with a real-time TCP serial logging bridge over port 45454, paired with interactive python tools (debug.py).
Secondary ext2 Partition: Multi-drive ATA support mounting a secondary 2MB virtual disk (ext2.img) automatically formatted as ext2 filesystem partition under QEMU index 1.
Enhanced GUI Terminal Emulator: Re-engineered Ring 3 Terminal (terminal.c) with a 16-command circular history buffer (navigated using Up/Down arrow keys) and an active, dynamic VFS-based Tab autocomplete system for shell commands and filenames.
Private Gitea Migration: Configured personal Gitea repository hosting remote (gitea) pointing to the home server at https://git.mectov.my.id/maliffadlan/Mectov-OS.git to migrate from GitHub to a private self-hosted Git repository server.
Shadow Framebuffer: Triple-buffer architecture (back_buffer → front_buffer_copy → VGA MMIO). Only pixels that actually changed are written to hardware, eliminating thousands of expensive KVM VM-Exits per frame.
VSync Disabled: Removed VGA port 0x3DA polling which caused massive latency spikes under KVM virtualization.
Forced 60Hz Loop: Constant 16ms redraw cycle with ultra-low render times (~4ms) thanks to delta-only copying.
Microsecond Timing: Real-time FPS and render time measurement using PIT hardware counters.
Frame Bitmap Allocator: Tracks 128MB of physical memory (32768 pages) with a compact bitmap for O(1) allocation/free.
Per-Process Address Spaces:vmm_create_page_dir() creates new page directories, vmm_clone_page_dir() copies kernel mappings for fork-like scenarios, vmm_free_page_dir() tears down an address space.
Page Mapping:vmm_map_page() / vmm_map_pages() / vmm_unmap_page() with automatic TLB invalidation on CR3 reload.
Region Allocator:vmm_find_free_region() locates free virtual address ranges starting at 0x08000000.
Foundation for future demand paging and Copy-on-Write (COW) for Ring 3 process isolation.
8. IPC — Inter-Process Communication (src/sys/ipc.c + src/include/ipc.h)
Named Message Queues: Fixed-size 64-byte messages with a 16-deep circular buffer per queue.
Create & Connect:ipc_create_queue(name) for server processes, ipc_connect_queue(name) for clients.
Blocking Receive:ipc_receive() blocks the calling task until a message arrives, with tick-based timeout support.
Non-blocking Send:ipc_send() returns -1 immediately if the queue is full.
Enables service-oriented architecture and clean multitasking app ecosystem.
4-Level Priority Round-Robin: IDLE(0) < LOW(1) < NORMAL(2) < HIGH(3). Higher priority runnable tasks always run first; round-robin scheduling within the same priority level.
Thread API:task_create_thread() spawns a thread within the same process (shared address space) using a pid/tid model. task_exit_thread() terminates the current thread.
Sleep/Wake:task_sleep(ticks) suspends a task for a specified duration; task_wake() resumes it. Used for efficient blocking I/O and timing.
Process Lifecycle:task_kill(tid) for external termination (used by Ctrl+C). Zombie process detection in SYS_GET_EVENT auto-kills orphaned tasks.
True CPU Yielding: SYS_YIELD now executes sti;hlt;cli to properly surrender the CPU until the next scheduler tick.
Full context switching: general-purpose registers, EFLAGS, ESP, and per-task page_dir pointer for VMM integration.
Per-task dual stacks: 16KB kernel stack + upgraded 64KB user stack to fully isolate memory under intensive network socket, file parsing, and DNS payload operations.
IRQ0-driven scheduler tick (1000Hz) with cooperative yield.
RTL8139 NIC Driver: Full driver with PCI bus mastering.
Ethernet/ARP/IPv4/ICMP/UDP/DNS: Complete local stack built directly into the kernel space.
Reliable DNS Resolution: Upgraded DNS queries to point to QEMU's virtual gateway DNS server at 10.0.2.3 (switching from hardcoded 8.8.8.8) for robust internet routing.
Background Net Poller: Embedded packet listening into the timer-based process scheduler to handle asynchronous inbound packets gracefully.
Terminal commands: ping [ip] and host [domain].
11. Persistent File System (src/sys/vfs.c)
Virtual File System (16 file slots) with auto-save to disk.img via ATA PIO.
Persistence Fix: Reliable saving for configuration files like icons.cfg.
Reference counting: Global FD entries with ref_count for safe sharing between threads.
UNIX Pipe support:do_sys_pipe() creates a unidirectional pipe pair for inter-process data streaming.
Full syscall integration: sys_open, sys_read, sys_write, sys_close, sys_pipe all route through the FD layer.
13. MCT Application Runtime (.mct)
Custom Binary Format: 16-byte header with magic number verification and entry point specification.
Fixed-Base Mapping: Applications are mapped at virtual address 0x02000000 within their own isolated page directory.
Privilege Isolation: Clean transition from Ring 0 to Ring 3 via iret, ensuring user apps cannot execute privileged instructions.
Launch Arguments: The kernel can pass arguments (like filenames) to newly launched Ring 3 tasks, retrievable via SYS_GET_LAUNCH_ARG.
Independent Stacks: Each Ring 3 task maintains separate 16KB kernel and 64KB user stacks to avoid stack pointer overflows during large buffer parses.
14. User-Mode GUI API
Direct Window Management: Ring 3 applications can now create, raise, and close their own GUI windows via syscalls.
Graphics Primitive Syscalls: Accelerated SYS_DRAW_RECT and SYS_DRAW_TEXT for rendering directly into the application's window buffer.
Event Polling & Persistence:SYS_GET_EVENT allows user apps to respond to window-specific mouse and keyboard input. It implements a two-phase close signal, giving apps a chance to safely save data to the VFS before terminating.
Flicker-Free Updates:SYS_UPDATE_WINDOW ensures changes are committed to the display list and rendered during the next 60Hz frame sync.
Safe Syscall Entry: Every pointer passed from Ring 3 is validated via validate_user_ptr to prevent kernel memory corruption or unauthorized data access.
Address Boundary Checks: Enforces strict memory boundaries (USER_MEM_LIMIT) for all syscall parameters.
Zombie Cleanup: The kernel automatically detects and terminates Ring 3 processes whose GUI windows have been closed (if they refuse to exit voluntarily), preventing orphaned tasks and resource leaks.
Privilege Separation: Use of Global Descriptor Table (GDT) and Task State Segment (TSS) to strictly enforce CPU privilege levels (Ring 0 vs Ring 3).
16. PS/2 IntelliMouse Scroll Wheel Support (src/drivers/mouse.c & src/gui/wm.c)
Driver Upgrade: Upgraded PS/2 mouse driver to the 4-byte IntelliMouse protocol, using a custom rate-negotiation sequence (200 -> 100 -> 80) to detect scroll-capable hardware.
Kernel Event Routing: The main kernel loop catches scroll deltas and dispatches them via wm_handle_scroll() to targeted windows, encoding up/down ticks as custom button events (0x10 and 0x20).
Ring 3 Event Propagation: Emits standard event type 4 (Scroll Event) containing scroll direction delta (+1 for up, -1 for down) to Ring 3 apps via the SYS_GET_EVENT syscall.
Full Application Integration: Native vertical scrolling integrated seamlessly across standard user-space applications:
Mini Browser: Scrolls active web page contents effortlessly (3 lines per tick).
File Explorer: Easy navigation through folder list structures.
PCI Manager: Smooth scrolling through the system hardware list.
Volume Manager: Intuitive scroll-to-adjust volume control (adjusts volume by ±5 per notch).
17. Sound Blaster 16 (SB16) Audio System (src/drivers/sb16.c)
Sound Blaster Hardware Driver: Native ISA direct-register programming for Sound Blaster 16 compatibility.
Dynamic WAV Playback: Supports loading and decoding dynamic 8-bit/16-bit mono/stereo .wav files via VFS and streaming audio through the virtual DSP.
Sound Synthesis: Support for playing discrete frequencies (beeps) with programmable duration directly through Sound Blaster or PC Speaker hardware.
Volume Controller Integration: Mapped to QEMU's PA sound engine (-device sb16,audiodev=snd0) for clear real-time system audio feedback.
18. Homegrown Dynamic Shared Library System (apps/lib/libc.c & libc.h)
Dynamic Runtime Linking (libc.mct): Built a homegrown dynamic linking and loading subsystem. The dynamic loader (SYS_LOAD_LIBRARY / mct_load_library) retrieves the memory base of the export table for a library in memory.
Extremely Slim Binaries: Ring 3 application executables (like browser.mct, explorer.mct, notepad.mct) no longer statically compile common functions, shrinking binary file sizes from 30KB+ to under 2KB.
Standard Lib Wrappers: Full resolution of standard library functions at runtime via export table pointer indexes (__mct_lib_ptr):
19. Multi-Drive & Secondary ext2 Partition Support (src/sys/vfs.c & run.sh)
ATA Dual Drive Support: Kernel ATA driver upgraded to detect and mount secondary IDE/ATA devices.
Secondary ext2 Disk: Automatically creates and mounts a secondary 2MB virtual disk (ext2.img) initialized via mkfs.ext2 at index 1 in QEMU.
Web Gateway Proxy Integration (gateway.py): Background gateway process running on the host that translates QEMU network queries and streams live data between the guest OS and the real internet.
TCP Real-time Debugging Socket: Serial port debugging upgraded to a TCP socket server on port 45454 (replacing files-only logging), allowing real-time, zero-lag log streaming into our python interactive debugger (debug.py).
Arrow-Key Command History: Tracks up to 16 commands in a local circular history buffer. Intercepts non-ASCII Up Arrow (0xE048) and Down Arrow (0xE050) key events, visually clearing the input line using backspaces and replacing it with the history entry.
Dynamic VFS Tab Completion: Intercepts Tab (\t) key events, parses the current word prefix, and dynamically queries the VFS via sys_stat_file and sys_list_dir to autocomplete both built-in shell commands and active directory files/folders.
Home Server Remote Tracking: Added a dedicated gitea Git remote tracking the repository at https://git.mectov.my.id/maliffadlan/Mectov-OS.git.
Infrastructure Autonomy: Seamlessly routes all future feature branch pushes, commit tracking, and code releases directly onto the self-hosted Gitea home server, operating as the primary remote alongside GitHub.
Syscall API Reference
All syscalls are invoked via int 0x80. Register conventions: EAX=syscall number, EBX/ECX/EDX/ESI/EDI=arguments.
Core Syscalls (1–10)
#
Name
Description
1
SYS_PRINT
Print string. EBX=str_ptr, ECX=color
2
SYS_OPEN
Open/create VFS file. EBX=filename → return fd
3
SYS_READ
Read file. EBX=fd, ECX=buf, EDX=size → bytes read
4
SYS_WRITE
Write file. EBX=fd, ECX=buf, EDX=size → bytes written
Deploy: The Makefile automatically handles this and uses inject_vfs.py to bake the .mct binaries into disk.img.
Version History
Version
Highlights
v25.0
IntelliMouse, Audio, Shell & Git Enhancements: Upgraded mouse driver to 4-byte IntelliMouse protocol supporting smooth scrolling in Browser, Explorer, PCI, and Volume Manager. Upgraded kernel audio to Sound Blaster 16 supporting dynamic WAV music stream playback. Built a dynamic shared library system (libc.mct) with a dynamic loading subsystem, reducing app binary sizes to ~1KB. Increased user stacks to 64KB and updated DNS to route over virtual gateway. Enhanced GUI Terminal with 16-command history buffer (Up/Down arrow navigation) and dynamic client-side VFS Tab completion. Gitea Migration: Added self-hosted home server remote gitea for private repository tracking.
v24.0
DOOM Engine Port: Fully playable port of the classic 1993 DOOM engine integrated directly into the kernel. Features keyboard polling, double buffer to MMIO front buffer translation, graceful OS exiting (vga_force_sync), and proper process teardown.
v23.0
Performance & Stability: Shadow Framebuffer (delta-only MMIO), VSync removal, zombie process detection + auto-kill, task_kill() API, Ctrl+C signal, Ctrl key tracking, Snake rewritten as WM app, terminal prompt protection, smart tab-completion with trailing space/slash, carriage return support, history display fix, power menu restart fix, -no-reboot removal.
v22.0
Kernel Modernization: Virtual Memory Manager (per-process address spaces, page mapping, region allocator), IPC named message queues (non-blocking send, blocking receive with timeout), 4-level priority thread scheduling with sleep/wake API, and 14 new syscalls (VMM/thread/IPC).
v21.0
Premium UI Refinement: High-res sleek mouse cursor with dynamic shadow, classic 3-arc WiFi indicator in system tray, and return to forced 60Hz real-time rendering loop.
v20.0
Modern UI Modernization: Professional squircle icons, vibrant macOS buttons with symbols (X, -, +), taskbar separator, flat design removal of shadows.
Salah satu proyek OS hobi buatan Indonesia yang paling lengkap dan terdokumentasi dengan baik di GitHub saat ini
About
Sistem operasi 32-bit (x86) buatan mahasiswa Indonesia dari nol. GUI, Multitasking, Networking, dan User Mode (Ring 3) tanpa pustaka eksternal. credit M Alif fadlan