arch/hexagon/kernel/kgdb.c
Source file repositories/reference/linux-study-clean/arch/hexagon/kernel/kgdb.c
File Facts
- System
- Linux kernel
- Corpus path
arch/hexagon/kernel/kgdb.c- Extension
.c- Size
- 7045 bytes
- Lines
- 215
- 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/irq.hlinux/sched.hlinux/sched/task_stack.hlinux/kdebug.hlinux/kgdb.h
Detected Declarations
function dbg_set_regfunction kgdb_arch_set_pcfunction sleeping_thread_to_gdb_regsfunction kgdb_arch_handle_exceptionfunction __kgdb_notifyfunction kgdb_notifyfunction kgdb_arch_initfunction kgdb_arch_exit
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* arch/hexagon/kernel/kgdb.c - Hexagon KGDB Support
*
* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
*/
#include <linux/irq.h>
#include <linux/sched.h>
#include <linux/sched/task_stack.h>
#include <linux/kdebug.h>
#include <linux/kgdb.h>
/* All registers are 4 bytes, for now */
#define GDB_SIZEOF_REG 4
/* The register names are used during printing of the regs;
* Keep these at three letters to pretty-print. */
struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = {
{ " r0", GDB_SIZEOF_REG, offsetof(struct pt_regs, r00)},
{ " r1", GDB_SIZEOF_REG, offsetof(struct pt_regs, r01)},
{ " r2", GDB_SIZEOF_REG, offsetof(struct pt_regs, r02)},
{ " r3", GDB_SIZEOF_REG, offsetof(struct pt_regs, r03)},
{ " r4", GDB_SIZEOF_REG, offsetof(struct pt_regs, r04)},
{ " r5", GDB_SIZEOF_REG, offsetof(struct pt_regs, r05)},
{ " r6", GDB_SIZEOF_REG, offsetof(struct pt_regs, r06)},
{ " r7", GDB_SIZEOF_REG, offsetof(struct pt_regs, r07)},
{ " r8", GDB_SIZEOF_REG, offsetof(struct pt_regs, r08)},
{ " r9", GDB_SIZEOF_REG, offsetof(struct pt_regs, r09)},
{ "r10", GDB_SIZEOF_REG, offsetof(struct pt_regs, r10)},
{ "r11", GDB_SIZEOF_REG, offsetof(struct pt_regs, r11)},
{ "r12", GDB_SIZEOF_REG, offsetof(struct pt_regs, r12)},
{ "r13", GDB_SIZEOF_REG, offsetof(struct pt_regs, r13)},
{ "r14", GDB_SIZEOF_REG, offsetof(struct pt_regs, r14)},
{ "r15", GDB_SIZEOF_REG, offsetof(struct pt_regs, r15)},
{ "r16", GDB_SIZEOF_REG, offsetof(struct pt_regs, r16)},
{ "r17", GDB_SIZEOF_REG, offsetof(struct pt_regs, r17)},
{ "r18", GDB_SIZEOF_REG, offsetof(struct pt_regs, r18)},
{ "r19", GDB_SIZEOF_REG, offsetof(struct pt_regs, r19)},
{ "r20", GDB_SIZEOF_REG, offsetof(struct pt_regs, r20)},
{ "r21", GDB_SIZEOF_REG, offsetof(struct pt_regs, r21)},
{ "r22", GDB_SIZEOF_REG, offsetof(struct pt_regs, r22)},
{ "r23", GDB_SIZEOF_REG, offsetof(struct pt_regs, r23)},
{ "r24", GDB_SIZEOF_REG, offsetof(struct pt_regs, r24)},
{ "r25", GDB_SIZEOF_REG, offsetof(struct pt_regs, r25)},
{ "r26", GDB_SIZEOF_REG, offsetof(struct pt_regs, r26)},
{ "r27", GDB_SIZEOF_REG, offsetof(struct pt_regs, r27)},
{ "r28", GDB_SIZEOF_REG, offsetof(struct pt_regs, r28)},
{ "r29", GDB_SIZEOF_REG, offsetof(struct pt_regs, r29)},
{ "r30", GDB_SIZEOF_REG, offsetof(struct pt_regs, r30)},
{ "r31", GDB_SIZEOF_REG, offsetof(struct pt_regs, r31)},
{ "usr", GDB_SIZEOF_REG, offsetof(struct pt_regs, usr)},
{ "preds", GDB_SIZEOF_REG, offsetof(struct pt_regs, preds)},
{ " m0", GDB_SIZEOF_REG, offsetof(struct pt_regs, m0)},
{ " m1", GDB_SIZEOF_REG, offsetof(struct pt_regs, m1)},
{ "sa0", GDB_SIZEOF_REG, offsetof(struct pt_regs, sa0)},
{ "sa1", GDB_SIZEOF_REG, offsetof(struct pt_regs, sa1)},
{ "lc0", GDB_SIZEOF_REG, offsetof(struct pt_regs, lc0)},
{ "lc1", GDB_SIZEOF_REG, offsetof(struct pt_regs, lc1)},
{ " gp", GDB_SIZEOF_REG, offsetof(struct pt_regs, gp)},
{ "ugp", GDB_SIZEOF_REG, offsetof(struct pt_regs, ugp)},
{ "cs0", GDB_SIZEOF_REG, offsetof(struct pt_regs, cs0)},
{ "cs1", GDB_SIZEOF_REG, offsetof(struct pt_regs, cs1)},
{ "psp", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmpsp)},
{ "elr", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmel)},
{ "est", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmest)},
{ "badva", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmbadva)},
{ "restart_r0", GDB_SIZEOF_REG, offsetof(struct pt_regs, restart_r0)},
{ "syscall_nr", GDB_SIZEOF_REG, offsetof(struct pt_regs, syscall_nr)},
};
const struct kgdb_arch arch_kgdb_ops = {
/* trap0(#0xDB) 0x0cdb0054 */
.gdb_bpt_instr = {0x54, 0x00, 0xdb, 0x0c},
};
char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
{
if (regno >= DBG_MAX_REG_NUM || regno < 0)
return NULL;
*((unsigned long *) mem) = *((unsigned long *) ((void *)regs +
dbg_reg_def[regno].offset));
return dbg_reg_def[regno].name;
}
int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
{
Annotation
- Immediate include surface: `linux/irq.h`, `linux/sched.h`, `linux/sched/task_stack.h`, `linux/kdebug.h`, `linux/kgdb.h`.
- Detected declarations: `function dbg_set_reg`, `function kgdb_arch_set_pc`, `function sleeping_thread_to_gdb_regs`, `function kgdb_arch_handle_exception`, `function __kgdb_notify`, `function kgdb_notify`, `function kgdb_arch_init`, `function kgdb_arch_exit`.
- 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.