arch/parisc/kernel/signal.c
Source file repositories/reference/linux-study-clean/arch/parisc/kernel/signal.c
File Facts
- System
- Linux kernel
- Corpus path
arch/parisc/kernel/signal.c- Extension
.c- Size
- 16624 bytes
- Lines
- 590
- Domain
- Architecture Layer
- Bucket
- arch/parisc
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/sched.hlinux/sched/debug.hlinux/mm.hlinux/smp.hlinux/kernel.hlinux/signal.hlinux/errno.hlinux/wait.hlinux/ptrace.hlinux/resume_user_mode.hlinux/unistd.hlinux/stddef.hlinux/compat.hlinux/elf.hasm/ucontext.hasm/rt_sigframe.hlinux/uaccess.hasm/cacheflush.hasm/asm-offsets.hasm/vdso.hsignal32.h
Detected Declarations
function Copyrightfunction sys_rt_sigreturnfunction get_sigframefunction setup_sigcontextfunction setup_rt_framefunction handle_signalfunction check_syscallno_in_delay_branchfunction syscall_restartfunction insert_restart_trampolinefunction argumentsfunction do_notify_resume
Annotated Snippet
if (haddr & PA_PLABEL_FDESC) {
Elf32_Fdesc fdesc;
Elf32_Fdesc __user *ufdesc = (Elf32_Fdesc __user *)A(haddr & ~3);
err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc));
if (err)
return -EFAULT;
haddr = fdesc.addr;
regs->gr[19] = fdesc.gp;
}
#ifdef CONFIG_64BIT
} else {
Elf64_Fdesc fdesc;
Elf64_Fdesc __user *ufdesc = (Elf64_Fdesc __user *)A(haddr & ~3);
err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc));
if (err)
return -EFAULT;
haddr = fdesc.addr;
regs->gr[19] = fdesc.gp;
DBG(1, "%s: 64 bit signal, exe=%#lx, r19=%#lx, in_syscall=%d\n",
__func__, haddr, regs->gr[19], in_syscall);
}
#endif
/* The syscall return path will create IAOQ values from r31.
*/
if (in_syscall) {
regs->gr[31] = haddr;
#ifdef CONFIG_64BIT
if (!test_thread_flag(TIF_32BIT))
sigframe_size |= 1; /* XXX ???? */
#endif
} else {
unsigned long psw = USER_PSW;
#ifdef CONFIG_64BIT
if (!test_thread_flag(TIF_32BIT))
psw |= PSW_W;
#endif
/* If we are singlestepping, arrange a trap to be delivered
when we return to userspace. Note the semantics -- we
should trap before the first insn in the handler is
executed. Ref:
http://sources.redhat.com/ml/gdb/2004-11/msg00245.html
*/
if (pa_psw(current)->r) {
pa_psw(current)->r = 0;
psw |= PSW_R;
mtctl(-1, 0);
}
regs->gr[0] = psw;
regs->iaoq[0] = haddr | PRIV_USER;
regs->iaoq[1] = regs->iaoq[0] + 4;
}
regs->gr[2] = rp; /* userland return pointer */
regs->gr[26] = ksig->sig; /* signal number */
#ifdef CONFIG_COMPAT
if (is_compat_task()) {
regs->gr[25] = A(&compat_frame->info); /* siginfo pointer */
regs->gr[24] = A(&compat_frame->uc); /* ucontext pointer */
} else
#endif
{
regs->gr[25] = A(&frame->info); /* siginfo pointer */
regs->gr[24] = A(&frame->uc); /* ucontext pointer */
}
DBG(1, "%s: making sigreturn frame: %#lx + %#lx = %#lx\n", __func__,
regs->gr[30], sigframe_size,
regs->gr[30] + sigframe_size);
/* Raise the user stack pointer to make a proper call frame. */
regs->gr[30] = (A(frame) + sigframe_size);
DBG(1, "%s: sig deliver (%s,%d) frame=0x%p sp=%#lx iaoq=%#lx/%#lx rp=%#lx\n",
__func__, current->comm, current->pid, frame, regs->gr[30],
regs->iaoq[0], regs->iaoq[1], rp);
return 0;
}
/*
Annotation
- Immediate include surface: `linux/sched.h`, `linux/sched/debug.h`, `linux/mm.h`, `linux/smp.h`, `linux/kernel.h`, `linux/signal.h`, `linux/errno.h`, `linux/wait.h`.
- Detected declarations: `function Copyright`, `function sys_rt_sigreturn`, `function get_sigframe`, `function setup_sigcontext`, `function setup_rt_frame`, `function handle_signal`, `function check_syscallno_in_delay_branch`, `function syscall_restart`, `function insert_restart_trampoline`, `function arguments`.
- Atlas domain: Architecture Layer / arch/parisc.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.