Commit Graph
35 Commits
Author SHA1 Message Date
daniel 8e6b619b02 feat: port gcc to MontaukOS 2026-07-17 15:47:45 +02:00
danielandClaude Fable 5 5db2bd4c7c feat: TLS runtime - PT_TLS loading and per-thread FS base
MontaukOS binaries could not use thread-local storage: the ELF loader
ignored PT_TLS and no FS base was ever programmed, so any %fs access
(initial-exec/local-exec TLS, e.g. libbfd's _Thread_local error state)
page faulted at address 0. This is the kernel prerequisite for
cc1plus/libstdc++ in the GCC port.

ELF loader: parse PT_TLS and build the main thread's TLS block above
the loaded image (x86-64 variant II ABI: block below the thread
pointer, TP = base + align_up(memsz, align), .tdata copied from the
template, .tbss zeroed, ABI self-pointer stored at [TP]). The
template description is kept on the process for thread spawns.

Scheduler: fsBase per thread, loaded into IA32_FS_BASE at every
dispatch site through a per-CPU cache - TLS-free processes cost one
MSR write per CPU ever, and userspace cannot desync the cache since
CR4.FSGSBASE stays off. SYS_THREAD_SPAWN gives each new thread its
own TLS block copied from the template (allocated from the process
heap; reclaimed at process teardown).

Ships tls-test.elf in the SDK (built by the devkit target): checks
.tdata values, .tbss zeroing, and the %fs:0 self-pointer, exiting
nonzero on failure. Boot-smoke verified; existing TLS-free programs
are unaffected.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-16 18:48:25 +02:00
danielandClaude Fable 5 75184e0651 feat: process exit codes, posix_spawn, 4 KiB command lines
Groundwork for the GCC driver: a compiler driver must spawn cc1/as/ld
and know whether each stage succeeded.

Kernel: the scheduler keeps an exit-code ledger (pid -> code; pids are
monotonic so entries never alias), published during teardown right
before waiters wake. SYS_EXIT records main()'s return value, SYS_KILL
records 256+SIGKILL, and the exception handler records 256+signal
mapped from the fault vector (#PF/#GP -> SIGSEGV, #DE/FP -> SIGFPE,
#UD -> SIGILL). SYS_WAITPID now returns the code: 0..255 for a normal
exit, 256+signal for a violent death. Process args grow from 256
bytes to 4 KiB (cc1 invocations do not fit in 256), with crt1 now
parsing up to 255 argv entries from a static buffer.

libc: new spawn.h with posix_spawn/posix_spawnp over SYS_SPAWN -
libiberty's pex layer has a posix_spawn backend, so GCC's driver works
without fork. argv is joined into the kernel args string (spaces in
arguments rejected; no kernel quoting), envp is not transferred, and
non-empty file actions fail loudly with ENOTSUP until the kernel can
redirect stdio on spawn. waitpid() now decodes real POSIX status and
the sys/wait.h macros distinguish exited from signaled children.

Shell: prints [exit code N] after nonzero exits and [terminated by
signal N] for killed or crashed children.

Verified on the OS: cat on a missing file reports exit code 1; a
window-close (clean exit 0) stays silent as it should.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-16 16:59:17 +02:00
danielandClaude Fable 5 8bf3ceb457 wip: async BT firmware download attempt — DO NOT MERGE, breaks AX211 bring-up
Deferring the Intel BT firmware download off the boot path made the AX211
bootloader stop answering after the first FC05; even the final synchronous
revert freezes boot, so one of the 'neutral' fixes kept in this diff breaks
the bring-up on its own (candidates: BT-TRACE logging inside TransferCallback,
unconditional interrupt-IN re-queue after error completions on a halted EP,
xHCI interrupt-IN ZLP len fix interacting with HID, InPollContext owner
check).  Full history + next experiments in memory notes, 2026-07-05/06.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-06 15:46:06 +02:00
daniel 70702a21b0 feat: HWP scaling, C1E, closed-loop thermal governor for Intel CPUs 2026-07-05 10:51:11 +02:00
daniel 3f26b8cdb4 feat: introduce bootloader-agnostic Boot Contract, add btlist command to list connected Bluetooth devices 2026-06-20 21:25:24 +02:00
daniel bbb6fcf0ee feat: add support for console sessions to crashpad and crash handling in kernel 2026-06-18 12:56:29 +02:00
daniel 159fea1667 feat: add threading to Scheduler, fix desktop background selection freeze issue 2026-05-23 16:08:25 +02:00
daniel 8b8c8cee95 feat: audio mixer, Audio app, fix Installer crash 2026-05-19 07:48:09 +02:00
daniel 4fde39397a fix: kernel and desktop bug fixes 2026-05-14 11:31:14 +02:00
daniel 38b1f8a7ef feat: further kernel power and power optimizations 2026-04-21 20:51:12 +02:00
daniel 856b431fde fix: various kernel bug fixes 2026-04-10 23:16:02 +02:00
daniel ec186d076d feat: use PIC code model for shared libraries, fix shared library bugs 2026-04-08 17:07:55 +02:00
daniel 09d855aea7 feat: move CrashReport.cpp/hpp 2026-04-08 07:45:51 +02:00
daniel 9e04e51daa feat: add process crash popups 2026-04-07 20:15:56 +02:00
daniel 56a402ba19 wip: S3 sleep debugging 2026-03-30 10:46:37 +02:00
daniel 9b4dfe3e0e fix: improve scheduling, memory, timer implementations 2026-03-24 07:40:37 +01:00
daniel 41ad1f6404 feat: Symmetric Multiprocessing, text editor improvements, merge doom libc, implement math functions 2026-03-23 20:09:11 +01:00
daniel 94433d679b feat: S3 sleep, PDF viewer graphics rendering, live user environment 2026-03-15 18:46:54 +01:00
daniel 4c7efa3203 feat: expanded ACPI support, initial support for S3 sleep 2026-03-15 00:55:19 +01:00
daniel cd8f756574 cleanup: move some logic out of kernel Main.cpp into separate files/functions 2026-03-03 20:30:59 +01:00
daniel 9e191f64a9 feat: TrueType (TTF) font rendering, many new desktop applications and DOOM support, among other improvements 2026-02-20 22:46:41 +01:00
daniel 9ca51596ea feat: userspace overhaul, Intel GPU driver, and more 2026-02-19 15:46:49 +01:00
daniel 010783429c feat: e100e Ethernet driver, ramdisk reorganization, shell rewrite, web server/client, and more 2026-02-19 01:18:11 +01:00
daniel f384d4cf75 feat: scheduling, usermode, shell 2026-02-17 19:17:01 +01:00
daniel 641ec4681b feat: Local/IO APIC, PS/2 keyboard & mouse 2026-02-17 12:44:31 +01:00
daniel 8721194aeb fix(IDT): Fixed IDT reference bug 2025-12-06 17:55:06 +01:00
Daniel Hammer 2515149f28 feat(vmm): Add Paging support 2025-04-17 21:54:25 +02:00
Daniel Hammer fcd81be1c5 feat: Various improvements 2025-04-16 10:32:11 +02:00
Daniel Hammer bf2cf6a59e feat(pfa): Add PageFrameAllocator class 2025-03-12 14:34:48 +01:00
Daniel Hammer cc094a9172 fix(kcp, IDT, Heap, kernel): Various fixes, scrap broken memory allocator 2025-03-11 20:00:04 +01:00
Daniel Hammer b774f82625 fix(IDT): Fix use of runtime loop 2025-03-08 10:46:19 +01:00
Daniel Hammer 942adef65f feat(IDT): IDT and exception handling support 2025-03-08 10:40:12 +01:00
Daniel Hammer 17d0bbf1bb Allocator improvements, kernel C++ platform, streaming 2025-03-01 03:31:14 +04:00
Daniel Hammer 6f1c6f1316 GDT, page frame allocator 2025-02-27 19:48:03 +04:00