arch/sh/kernel/dumpstack.c
Source file repositories/reference/linux-study-clean/arch/sh/kernel/dumpstack.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sh/kernel/dumpstack.c- Extension
.c- Size
- 3433 bytes
- Lines
- 157
- Domain
- Architecture Layer
- Bucket
- arch/sh
- 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/kallsyms.hlinux/ftrace.hlinux/debug_locks.hlinux/sched/debug.hlinux/sched/task_stack.hlinux/kdebug.hlinux/export.hlinux/uaccess.hasm/unwinder.hasm/stacktrace.h
Detected Declarations
function Copyrightfunction printk_addressfunction print_ftrace_graph_addrfunction print_ftrace_graph_addrfunction print_trace_addressfunction show_tracefunction show_stack
Annotated Snippet
if (__get_user(val, (unsigned int __user *)p)) {
pr_cont("\n");
return;
}
pr_cont("%08x ", val);
}
}
pr_cont("\n");
}
}
void printk_address(unsigned long address, int reliable)
{
pr_cont(" [<%px>] %s%pS\n", (void *) address,
reliable ? "" : "? ", (void *) address);
}
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
static void
print_ftrace_graph_addr(unsigned long addr, void *data,
const struct stacktrace_ops *ops,
struct thread_info *tinfo, int *graph)
{
struct task_struct *task = tinfo->task;
struct ftrace_ret_stack *ret_stack;
unsigned long ret_addr;
if (addr != (unsigned long)return_to_handler)
return;
if (!task->ret_stack)
return;
ret_stack = ftrace_graph_get_ret_stack(task, *graph);
if (!ret_stack)
return;
ret_addr = ret_stack->ret;
ops->address(data, ret_addr, 1);
(*graph)++;
}
#else
static inline void
print_ftrace_graph_addr(unsigned long addr, void *data,
const struct stacktrace_ops *ops,
struct thread_info *tinfo, int *graph)
{ }
#endif
void
stack_reader_dump(struct task_struct *task, struct pt_regs *regs,
unsigned long *sp, const struct stacktrace_ops *ops,
void *data)
{
struct thread_info *context;
int graph = 0;
context = (struct thread_info *)
((unsigned long)sp & (~(THREAD_SIZE - 1)));
while (!kstack_end(sp)) {
unsigned long addr = *sp++;
if (__kernel_text_address(addr)) {
ops->address(data, addr, 1);
print_ftrace_graph_addr(addr, data, ops,
context, &graph);
}
}
}
/*
* Print one address/symbol entries per line.
*/
static void print_trace_address(void *data, unsigned long addr, int reliable)
{
printk("%s", (char *)data);
printk_address(addr, reliable);
}
static const struct stacktrace_ops print_trace_ops = {
.address = print_trace_address,
};
void show_trace(struct task_struct *tsk, unsigned long *sp,
struct pt_regs *regs, const char *loglvl)
{
Annotation
- Immediate include surface: `linux/kallsyms.h`, `linux/ftrace.h`, `linux/debug_locks.h`, `linux/sched/debug.h`, `linux/sched/task_stack.h`, `linux/kdebug.h`, `linux/export.h`, `linux/uaccess.h`.
- Detected declarations: `function Copyright`, `function printk_address`, `function print_ftrace_graph_addr`, `function print_ftrace_graph_addr`, `function print_trace_address`, `function show_trace`, `function show_stack`.
- Atlas domain: Architecture Layer / arch/sh.
- 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.