arch/powerpc/xmon/xmon.c
Source file repositories/reference/linux-study-clean/arch/powerpc/xmon/xmon.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/xmon/xmon.c- Extension
.c- Size
- 88178 bytes
- Lines
- 4093
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/errno.hlinux/sched/signal.hlinux/smp.hlinux/mm.hlinux/reboot.hlinux/delay.hlinux/kallsyms.hlinux/kmsg_dump.hlinux/cpumask.hlinux/export.hlinux/sysrq.hlinux/interrupt.hlinux/irq.hlinux/bug.hlinux/nmi.hlinux/ctype.hlinux/highmem.hlinux/security.hlinux/debugfs.hasm/ptrace.hasm/smp.hasm/string.hasm/machdep.hasm/xmon.hasm/processor.hasm/mmu.hasm/mmu_context.hasm/plpar_wrappers.hasm/cputable.hasm/rtas.hasm/sstep.h
Detected Declarations
struct bptfunction dump_opal_msglogfunction xmon_is_locked_downfunction xmon_is_locked_downfunction syncfunction cflushfunction cinvalfunction write_ciabrfunction set_ciabrfunction surveillancefunction get_output_lockfunction release_output_lockfunction cpus_are_in_xmonfunction wait_for_other_cpusfunction get_output_lockfunction xmon_corefunction xmonfunction xmon_irqfunction xmon_bptfunction xmon_sstepfunction xmon_break_matchfunction xmon_iabr_matchfunction xmon_ipifunction xmon_fault_handlerfunction force_enable_xmonfunction insert_bptsfunction insert_cpu_bptsfunction remove_bptsfunction remove_cpu_bptsfunction show_uptimefunction set_lpp_cmdfunction cmdsfunction do_stepfunction do_stepfunction bootcmdsfunction xmon_switch_cpufunction xmon_batch_next_cpufunction for_each_cpu_wrapfunction batch_cmdsfunction cpu_cmdfunction for_each_possible_cpufunction cpu_cmdfunction csumfunction check_bp_locfunction find_free_data_bptfunction print_data_bptsfunction bpt_cmdsfunction get_function_bounds
Annotated Snippet
device_initcall(setup_xmon_sysrq);
#endif /* CONFIG_MAGIC_SYSRQ */
static void clear_all_bpt(void)
{
int i;
/* clear/unpatch all breakpoints */
remove_bpts();
remove_cpu_bpts();
/* Disable all breakpoints */
for (i = 0; i < NBPTS; ++i)
bpts[i].enabled = 0;
/* Clear any data or iabr breakpoints */
iabr = NULL;
for (i = 0; i < nr_wp_slots(); i++)
dabr[i].enabled = 0;
}
#ifdef CONFIG_DEBUG_FS
static int xmon_dbgfs_set(void *data, u64 val)
{
xmon_on = !!val;
xmon_init(xmon_on);
/* make sure all breakpoints removed when disabling */
if (!xmon_on) {
clear_all_bpt();
get_output_lock();
printf("xmon: All breakpoints cleared\n");
release_output_lock();
}
return 0;
}
static int xmon_dbgfs_get(void *data, u64 *val)
{
*val = xmon_on;
return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(xmon_dbgfs_ops, xmon_dbgfs_get,
xmon_dbgfs_set, "%llu\n");
static int __init setup_xmon_dbgfs(void)
{
debugfs_create_file("xmon", 0600, arch_debugfs_dir, NULL,
&xmon_dbgfs_ops);
return 0;
}
device_initcall(setup_xmon_dbgfs);
#endif /* CONFIG_DEBUG_FS */
static int xmon_early __initdata;
static int __init early_parse_xmon(char *p)
{
if (xmon_is_locked_down()) {
xmon_init(0);
xmon_early = 0;
xmon_on = 0;
} else if (!p || strncmp(p, "early", 5) == 0) {
/* just "xmon" is equivalent to "xmon=early" */
xmon_init(1);
xmon_early = 1;
xmon_on = 1;
} else if (strncmp(p, "on", 2) == 0) {
xmon_init(1);
xmon_on = 1;
} else if (strncmp(p, "rw", 2) == 0) {
xmon_init(1);
xmon_on = 1;
xmon_is_ro = false;
} else if (strncmp(p, "ro", 2) == 0) {
xmon_init(1);
xmon_on = 1;
xmon_is_ro = true;
} else if (strncmp(p, "off", 3) == 0)
xmon_on = 0;
else
return 1;
return 0;
}
early_param("xmon", early_parse_xmon);
void __init xmon_setup(void)
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/errno.h`, `linux/sched/signal.h`, `linux/smp.h`, `linux/mm.h`, `linux/reboot.h`, `linux/delay.h`, `linux/kallsyms.h`.
- Detected declarations: `struct bpt`, `function dump_opal_msglog`, `function xmon_is_locked_down`, `function xmon_is_locked_down`, `function sync`, `function cflush`, `function cinval`, `function write_ciabr`, `function set_ciabr`, `function surveillance`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.