arch/hexagon/kernel/traps.c
Source file repositories/reference/linux-study-clean/arch/hexagon/kernel/traps.c
File Facts
- System
- Linux kernel
- Corpus path
arch/hexagon/kernel/traps.c- Extension
.c- Size
- 10139 bytes
- Lines
- 433
- Domain
- Architecture Layer
- Bucket
- arch/hexagon
- 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.
- 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/init.hlinux/sched/signal.hlinux/sched/debug.hlinux/sched/task_stack.hlinux/module.hlinux/kallsyms.hlinux/kdebug.hlinux/syscalls.hlinux/signal.hlinux/ptrace.hasm/traps.hasm/vm_fault.hasm/syscall.hasm/registers.hasm/unistd.hasm/sections.hlinux/kgdb.h
Detected Declarations
function Copyrightfunction do_show_stackfunction show_stackfunction diefunction die_if_kernelfunction misaligned_instructionfunction misaligned_data_loadfunction misaligned_data_storefunction illegal_instructionfunction precise_bus_errorfunction cache_errorfunction do_genexfunction do_trap0function do_machcheckfunction do_debug_exception
Annotated Snippet
if (task == current) {
asm("%0 = r30" : "=r" (fp));
} else {
fp = (unsigned long *)
((struct hexagon_switch_stack *)
task->thread.switch_sp)->fp;
}
}
if ((((unsigned long) fp) & 0x3) || ((unsigned long) fp < 0x1000)) {
printk("%s-- Corrupt frame pointer %p\n", loglvl, fp);
return;
}
/* Saved link reg is one word above FP */
if (!ip)
ip = *(fp+1);
/* Expect kernel stack to be in-bounds */
low = (unsigned long)task_stack_page(task);
high = low + THREAD_SIZE - 8;
low += sizeof(struct thread_info);
for (i = 0; i < kstack_depth_to_print; i++) {
name = kallsyms_lookup(ip, &size, &offset, &modname, tmpstr);
printk("%s[%p] 0x%lx: %s + 0x%lx", loglvl, fp, ip, name, offset);
if (((unsigned long) fp < low) || (high < (unsigned long) fp))
printk(KERN_CONT " (FP out of bounds!)");
if (modname)
printk(KERN_CONT " [%s] ", modname);
printk(KERN_CONT "\n");
newfp = (unsigned long *) *fp;
if (((unsigned long) newfp) & 0x3) {
printk("%s-- Corrupt frame pointer %p\n", loglvl, newfp);
break;
}
/* Attempt to continue past exception. */
if (!newfp) {
struct pt_regs *regs = (struct pt_regs *) (((void *)fp)
+ 8);
if (regs->syscall_nr != -1) {
printk("%s-- trap0 -- syscall_nr: %ld", loglvl,
regs->syscall_nr);
printk(KERN_CONT " psp: %lx elr: %lx\n",
pt_psp(regs), pt_elr(regs));
break;
} else {
/* really want to see more ... */
kstack_depth_to_print += 6;
printk("%s-- %s (0x%lx) badva: %lx\n", loglvl,
ex_name(pt_cause(regs)), pt_cause(regs),
pt_badva(regs));
}
newfp = (unsigned long *) regs->r30;
ip = pt_elr(regs);
} else {
ip = *(newfp + 1);
}
/* If link reg is null, we are done. */
if (ip == 0x0)
break;
/* If newfp isn't larger, we're tracing garbage. */
if (newfp > fp)
fp = newfp;
else
break;
}
}
void show_stack(struct task_struct *task, unsigned long *fp, const char *loglvl)
{
/* Saved link reg is one word above FP */
do_show_stack(task, fp, 0, loglvl);
}
int die(const char *str, struct pt_regs *regs, long err)
{
static struct {
spinlock_t lock;
int counter;
} die = {
Annotation
- Immediate include surface: `linux/init.h`, `linux/sched/signal.h`, `linux/sched/debug.h`, `linux/sched/task_stack.h`, `linux/module.h`, `linux/kallsyms.h`, `linux/kdebug.h`, `linux/syscalls.h`.
- Detected declarations: `function Copyright`, `function do_show_stack`, `function show_stack`, `function die`, `function die_if_kernel`, `function misaligned_instruction`, `function misaligned_data_load`, `function misaligned_data_store`, `function illegal_instruction`, `function precise_bus_error`.
- Atlas domain: Architecture Layer / arch/hexagon.
- Implementation status: source implementation candidate.
- 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.