arch/sparc/kernel/traps_32.c
Source file repositories/reference/linux-study-clean/arch/sparc/kernel/traps_32.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/kernel/traps_32.c- Extension
.c- Size
- 11282 bytes
- Lines
- 396
- Domain
- Architecture Layer
- Bucket
- arch/sparc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpu.hlinux/sched/mm.hlinux/sched/debug.hlinux/mm_types.hlinux/kernel.hlinux/signal.hlinux/smp.hlinux/kdebug.hlinux/export.hlinux/pgtable.hasm/delay.hasm/ptrace.hasm/oplib.hasm/page.hasm/unistd.hasm/traps.hentry.hkernel.h
Detected Declarations
function Jelinekfunction die_if_kernelfunction do_hw_interruptfunction do_illegal_instructionfunction do_priv_instructionfunction do_memaccess_unalignedfunction do_fpd_trapfunction do_fpe_trapfunction handle_tag_overflowfunction handle_watchpointfunction handle_reg_accessfunction handle_cp_disabledfunction handle_cp_exceptionfunction handle_hw_divzerofunction do_BUGfunction trap_initexport do_BUG
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* arch/sparc/kernel/traps.c
*
* Copyright 1995, 2008 David S. Miller (davem@davemloft.net)
* Copyright 2000 Jakub Jelinek (jakub@redhat.com)
*/
/*
* I hate traps on the sparc, grrr...
*/
#include <linux/cpu.h>
#include <linux/sched/mm.h>
#include <linux/sched/debug.h>
#include <linux/mm_types.h>
#include <linux/kernel.h>
#include <linux/signal.h>
#include <linux/smp.h>
#include <linux/kdebug.h>
#include <linux/export.h>
#include <linux/pgtable.h>
#include <asm/delay.h>
#include <asm/ptrace.h>
#include <asm/oplib.h>
#include <asm/page.h>
#include <asm/unistd.h>
#include <asm/traps.h>
#include "entry.h"
#include "kernel.h"
/* #define TRAP_DEBUG */
static void instruction_dump(unsigned long *pc)
{
int i;
if((((unsigned long) pc) & 3))
return;
for(i = -3; i < 6; i++)
printk("%c%08lx%c",i?' ':'<',pc[i],i?' ':'>');
printk("\n");
}
#define __SAVE __asm__ __volatile__("save %sp, -0x40, %sp\n\t")
#define __RESTORE __asm__ __volatile__("restore %g0, %g0, %g0\n\t")
void __noreturn die_if_kernel(char *str, struct pt_regs *regs)
{
static int die_counter;
int count = 0;
/* Amuse the user. */
printk(
" \\|/ ____ \\|/\n"
" \"@'/ ,. \\`@\"\n"
" /_| \\__/ |_\\\n"
" \\__U_/\n");
printk("%s(%d): %s [#%d]\n", current->comm, task_pid_nr(current), str, ++die_counter);
show_regs(regs);
add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
__SAVE; __SAVE; __SAVE; __SAVE;
__SAVE; __SAVE; __SAVE; __SAVE;
__RESTORE; __RESTORE; __RESTORE; __RESTORE;
__RESTORE; __RESTORE; __RESTORE; __RESTORE;
{
struct reg_window32 *rw = (struct reg_window32 *)regs->u_regs[UREG_FP];
/* Stop the back trace when we hit userland or we
* find some badly aligned kernel stack. Set an upper
* bound in case our stack is trashed and we loop.
*/
while(rw &&
count++ < 30 &&
(((unsigned long) rw) >= PAGE_OFFSET) &&
!(((unsigned long) rw) & 0x7)) {
printk("Caller[%08lx]: %pS\n", rw->ins[7],
(void *) rw->ins[7]);
rw = (struct reg_window32 *)rw->ins[6];
}
}
printk("Instruction DUMP:");
instruction_dump ((unsigned long *) regs->pc);
make_task_dead((regs->psr & PSR_PS) ? SIGKILL : SIGSEGV);
Annotation
- Immediate include surface: `linux/cpu.h`, `linux/sched/mm.h`, `linux/sched/debug.h`, `linux/mm_types.h`, `linux/kernel.h`, `linux/signal.h`, `linux/smp.h`, `linux/kdebug.h`.
- Detected declarations: `function Jelinek`, `function die_if_kernel`, `function do_hw_interrupt`, `function do_illegal_instruction`, `function do_priv_instruction`, `function do_memaccess_unaligned`, `function do_fpd_trap`, `function do_fpe_trap`, `function handle_tag_overflow`, `function handle_watchpoint`.
- Atlas domain: Architecture Layer / arch/sparc.
- Implementation status: integration implementation candidate.
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.