arch/microblaze/kernel/signal.c
Source file repositories/reference/linux-study-clean/arch/microblaze/kernel/signal.c
File Facts
- System
- Linux kernel
- Corpus path
arch/microblaze/kernel/signal.c- Extension
.c- Size
- 8126 bytes
- Lines
- 317
- Domain
- Architecture Layer
- Bucket
- arch/microblaze
- 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/mm.hlinux/smp.hlinux/kernel.hlinux/signal.hlinux/errno.hlinux/wait.hlinux/ptrace.hlinux/unistd.hlinux/stddef.hlinux/personality.hlinux/percpu.hlinux/linkage.hlinux/resume_user_mode.hasm/entry.hasm/ucontext.hlinux/uaccess.hlinux/syscalls.hasm/cacheflush.hasm/syscalls.h
Detected Declarations
struct sigframestruct rt_sigframefunction restore_sigcontextfunction sys_rt_sigreturnfunction setup_sigcontextfunction get_sigframefunction setup_rt_framefunction handle_restartfunction handle_signalfunction do_signalfunction do_notify_resume
Annotated Snippet
struct sigframe {
struct sigcontext sc;
unsigned long extramask[_NSIG_WORDS-1];
unsigned long tramp[2]; /* signal trampoline */
};
struct rt_sigframe {
struct siginfo info;
struct ucontext uc;
unsigned long tramp[2]; /* signal trampoline */
};
static int restore_sigcontext(struct pt_regs *regs,
struct sigcontext __user *sc, int *rval_p)
{
unsigned int err = 0;
#define COPY(x) {err |= __get_user(regs->x, &sc->regs.x); }
COPY(r0);
COPY(r1);
COPY(r2); COPY(r3); COPY(r4); COPY(r5);
COPY(r6); COPY(r7); COPY(r8); COPY(r9);
COPY(r10); COPY(r11); COPY(r12); COPY(r13);
COPY(r14); COPY(r15); COPY(r16); COPY(r17);
COPY(r18); COPY(r19); COPY(r20); COPY(r21);
COPY(r22); COPY(r23); COPY(r24); COPY(r25);
COPY(r26); COPY(r27); COPY(r28); COPY(r29);
COPY(r30); COPY(r31);
COPY(pc); COPY(ear); COPY(esr); COPY(fsr);
#undef COPY
*rval_p = regs->r3;
return err;
}
asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
{
struct rt_sigframe __user *frame =
(struct rt_sigframe __user *)(regs->r1);
sigset_t set;
int rval;
/* Always make any pending restarted system calls return -EINTR */
current->restart_block.fn = do_no_restart_syscall;
if (!access_ok(frame, sizeof(*frame)))
goto badframe;
if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
goto badframe;
set_current_blocked(&set);
if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &rval))
goto badframe;
if (restore_altstack(&frame->uc.uc_stack))
goto badframe;
return rval;
badframe:
force_sig(SIGSEGV);
return 0;
}
/*
* Set up a signal frame.
*/
static int
setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
unsigned long mask)
{
int err = 0;
#define COPY(x) {err |= __put_user(regs->x, &sc->regs.x); }
COPY(r0);
COPY(r1);
COPY(r2); COPY(r3); COPY(r4); COPY(r5);
COPY(r6); COPY(r7); COPY(r8); COPY(r9);
COPY(r10); COPY(r11); COPY(r12); COPY(r13);
COPY(r14); COPY(r15); COPY(r16); COPY(r17);
COPY(r18); COPY(r19); COPY(r20); COPY(r21);
COPY(r22); COPY(r23); COPY(r24); COPY(r25);
COPY(r26); COPY(r27); COPY(r28); COPY(r29);
COPY(r30); COPY(r31);
COPY(pc); COPY(ear); COPY(esr); COPY(fsr);
Annotation
- Immediate include surface: `linux/sched.h`, `linux/mm.h`, `linux/smp.h`, `linux/kernel.h`, `linux/signal.h`, `linux/errno.h`, `linux/wait.h`, `linux/ptrace.h`.
- Detected declarations: `struct sigframe`, `struct rt_sigframe`, `function restore_sigcontext`, `function sys_rt_sigreturn`, `function setup_sigcontext`, `function get_sigframe`, `function setup_rt_frame`, `function handle_restart`, `function handle_signal`, `function do_signal`.
- Atlas domain: Architecture Layer / arch/microblaze.
- 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.