|
miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
|
#include <miniOS/types.h>

Go to the source code of this file.
Classes | |
| struct | mini_sigaction |
Macros | |
| #define | SIGHUP 1 |
| #define | SIGINT 2 |
| #define | SIGQUIT 3 |
| #define | SIGILL 4 |
| #define | SIGABRT 6 |
| #define | SIGTRAP 5 |
| #define | SIGFPE 8 |
| #define | SIGKILL 9 |
| #define | SIGSEGV 11 |
| #define | SIGPIPE 13 |
| #define | SIGALRM 14 |
| #define | SIGTERM 15 |
| #define | SIGCHLD 17 |
| #define | SIGCONT 18 |
| #define | SIGSTOP 19 |
| #define | SIGTSTP 20 |
| #define | SIG_DFL ((sighandler_t)0) |
| #define | SIG_IGN ((sighandler_t)1) |
| #define | MINIOS_SA_NOCLDWAIT 0x00000002U |
| #define | MINIOS_SA_RESTART 0x10000000U |
| #define | MINIOS_SA_RESETHAND 0x80000000U |
Typedefs | |
| typedef void(*) | sighandler_t(int signum) |
| typedef uint32_t | minisigset_t |
| typedef struct mini_sigaction | mini_sigaction_t |
Functions | |
| void | signal_dispatch (void) |
| void | ring3_invoke_handler (int sig, sighandler_t handler) |
| #define MINIOS_SA_NOCLDWAIT 0x00000002U |
| #define MINIOS_SA_RESETHAND 0x80000000U |
| #define MINIOS_SA_RESTART 0x10000000U |
| #define SIG_DFL ((sighandler_t)0) |
| #define SIG_IGN ((sighandler_t)1) |
| #define SIGABRT 6 |
| #define SIGALRM 14 |
| #define SIGCHLD 17 |
| #define SIGCONT 18 |
| #define SIGFPE 8 |
| #define SIGHUP 1 |
| #define SIGILL 4 |
| #define SIGINT 2 |
| #define SIGKILL 9 |
| #define SIGPIPE 13 |
| #define SIGQUIT 3 |
| #define SIGSEGV 11 |
| #define SIGSTOP 19 |
| #define SIGTERM 15 |
| #define SIGTRAP 5 |
| #define SIGTSTP 20 |
| typedef struct mini_sigaction mini_sigaction_t |
mini_sigaction_t — per-signal disposition record.
Stored in struct thread::signal_actions[1..31]. sa_flags holds MINIOS_SA_RESTART and other SA_* flags. sa_mask is reserved (zero) — miniOS does not block signals during handlers yet.
| typedef uint32_t minisigset_t |
| typedef void(*) sighandler_t(int signum) |
| void ring3_invoke_handler | ( | int | sig, |
| sighandler_t | handler ) |
ring3_invoke_handler() - Set up user stack to invoke a signal handler. @sig: Signal number passed as first argument to handler (RDI per SysV ABI). @handler: User-mode function pointer to invoke.
Modifies the current thread's saved_user_rip to point to @handler and adjusts saved_user_rsp to push the signal number onto the user stack. SYSRET then jumps directly into the handler. Full trampoline (return path via SYS_sigreturn).


| void signal_dispatch | ( | void | ) |
signal_dispatch() - Deliver all pending signals before returning to userspace.
Called from syscall.asm immediately before SYSRET. Scans the current thread's pending_signals bitmask (bits 1-31). For SIGKILL and SIGTERM calls sched_exit_current(128 + signum). For other signals invokes the registered handler via ring3_invoke_handler() if a non-default handler is registered, otherwise clears the pending bit and continues.
Context: Called with interrupts disabled (CLI before SYSRET path). Does not return if SIGKILL or SIGTERM is pending.

