Skip to content

Feature/major system improvements#9

Merged
viralcode merged 6 commits intomainfrom
feature/major-system-improvements
Jan 18, 2026
Merged

Feature/major system improvements#9
viralcode merged 6 commits intomainfrom
feature/major-system-improvements

Conversation

@viralcode
Copy link
Owner

No description provided.

…ss spaces, and more

Phase 1 - Userspace Improvements:
- Enhanced ELF loader for true userspace process execution
- Added user address space management (mm_struct, vm_area)
- Implemented vmm_map_user_page() and vmm_map_user_range()
- Created userspace media library header (user/lib/media.h)

Phase 2 - Network Stack:
- Implemented complete TCP state machine (SYN/SYN-ACK/ACK/FIN)
- Added tcp_send_packet() for building and sending TCP segments
- Added tcp_handle_segment() for processing incoming TCP
- Implemented ARP request/reply handling
- Added IP packet processing (ICMP, TCP, UDP dispatch)
- Proper connection tracking with tcp_find_connection()

Phase 3 - Hardware Improvements:
- Rewrote Intel HDA driver with proper DMA ring buffers
- Added 256KB ring buffer with 32 BDL entries
- Implemented intel_hda_stop() and intel_hda_is_playing()
- Added cache flush helpers for DMA coherency

SMP Support:
- Added spinlock implementation (spin_lock/spin_unlock)
- Implemented smp_processor_id(), smp_num_cpus()
- Added PSCI-based secondary CPU boot (smp_boot_secondary)
- Added per-CPU GIC initialization (gic_cpu_init)
- Added kernel-wide smp_lock()/smp_unlock()

Syscall Improvements:
- Implemented file descriptor table (MAX_FDS=256)
- sys_openat now properly opens files via VFS
- sys_read/sys_write now use FD table
- sys_close properly releases file descriptors
- sys_lseek implemented for file positioning
- sys_execve now loads ELF binaries

All changes maintain backwards compatibility with existing functionality.
Process Manager:
- Added new dock icon replacing Settings with Process Manager
- Process Manager window shows live list of running processes
- Display includes PID, Name, State with color coding
- Kill button for each process to terminate via process_kill()
- Footer shows total processes and running count
- Click handling for kill buttons with confirmation

Multi-threading Support:
- Added CLONE_* flags for pthread-compatible thread creation
- Implemented create_thread() for spawning threads
- Threads share memory space with parent (CLONE_VM)
- Added get_task_by_pid() for task lookup
- Added sched_kill_task() for graceful task termination
- Updated clone syscall to use new threading infrastructure

Process API Enhancements:
- process_get_info() now returns actual PID instead of 1
- Added process_list() for bulk process enumeration
- State names and colors for visual process status

All features maintain backwards compatibility.
- Add Process Manager to applications list
- Document multi-threading via clone() syscall with CLONE_VM
- Document SMP infrastructure (boots on CPU 0)
- Update architecture diagram with Process Manager and SMP
- Mark completed roadmap items (multi-core, process manager, threading)
- Update 'What Works' section with new features
Fix x86_64 build failure - smp_init was only defined for ARM64.
Added stub implementation that prints initialization message.
sys_execve Implementation:
- Set up user stack with argc/argv/envp pointers
- Push strings and build pointer arrays on stack
- Allocate mm_struct with code/data/stack/brk info
- arch_enter_userspace() jumps to EL0/Ring3 via eret/iretq
- ARM64: Sets up spsr_el1, elr_el1, sp_el0 for EL0 entry
- x86_64: Builds IRETQ frame with proper CS/SS selectors

EXT4 Write Support (Full Implementation):
- ext4_write_block_raw: Write blocks to disk
- ext4_write_inode: Update inode on disk
- ext4_alloc_block: Allocate from block bitmap
- ext4_free_block: Free block to bitmap
- ext4_alloc_inode: Allocate from inode bitmap
- ext4_free_inode: Free inode to bitmap
- ext4_get_file_block: Support indirect blocks (single/double)
- ext4_set_file_block: Set block mapping with allocation
- ext4_add_dir_entry: Add entry to directory
- ext4_write_file: Write data to file with block allocation
- ext4_create_file: Create new file with directory entry
- ext4_sync_superblock: Flush superblock to disk
- Public VFS API: ext4_vfs_read/write/create/mkdir/truncate/sync/stat

Infrastructure:
- mm_struct: Added code/data/stack/brk/arg/env segment fields
- types.h: Added atomic_set/read/inc/dec/dec_and_test helpers
@viralcode viralcode merged commit d35d603 into main Jan 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant