]>
Projects (at) Tadryanom (dot) Me - AdrOS.git/log
Tulio A M Mendes [Tue, 10 Feb 2026 03:59:11 +0000 (00:59 -0300)]
fix: add rq_enqueue on wake in keyboard, tty, pty drivers
keyboard.c, tty.c, pty.c all transition processes from BLOCKED to
READY without enqueuing them into the O(1) scheduler runqueue.
This causes woken processes to be invisible to rq_pick_next(),
leading to starvation until the active/expired swap rescues them.
Add sched_enqueue_ready() public API in scheduler.c and call it
from all three wake sites.
Passes: make, cppcheck, QEMU smoke test (10s, all init tests OK).
Tulio A M Mendes [Tue, 10 Feb 2026 03:42:56 +0000 (00:42 -0300)]
POSIX Tiers 1-3: signals, brk/sbrk, nanosleep, raw TTY, O_CLOEXEC, PMM refcount, CoW fork, mmap/munmap, procfs, slab allocator, O(1) scheduler, PCI enumeration, VBE framebuffer
Tier 1:
- Signal characters (Ctrl+C/Z/\ -> SIGINT/SIGTSTP/SIGQUIT) in TTY/PTY
- brk/sbrk syscall with ELF loader heap break support
- nanosleep/clock_gettime syscalls (tick-based)
- Raw TTY mode (non-canonical) + ISIG flag + TIOCGWINSZ/TIOCSWINSZ
Tier 2:
- O_CLOEXEC/FD_CLOEXEC: per-FD flags, fcntl F_GETFD/F_SETFD, close on execve
- PMM ref-counting (uint16_t per-frame, atomic ops)
- Copy-on-Write fork: PTE bit 9 COW marker, page fault handler, vmm_as_clone_user_cow
- mmap/munmap: anonymous MAP_PRIVATE, per-process VMA tracker (32 slots)
- /proc filesystem: /proc/self/status, /proc/uptime, /proc/meminfo
Tier 3:
- Slab allocator: free-list-in-place, per-cache spinlock, auto-grow
- O(1) scheduler: 32-priority bitmap + active/expired runqueue swap
- PCI enumeration: bus/slot/func scan, vendor/device/class/BAR/IRQ
- VBE framebuffer: multiboot2 tag parsing, kernel VA mapping, pixel ops
All changes pass: make clean && make, cppcheck --enable=warning,performance,portability, and QEMU smoke test (10s stable boot, all init tests pass).
Tulio A M Mendes [Tue, 10 Feb 2026 02:35:38 +0000 (23:35 -0300)]
fix: heap coalesce early-return, process_create_kernel leak, pipe double-free, path '..' resolution
Tulio A M Mendes [Tue, 10 Feb 2026 02:16:07 +0000 (23:16 -0300)]
docs: update README, BUILD_GUIDE, and POSIX_ROADMAP to reflect current state
Tulio A M Mendes [Tue, 10 Feb 2026 02:04:53 +0000 (23:04 -0300)]
posix: generic readdir/getdents across all VFS (tmpfs, devfs, overlayfs, diskfs)
Tulio A M Mendes [Tue, 10 Feb 2026 01:56:35 +0000 (22:56 -0300)]
posix: add rename and rmdir syscalls (diskfs)
Tulio A M Mendes [Tue, 10 Feb 2026 01:50:22 +0000 (22:50 -0300)]
posix: add openat, fstatat, unlinkat syscalls (AT_FDCWD)
Tulio A M Mendes [Tue, 10 Feb 2026 01:37:59 +0000 (22:37 -0300)]
posix: add pipe2 and dup3 syscalls
Tulio A M Mendes [Tue, 10 Feb 2026 01:21:12 +0000 (22:21 -0300)]
posix: add chdir/getcwd and relative path resolution
Tulio A M Mendes [Tue, 10 Feb 2026 01:12:20 +0000 (22:12 -0300)]
posix: add fcntl(F_SETFL) O_NONBLOCK for pipes and tty/pty
Tulio A M Mendes [Tue, 10 Feb 2026 01:01:09 +0000 (22:01 -0300)]
user: add isatty smoke test via TCGETS
Tulio A M Mendes [Tue, 10 Feb 2026 00:54:17 +0000 (21:54 -0300)]
vfs: add getdents syscall for diskfs directories
Tulio A M Mendes [Tue, 10 Feb 2026 00:41:56 +0000 (21:41 -0300)]
diskfs: add mkdir/unlink syscalls
Tulio A M Mendes [Tue, 10 Feb 2026 00:32:53 +0000 (21:32 -0300)]
diskfs: add hierarchical directories and migrate v2 layout
Tulio A M Mendes [Tue, 10 Feb 2026 00:23:15 +0000 (21:23 -0300)]
persistfs: back /persist/counter by diskfs
Tulio A M Mendes [Tue, 10 Feb 2026 00:11:50 +0000 (21:11 -0300)]
diskfs: add minimal on-disk filesystem mounted at /disk
Tulio A M Mendes [Tue, 10 Feb 2026 00:02:00 +0000 (21:02 -0300)]
uaccess: recover from kernel page faults during copy_*_user
Tulio A M Mendes [Mon, 9 Feb 2026 23:41:42 +0000 (20:41 -0300)]
pty: add minimal /dev/ptmx and /dev/pts/0
Tulio A M Mendes [Mon, 9 Feb 2026 23:25:14 +0000 (20:25 -0300)]
signal: add SA_SIGINFO and sigaction ABI
Tulio A M Mendes [Mon, 9 Feb 2026 22:57:17 +0000 (19:57 -0300)]
x86: deliver SIGSEGV on user page faults
Tulio A M Mendes [Mon, 9 Feb 2026 22:46:39 +0000 (19:46 -0300)]
user: add errno-based syscall wrappers
Tulio A M Mendes [Mon, 9 Feb 2026 22:40:42 +0000 (19:40 -0300)]
tools: avoid host macro collisions in user init (cppcheck)
Tulio A M Mendes [Mon, 9 Feb 2026 22:31:03 +0000 (19:31 -0300)]
docs: update POSIX roadmap with sigreturn
Tulio A M Mendes [Mon, 9 Feb 2026 20:59:27 +0000 (17:59 -0300)]
x86: add sigreturn trampoline and fix execve stack usage
Implement SYSCALL_SIGRETURN and userland signal trampoline/sigframe so handlers can return safely.
Fix x86 signal delivery stack layout to avoid clobbering sigframe/trampoline.
Fix execve heap corruption by avoiding large on-stack argv/envp buffers and adding cleanup.
Add init.elf smoke test for sigreturn.
Tulio A M Mendes [Sun, 8 Feb 2026 11:08:52 +0000 (08:08 -0300)]
docs: update POSIX roadmap and persistence notes
Tulio A M Mendes [Sun, 8 Feb 2026 10:51:54 +0000 (07:51 -0300)]
storage: add ATA PIO + persistfs mounted at /persist
Tulio A M Mendes [Sun, 8 Feb 2026 10:49:56 +0000 (07:49 -0300)]
tty: add basic job control (fg pgrp) + SIGTTIN/SIGTTOU
Tulio A M Mendes [Sun, 8 Feb 2026 10:29:50 +0000 (07:29 -0300)]
x86/vmm+elf: fix user ELF mapping and PT access
Tulio A M Mendes [Sun, 8 Feb 2026 07:24:04 +0000 (04:24 -0300)]
cppcheck: const cleanups (full vfs api)
Tulio A M Mendes [Sun, 8 Feb 2026 07:14:56 +0000 (04:14 -0300)]
cppcheck: const cleanups (partial)
Tulio A M Mendes [Sun, 8 Feb 2026 07:01:01 +0000 (04:01 -0300)]
x86: fix fork addr_space clone; add tty ioctl + session/pgrp syscalls
- fork clones from active CR3 and returns correct pid
- vmm_as_clone_user copies user pages via per-AS tmp mapping
- tty: implement ioctl (termios + pgrp) and ICANON/ECHO handling
- add setsid/setpgid/getpgrp syscalls + init.elf smoke tests
- overlayfs: fix cppcheck knownConditionTrueFalse
Tulio A M Mendes [Sun, 8 Feb 2026 04:07:46 +0000 (01:07 -0300)]
posix: add select() syscall (minimal)
Add a minimal select() syscall implemented as a wrapper over poll(). Uses uint64_t read/write fd masks (nfds<=64), timeout semantics aligned with poll, and a userland smoke test with a pipe.
Tulio A M Mendes [Sun, 8 Feb 2026 03:56:13 +0000 (00:56 -0300)]
x86: treat user page fault as SIGSEGV
Handle ISR14 page faults from ring3 by terminating the current process with a SIGSEGV-like status (128+11) instead of kernel panic. Add userland smoke test that triggers a NULL write and validates waitpid status.
Tulio A M Mendes [Sun, 8 Feb 2026 03:53:48 +0000 (00:53 -0300)]
posix: add kill(SIGKILL) syscall
Introduce a minimal kill(pid,sig) syscall with SIGKILL support. Implement process_kill() to mark target as zombie, close its FDs with refcounting, and wake a waiting parent. Add ESRCH and a userland init.elf smoke test.
Tulio A M Mendes [Sun, 8 Feb 2026 03:31:57 +0000 (00:31 -0300)]
posix: poll syscall (pipes + devfs tty/null)
Add a minimal poll() syscall (POLLIN/POLLOUT) with timeout semantics (0 non-blocking, <0 blocking). Support pipe endpoints and devfs char devices (/dev/null,/dev/tty) and add userland smoke tests.
Tulio A M Mendes [Sun, 8 Feb 2026 03:15:54 +0000 (00:15 -0300)]
docs: update POSIX/Unix status (errno, devfs, getppid, WNOHANG)
Document recently implemented Unix/POSIX features: getppid, waitpid(WNOHANG), devfs (/dev/null,/dev/tty), kernel -errno convention, and uaccess hardening.
Tulio A M Mendes [Sun, 8 Feb 2026 03:12:50 +0000 (00:12 -0300)]
posix: standardize -errno in VFS/tmpfs/initrd
Replace remaining -1 style returns in core helpers used by syscalls and early init with negative errno codes (vfs_mount, tmpfs_add_file/mkdir_p, initrd alloc/path helpers). Add missing errno constants (EEXIST/ENOTDIR/ENOSPC).
Tulio A M Mendes [Sun, 8 Feb 2026 03:08:41 +0000 (00:08 -0300)]
posix: remove -1 returns from ELF loader
Convert elf32 loader helpers to return -errno codes (EINVAL/ENOMEM/ENOENT/EIO/EFAULT) instead of -1, aligning with kernel-wide -errno syscall convention.
Tulio A M Mendes [Sun, 8 Feb 2026 03:01:39 +0000 (00:01 -0300)]
posix: tighten uaccess + errno helpers
Return proper -errno from remaining syscall helpers (pipe/fd allocation) and harden copy_to_user to require writable user mappings on x86. copy_{to,from}_user now return -EFAULT on invalid ranges.
Tulio A M Mendes [Sun, 8 Feb 2026 02:55:41 +0000 (23:55 -0300)]
posix: devfs with /dev/null and /dev/tty
Add a minimal devfs mounted at /dev providing /dev/null and /dev/tty char devices. Implement tty_read_kbuf/tty_write_kbuf to support VFS-backed tty IO and allow open/read/write through FS_CHARDEVICE nodes. Add userland smoke tests.
Tulio A M Mendes [Sun, 8 Feb 2026 02:46:46 +0000 (23:46 -0300)]
posix: standardize -errno returns
Adopt negative errno return convention across waitpid/open/fd_close and TTY read/write, add missing errno constants, and return ENOSYS for unknown syscalls.
Tulio A M Mendes [Sun, 8 Feb 2026 02:37:16 +0000 (23:37 -0300)]
posix: getppid syscall
Add SYSCALL_GETPPID and userland wrappers. Include a simple fork-based smoke test validating getppid() in init.elf.
Tulio A M Mendes [Sun, 8 Feb 2026 02:37:06 +0000 (23:37 -0300)]
fix: prevent fork clone stack overflow
Fix vmm_as_clone_user to use a heap-allocated 4KB temp buffer instead of a 4KB stack array (kernel stacks are 4KB). Harden heap free/coalesce logic and diagnostics to better catch corruption/double-free.
Tulio A M Mendes [Sun, 8 Feb 2026 02:15:15 +0000 (23:15 -0300)]
posix: waitpid WNOHANG
Add WNOHANG option support to waitpid in kernel scheduler and syscall path, and include a userland smoke test.
Tulio A M Mendes [Sun, 8 Feb 2026 02:02:09 +0000 (23:02 -0300)]
docs: update POSIX/Unix feature status
Refresh README, build guide, and POSIX roadmap to reflect implemented syscalls (dup/dup2/pipe/fork/execve), mounts/tmpfs/overlayfs, analysis targets, and remaining gaps.
Tulio A M Mendes [Sun, 8 Feb 2026 01:56:55 +0000 (22:56 -0300)]
D3: execve argv/envp userland test
Pass argv/envp from init.elf into execve() and extend echo.elf to parse argc/argv/envp from the initial user stack for validation.
Tulio A M Mendes [Sun, 8 Feb 2026 01:51:33 +0000 (22:51 -0300)]
D3: execve argv/envp stack + errno
Copy argv/envp from user memory and build a minimal initial user stack in the new address space during execve(). Improve errno reporting (EFAULT/ENOENT/ENOMEM/EINVAL).
Tulio A M Mendes [Sun, 8 Feb 2026 01:47:06 +0000 (22:47 -0300)]
D3: fork syscall + remove spawn
Implement fork() by cloning user address space and resuming child in ring3 from a saved register frame. Duplicate FD table via refcounting. Remove temporary spawn syscall and update init.elf waitpid test to use fork().
Tulio A M Mendes [Sun, 8 Feb 2026 01:16:45 +0000 (22:16 -0300)]
D3: dup/pipe/execve syscalls
Add refcounted dup/dup2, pipe() ring buffer, and execve() to replace the current process image. Include userland wrappers, smoke tests, and a second user binary (echo.elf) packaged into initrd.
Tulio A M Mendes [Sun, 8 Feb 2026 00:23:05 +0000 (21:23 -0300)]
build: add scan-build and mkinitrd-asan targets
Tulio A M Mendes [Sun, 8 Feb 2026 00:21:26 +0000 (21:21 -0300)]
tests: fix ring3 write buffers and add sys_exit
Tulio A M Mendes [Sat, 7 Feb 2026 23:56:43 +0000 (20:56 -0300)]
kernel: add overlayfs root (initrd+tmpfs) for writable /
Tulio A M Mendes [Sat, 7 Feb 2026 23:13:26 +0000 (20:13 -0300)]
kernel: add console subsystem and kprintf (uart+vga)
Tulio A M Mendes [Sat, 7 Feb 2026 22:32:02 +0000 (19:32 -0300)]
syscall: support write() to files (tmpfs test)
Tulio A M Mendes [Sat, 7 Feb 2026 22:31:58 +0000 (19:31 -0300)]
fs: add mounts and basic tmpfs
Tulio A M Mendes [Sat, 7 Feb 2026 22:13:42 +0000 (19:13 -0300)]
fs: add lseek/stat/fstat and minimal errno
Tulio A M Mendes [Sat, 7 Feb 2026 21:50:10 +0000 (18:50 -0300)]
mm: add per-process address spaces (x86)
Tulio A M Mendes [Sat, 7 Feb 2026 21:21:21 +0000 (18:21 -0300)]
proc: reap zombie children on waitpid
Tulio A M Mendes [Sat, 7 Feb 2026 21:19:51 +0000 (18:19 -0300)]
user/init: stress test waitpid with 100 children
Tulio A M Mendes [Sat, 7 Feb 2026 20:46:02 +0000 (17:46 -0300)]
proc: add waitpid + exit status; add temporary spawn() test helper
Tulio A M Mendes [Sat, 7 Feb 2026 20:39:46 +0000 (17:39 -0300)]
docs: update POSIX roadmap and current kernel features
Tulio A M Mendes [Sat, 7 Feb 2026 19:34:05 +0000 (16:34 -0300)]
tty: add canonical line discipline and wire fd 0/1/2
Tulio A M Mendes [Sat, 7 Feb 2026 19:22:30 +0000 (16:22 -0300)]
tty: make stdin (fd 0) blocking via keyboard waiter
Tulio A M Mendes [Sat, 7 Feb 2026 18:54:15 +0000 (15:54 -0300)]
tty: add nonblocking stdin (fd 0) via ring buffer
Tulio A M Mendes [Sat, 7 Feb 2026 18:45:01 +0000 (15:45 -0300)]
initrd: switch to TAR USTAR with directory support
Tulio A M Mendes [Sat, 7 Feb 2026 18:16:03 +0000 (15:16 -0300)]
syscall: add open/read/close and per-process fd table
Tulio A M Mendes [Sat, 7 Feb 2026 17:35:49 +0000 (14:35 -0300)]
vfs: add basic path lookup (vfs_lookup)
Tulio A M Mendes [Sat, 7 Feb 2026 16:27:02 +0000 (13:27 -0300)]
kernel: introduce init_start to manage initrd and userspace bring-up
Tulio A M Mendes [Sat, 7 Feb 2026 16:21:47 +0000 (13:21 -0300)]
kernel: move arch-specific init into arch_platform hooks
Tulio A M Mendes [Sat, 7 Feb 2026 16:08:30 +0000 (13:08 -0300)]
kernel: move initrd mapping and usermode entry behind HAL
Tulio A M Mendes [Sat, 7 Feb 2026 15:50:34 +0000 (12:50 -0300)]
refactor: rename arch_start to arch_early_setup
Tulio A M Mendes [Sat, 7 Feb 2026 15:27:23 +0000 (12:27 -0300)]
docs: update README and translate build guide
Tulio A M Mendes [Fri, 6 Feb 2026 18:10:32 +0000 (15:10 -0300)]
x86: enforce W^X-like user mappings (text RO after load)
Tulio A M Mendes [Fri, 6 Feb 2026 18:09:23 +0000 (15:09 -0300)]
x86: stabilize initrd/PMM and ring3 ELF bring-up
Tulio A M Mendes [Fri, 6 Feb 2026 14:41:57 +0000 (11:41 -0300)]
docs: update features/todo and build guide
Tulio A M Mendes [Fri, 6 Feb 2026 14:31:32 +0000 (11:31 -0300)]
x86: enforce W^X and non-exec stack
Tulio A M Mendes [Fri, 6 Feb 2026 14:08:03 +0000 (11:08 -0300)]
kernel: centralize user pointer access (uaccess)
Tulio A M Mendes [Fri, 6 Feb 2026 13:29:27 +0000 (10:29 -0300)]
x86/usermode: add ring3 fault-injection tests for sys_write
Tulio A M Mendes [Fri, 6 Feb 2026 13:17:09 +0000 (10:17 -0300)]
initrd: remove placeholder read wrapper; ignore analysis artifacts
Tulio A M Mendes [Fri, 6 Feb 2026 12:23:07 +0000 (09:23 -0300)]
syscall: validate user pointers and copy buffers for write
Tulio A M Mendes [Fri, 6 Feb 2026 12:14:46 +0000 (09:14 -0300)]
x86/usermode: add ring3 syscall smoke test
Tulio A M Mendes [Fri, 6 Feb 2026 11:54:59 +0000 (08:54 -0300)]
x86/boot: shrink identity map to 16MB; map initrd via VMM
Tulio A M Mendes [Fri, 6 Feb 2026 11:47:32 +0000 (08:47 -0300)]
x86/boot: reduce early identity map to 64MB
Tulio A M Mendes [Fri, 6 Feb 2026 11:42:43 +0000 (08:42 -0300)]
shell: make panic command deterministic (ud2 on x86)
Tulio A M Mendes [Fri, 6 Feb 2026 11:42:18 +0000 (08:42 -0300)]
boot: introduce arch_start() and generic boot_info for multi-arch kernel entry
Tulio A M Mendes [Fri, 6 Feb 2026 11:42:02 +0000 (08:42 -0300)]
sched: make early allocations safe under higher-half/identity constraints
Tulio A M Mendes [Fri, 6 Feb 2026 11:41:22 +0000 (08:41 -0300)]
mm/pmm: fix low memory reservations and speed up allocation
Tulio A M Mendes [Fri, 6 Feb 2026 11:40:33 +0000 (08:40 -0300)]
x86/boot: expand early mappings and stabilize higher-half bring-up
Tulio A M Mendes [Fri, 6 Feb 2026 11:39:46 +0000 (08:39 -0300)]
build: keep ISO kernel in sync when generating grub image
Tulio A M Mendes [Fri, 6 Feb 2026 01:11:07 +0000 (22:11 -0300)]
add *.log on .gitignore
Tulio A M Mendes [Fri, 6 Feb 2026 01:09:00 +0000 (22:09 -0300)]
add iso/ on .gitignore
Tulio A M Mendes [Fri, 6 Feb 2026 00:54:33 +0000 (21:54 -0300)]
kernel/mm: fix WSL build (cross-compiler guard, utils, heap includes)
Tulio A M Mendes [Fri, 6 Feb 2026 00:53:54 +0000 (21:53 -0300)]
x86: fix multiboot2 mmap tag and boot.S physical symbol addressing
Tulio A M Mendes [Thu, 5 Feb 2026 22:41:25 +0000 (19:41 -0300)]
kernel: use hal_cpu_idle for idle loop
Tulio A M Mendes [Thu, 5 Feb 2026 22:40:53 +0000 (19:40 -0300)]
mm: use hal_cpu_idle for heap corruption halts
Tulio A M Mendes [Thu, 5 Feb 2026 22:40:26 +0000 (19:40 -0300)]
kernel: make process/scheduler arch-agnostic (sp/address space)
Tulio A M Mendes [Thu, 5 Feb 2026 22:39:46 +0000 (19:39 -0300)]
hal: add cpu helpers (idle/irqs/stack/as)
Tulio A M Mendes [Thu, 5 Feb 2026 21:48:18 +0000 (18:48 -0300)]
x86: add flat GDT and minimal TSS; wire esp0 updates
Tulio A M Mendes [Thu, 5 Feb 2026 21:22:21 +0000 (18:22 -0300)]
sync: add spinlocks and make console/heap/scheduler irq-safe
Tulio A M Mendes [Thu, 5 Feb 2026 21:11:50 +0000 (18:11 -0300)]
mm: fix heap initialization code duplication