Linux????е???????????????
???????????? ???????[ 2013/2/25 10:12:12 ] ????????
???????user_mode(regs)????1?????????????(?м??????o??????????????)get_signal_to_deliver()????????????????????????(????Private Signal Queue??Shared Signal Queue)??????????????(????dequeue_signal()????)????????????λ???????signal_struct?????????????????sa_handler?SIG_IGN??????????????????????????????????????sa_handler?SIG_DFL????ζ??????????????????????????(??????????do_coredump()??)??
???????get_signal_to_deliver()?????????????0?????????????????????????????(???signal()??sigaction()??????????????????????????)????????handle_signal()???????д????handle_signal()????????????£?
/*
* OK?? we're invoking a handler
*/
static void
handle_signal(unsigned long sig?? struct k_sigaction *ka??
siginfo_t *info?? sigset_t *oldset??
struct pt_regs * regs?? int syscall)
{
struct thread_info *thread = current_thread_info();
struct task_struct *tsk = current;
int usig = sig;
int ret;
/*
* If we were from a system call?? check for system call restarting...
*/
if (syscall) {
switch (regs->ARM_r0) {
case -ERESTART_RESTARTBLOCK:
case -ERESTARTNOHAND:
regs->ARM_r0 = -EINTR;
break;
case -ERESTARTSYS:
if (!(ka->sa.sa_flags & SA_RESTART)) {
regs->ARM_r0 = -EINTR;
break;
}
/* fallthrough */
case -ERESTARTNOINTR:
restart_syscall(regs);
}
}
/*
* translate the signal
*/
if (usig < 32 && thread->exec_domain && thread->exec_domain->signal_invmap)
usig = thread->exec_domain->signal_invmap[usig];
/*
* Set up the stack frame//??????
*/
if (ka->sa.sa_flags & SA_SIGINFO)
ret = setup_rt_frame(usig?? ka?? info?? oldset?? regs);
else
ret = setup_frame(usig?? ka?? oldset?? regs);
/*
* Check that the resulting registers are actually sane.
*/
ret |= !valid_user_regs(regs);
/*
* Block the signal if we were unsuccessful.
*/
if (ret != 0) {
spin_lock_irq(&tsk->sighand->siglock);
sigorsets(&tsk->blocked?? &tsk->blocked??
&ka->sa.sa_mask);
if (!(ka->sa.sa_flags & SA_NODEFER))
sigaddset(&tsk->blocked?? sig);
recalc_sigpending();
spin_unlock_irq(&tsk->sighand->siglock);
}
if (ret == 0)
return;
force_sigsegv(sig?? tsk);
}
??????????????£????????????????????????????????????????????????????????????????????????????????????????????????к????????????t??????????????????????????????????????????????????????????????С???????????У??????????????????????
????1????????????????????????????y????????????????y??????е?????????????????????????y??????????????????????????????
????2??????????????????????????????????????????????????????е??????????????????????????????????????????б?????????ж????????????pt_regs?????ж????????????pt_regts?е?pc?У???????????????????????pt_regs??pc?????sa_handler?????????????????sa_handler???????????
unsigned long handler = (unsigned long)ka->sa.sa_handler;
regs->ARM_pc = handler;
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11