1 Apr 2007 03:09
Mach exception handling thread
Nikodemus Siivola <nikodemus <at> random-state.net>
2007-04-01 01:09:59 GMT
2007-04-01 01:09:59 GMT
Snipped from signal_emulation_wrapper:
context = (struct ucontext*) os_validate(0, sizeof(struct ucontext));
regs = (struct mcontext*) os_validate(0, sizeof(struct mcontext));
context->uc_mcontext = regs;
/* when BSD signals are fired, they mask they signals in sa_mask
which always seem to be the blockable_sigset, for us, so we
need to:
1) save the current sigmask
2) block blockable signals
3) call the signal handler
4) restore the sigmask */
build_fake_signal_context(context, thread_state, float_state);
block_blockable_signals();
handler(signal, siginfo, context);
update_thread_state_from_context(thread_state, float_state, context);
os_invalidate((os_vm_address_t)context, sizeof(struct ucontext));
os_invalidate((os_vm_address_t)regs, sizeof(struct mcontext));
/* Trap to restore the signal context. */
asm volatile ("movl %0, %%eax; movl %1, %%ebx; .long 0xffff0b0f"
: : "r" (thread_state), "r" (float_state));
The handler function may unwind, in which case we leak memory every
(Continue reading)
RSS Feed