Conversation
5 tasks
6682d75 to
d3e41c1
Compare
904c56d to
e7b7593
Compare
Adds SYS_SYS_SIGNAL (0xF5) accepting SIG_DFL or SIG_IGN; user-virt handlers are rejected with EINVAL until the follow-up PR. Adds a libc signal() wrapper. Shell installs SIG_IGN at startup so its own Ctrl+C is benign; children inherit SIG_DFL from program_enter. ERROR_INVALID gets the next free numeric slot (09h, appended after PR 1's renumber) rather than being inserted alphabetically — that would have shifted the already-merged ERROR_NOT_EMPTY / NOT_EXECUTE / NOT_FOUND / PROTECTED values which are now ABI-stable. Source order keeps the new code at the bottom of the block; future additions follow the same append-at-next-free convention. Builds on PR 1 (SIGINT default-kill) and PR 336 (CR3 swap fix). PR 3 (next) adds full user-handler delivery via sigcontext + sigreturn. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacks on #332 (SIGINT default-kill). Adds the next layer of the SIGINT design:
SYS_SYS_SIGNAL(0xF5) — userland can register a SIGINT disposition. Currently accepts onlySIG_DFL(0) andSIG_IGN(1); user-virt handler addresses are rejected withERROR_INVALID(maps toEINVAL) until PR 3.signal()libc wrapper intools/libc/signal.c+tools/libc/include/signal.h— POSIX-shape API that returns the previous handler orSIG_ERRon failure.SIG_IGNat startup so a user typing Ctrl+C at the prompt no longer kills + reloads the shell. The cooked0x03byte still lands in the line editor, which already cancels the current input line.SIG_DFL—program_enterzeroessigint_handleron every load, so each new program starts killable. The opt-out is per-program and ephemeral.The
SIGINT_TAIL_CHECKmacro inirq_tail.incnow readssigint_handlerand routes tosignal_dispatch_killforSIG_DFL, falls through (after clearingpending_sigint) forSIG_IGN, and treats the not-yet-implemented user-virt case asSIG_DFL.What's deferred to PR 3
signal(SIGINT, fn)for arbitraryfn). Needs the sigcontext frame on the user stack, a vDSO__kernel_sigreturntrampoline,SYS_SYS_SIGRETURN(0xF6), and the IRQ-handler restructure that keeps pushad on the stack at dispatch.Test plan
./make_os.shclean build./tests/test_programs.py— 29/29 pass (existing programs unaffected; shell still loads + runs)./tests/test_asm.py— 20/20 pass (self-hosting NASM byte-equality)./tests/test_bboefs.py— 6/6 passManual verification of the opt-out behaviour comes in PR 3 alongside the user-handler smoke test (
tests/programs/sigint_test.c).🤖 Generated with Claude Code