arch/sparc/kernel/kgdb_32.c
Source file repositories/reference/linux-study-clean/arch/sparc/kernel/kgdb_32.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/kernel/kgdb_32.c- Extension
.c- Size
- 3883 bytes
- Lines
- 173
- Domain
- Architecture Layer
- Bucket
- arch/sparc
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kgdb.hlinux/kdebug.hlinux/sched.hasm/kdebug.hasm/ptrace.hasm/irq.hasm/cacheflush.hkernel.hentry.h
Detected Declarations
function Copyrightfunction sleeping_thread_to_gdb_regsfunction gdb_regs_to_pt_regsfunction kgdb_arch_handle_exceptionfunction kgdb_trapfunction kgdb_arch_initfunction kgdb_arch_exit
Annotated Snippet
if (kgdb_hex2long(&ptr, &addr)) {
linux_regs->pc = addr;
linux_regs->npc = addr + 4;
}
fallthrough;
case 'D':
case 'k':
if (linux_regs->pc == (unsigned long) arch_kgdb_breakpoint) {
linux_regs->pc = linux_regs->npc;
linux_regs->npc += 4;
}
return 0;
}
return -1;
}
asmlinkage void kgdb_trap(unsigned long trap_level, struct pt_regs *regs)
{
unsigned long flags;
if (user_mode(regs)) {
do_hw_interrupt(regs, trap_level);
return;
}
flushw_all();
local_irq_save(flags);
kgdb_handle_exception(trap_level, SIGTRAP, 0, regs);
local_irq_restore(flags);
}
int kgdb_arch_init(void)
{
return 0;
}
void kgdb_arch_exit(void)
{
}
void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip)
{
regs->pc = ip;
regs->npc = regs->pc + 4;
}
const struct kgdb_arch arch_kgdb_ops = {
/* Breakpoint instruction: ta 0x7d */
.gdb_bpt_instr = { 0x91, 0xd0, 0x20, 0x7d },
};
Annotation
- Immediate include surface: `linux/kgdb.h`, `linux/kdebug.h`, `linux/sched.h`, `asm/kdebug.h`, `asm/ptrace.h`, `asm/irq.h`, `asm/cacheflush.h`, `kernel.h`.
- Detected declarations: `function Copyright`, `function sleeping_thread_to_gdb_regs`, `function gdb_regs_to_pt_regs`, `function kgdb_arch_handle_exception`, `function kgdb_trap`, `function kgdb_arch_init`, `function kgdb_arch_exit`.
- Atlas domain: Architecture Layer / arch/sparc.
- 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.