arch/sparc/kernel/traps_64.c
Source file repositories/reference/linux-study-clean/arch/sparc/kernel/traps_64.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/kernel/traps_64.c- Extension
.c- Size
- 85697 bytes
- Lines
- 2926
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpu.hlinux/extable.hlinux/sched/mm.hlinux/sched/debug.hlinux/linkage.hlinux/kernel.hlinux/signal.hlinux/smp.hlinux/mm.hlinux/init.hlinux/kallsyms.hlinux/kdebug.hlinux/ftrace.hlinux/reboot.hlinux/gfp.hlinux/context_tracking.hasm/smp.hasm/delay.hasm/ptrace.hasm/oplib.hasm/page.hasm/unistd.hlinux/uaccess.hasm/fpumacro.hasm/lsu.hasm/dcu.hasm/estate.hasm/chafsr.hasm/sfafsr.hasm/psrcompat.hasm/processor.hasm/timer.h
Detected Declarations
struct tl1_traplogstruct afsr_error_tablestruct sun4v_error_entryfunction dump_tl1_traplogfunction bad_trapfunction bad_trap_tl1function do_BUGfunction sprintf_dimmfunction register_dimm_printerfunction unregister_dimm_printerfunction spitfire_insn_access_exceptionfunction spitfire_insn_access_exception_tl1function sun4v_insn_access_exceptionfunction sun4v_insn_access_exception_tl1function is_no_fault_exceptionfunction spitfire_data_access_exceptionfunction spitfire_data_access_exception_tl1function sun4v_data_access_exceptionfunction sun4v_data_access_exception_tl1function spitfire_clean_and_reenable_l1_cachesfunction spitfire_enable_estate_errorsfunction spitfire_log_udb_syndromefunction spitfire_cee_logfunction spitfire_ue_logfunction spitfire_access_errorfunction cheetah_enable_pcachefunction cheetah_ecache_flush_initfunction cheetah_flush_ecachefunction cheetah_flush_ecache_linefunction __cheetah_flush_icachefunction cheetah_flush_icachefunction cheetah_flush_dcachefunction cheetah_plus_zap_dcache_parityfunction cheetah_get_hiprifunction cheetah_log_errorsfunction cheetah_recheck_errorsfunction cheetah_fecc_handlerfunction cheetah_fix_cefunction cheetah_check_main_memoryfunction cheetah_cee_handlerfunction cheetah_deferred_handlerfunction entryfunction cheetah_plus_parity_errorfunction sun4v_emit_err_attr_stringsfunction sun4v_report_real_raddrfunction sun4v_log_errorfunction do_mcd_errfunction sun4v_resum_error
Annotated Snippet
struct tl1_traplog {
struct {
unsigned long tstate;
unsigned long tpc;
unsigned long tnpc;
unsigned long tt;
} trapstack[4];
unsigned long tl;
};
static void dump_tl1_traplog(struct tl1_traplog *p)
{
int i, limit;
printk(KERN_EMERG "TRAPLOG: Error at trap level 0x%lx, "
"dumping track stack.\n", p->tl);
limit = (tlb_type == hypervisor) ? 2 : 4;
for (i = 0; i < limit; i++) {
printk(KERN_EMERG
"TRAPLOG: Trap level %d TSTATE[%016lx] TPC[%016lx] "
"TNPC[%016lx] TT[%lx]\n",
i + 1,
p->trapstack[i].tstate, p->trapstack[i].tpc,
p->trapstack[i].tnpc, p->trapstack[i].tt);
printk("TRAPLOG: TPC<%pS>\n", (void *) p->trapstack[i].tpc);
}
}
void bad_trap(struct pt_regs *regs, long lvl)
{
char buffer[36];
if (notify_die(DIE_TRAP, "bad trap", regs,
0, lvl, SIGTRAP) == NOTIFY_STOP)
return;
if (lvl < 0x100) {
sprintf(buffer, "Bad hw trap %lx at tl0\n", lvl);
die_if_kernel(buffer, regs);
}
lvl -= 0x100;
if (regs->tstate & TSTATE_PRIV) {
sprintf(buffer, "Kernel bad sw trap %lx", lvl);
die_if_kernel(buffer, regs);
}
if (test_thread_flag(TIF_32BIT)) {
regs->tpc &= 0xffffffff;
regs->tnpc &= 0xffffffff;
}
force_sig_fault_trapno(SIGILL, ILL_ILLTRP,
(void __user *)regs->tpc, lvl);
}
void bad_trap_tl1(struct pt_regs *regs, long lvl)
{
char buffer[36];
if (notify_die(DIE_TRAP_TL1, "bad trap tl1", regs,
0, lvl, SIGTRAP) == NOTIFY_STOP)
return;
dump_tl1_traplog((struct tl1_traplog *)(regs + 1));
sprintf (buffer, "Bad trap %lx at tl>0", lvl);
die_if_kernel (buffer, regs);
}
#ifdef CONFIG_DEBUG_BUGVERBOSE
void do_BUG(const char *file, int line)
{
bust_spinlocks(1);
printk("kernel BUG at %s:%d!\n", file, line);
}
EXPORT_SYMBOL(do_BUG);
#endif
static DEFINE_SPINLOCK(dimm_handler_lock);
static dimm_printer_t dimm_handler;
static int sprintf_dimm(int synd_code, unsigned long paddr, char *buf, int buflen)
{
unsigned long flags;
int ret = -ENODEV;
spin_lock_irqsave(&dimm_handler_lock, flags);
if (dimm_handler) {
ret = dimm_handler(synd_code, paddr, buf, buflen);
} else if (tlb_type == spitfire) {
Annotation
- Immediate include surface: `linux/cpu.h`, `linux/extable.h`, `linux/sched/mm.h`, `linux/sched/debug.h`, `linux/linkage.h`, `linux/kernel.h`, `linux/signal.h`, `linux/smp.h`.
- Detected declarations: `struct tl1_traplog`, `struct afsr_error_table`, `struct sun4v_error_entry`, `function dump_tl1_traplog`, `function bad_trap`, `function bad_trap_tl1`, `function do_BUG`, `function sprintf_dimm`, `function register_dimm_printer`, `function unregister_dimm_printer`.
- Atlas domain: Architecture Layer / arch/sparc.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.