arch/alpha/lib/stacktrace.c
Source file repositories/reference/linux-study-clean/arch/alpha/lib/stacktrace.c
File Facts
- System
- Linux kernel
- Corpus path
arch/alpha/lib/stacktrace.c- Extension
.c- Size
- 2682 bytes
- Lines
- 104
- Domain
- Architecture Layer
- Bucket
- arch/alpha
- 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.
Dependency Surface
linux/kernel.h
Detected Declarations
function display_stored_regsfunction seek_prologuefunction stack_incrementfunction stacktrace
Annotated Snippet
if (STK_PUSH_MATCH(*pro_pc)) {
reg = (*pro_pc & MEM_REG) >> 21;
value = *(unsigned long *)(sp + (*pro_pc & MEM_OFF));
if (reg == 26)
ret_pc = (instr *)value;
printk("\t\t%s / 0x%016lx\n", reg_name[reg], value);
}
return ret_pc;
}
static instr *
seek_prologue(instr * pc)
{
while (!STK_ALLOC_MATCH(*pc))
--pc;
while (!BB_END(*(pc - 1)))
--pc;
return pc;
}
static long
stack_increment(instr * prologue_pc)
{
while (!STK_ALLOC_MATCH(*prologue_pc))
++prologue_pc;
/* Count the bytes allocated. */
if ((*prologue_pc & STK_ALLOC_1M) == STK_ALLOC_1M)
return -(((long)(*prologue_pc) << 48) >> 48);
else
return (*prologue_pc >> 13) & 0xff;
}
void
stacktrace(void)
{
instr * ret_pc;
instr * prologue = (instr *)stacktrace;
unsigned char *sp = (unsigned char *)current_stack_pointer;
printk("\tstack trace:\n");
do {
ret_pc = display_stored_regs(prologue, sp);
sp += stack_increment(prologue);
prologue = seek_prologue(ret_pc);
} while (IS_KERNEL_TEXT(ret_pc));
}
Annotation
- Immediate include surface: `linux/kernel.h`.
- Detected declarations: `function display_stored_regs`, `function seek_prologue`, `function stack_increment`, `function stacktrace`.
- Atlas domain: Architecture Layer / arch/alpha.
- Implementation status: source 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.