arch/mips/math-emu/me-debugfs.c
Source file repositories/reference/linux-study-clean/arch/mips/math-emu/me-debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/math-emu/me-debugfs.c- Extension
.c- Size
- 12184 bytes
- Lines
- 354
- Domain
- Architecture Layer
- Bucket
- arch/mips
- 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/cpumask.hlinux/debugfs.hlinux/fs.hlinux/init.hlinux/percpu.hlinux/types.hasm/debug.hasm/fpu_emulator.hasm/local.h
Detected Declarations
function fpuemu_stat_getfunction for_each_online_cpufunction adjust_instruction_counter_namefunction fpuemustats_clear_showfunction debugfs_fpuemu
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <linux/cpumask.h>
#include <linux/debugfs.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/percpu.h>
#include <linux/types.h>
#include <asm/debug.h>
#include <asm/fpu_emulator.h>
#include <asm/local.h>
DEFINE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats);
static int fpuemu_stat_get(void *data, u64 *val)
{
int cpu;
unsigned long sum = 0;
for_each_online_cpu(cpu) {
struct mips_fpu_emulator_stats *ps;
local_t *pv;
ps = &per_cpu(fpuemustats, cpu);
pv = (void *)ps + (unsigned long)data;
sum += local_read(pv);
}
*val = sum;
return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(fops_fpuemu_stat, fpuemu_stat_get, NULL, "%llu\n");
/*
* Used to obtain names for a debugfs instruction counter, given field name
* in fpuemustats structure. For example, for input "cmp_sueq_d", the output
* would be "cmp.sueq.d". This is needed since dots are not allowed to be
* used in structure field names, and are, on the other hand, desired to be
* used in debugfs item names to be clearly associated to corresponding
* MIPS FPU instructions.
*/
static void adjust_instruction_counter_name(char *out_name, char *in_name, size_t len)
{
int i = 0;
strscpy(out_name, in_name, len);
while (in_name[i] != '\0') {
if (out_name[i] == '_')
out_name[i] = '.';
i++;
}
}
static int fpuemustats_clear_show(struct seq_file *s, void *unused)
{
__this_cpu_write((fpuemustats).emulated, 0);
__this_cpu_write((fpuemustats).loads, 0);
__this_cpu_write((fpuemustats).stores, 0);
__this_cpu_write((fpuemustats).branches, 0);
__this_cpu_write((fpuemustats).cp1ops, 0);
__this_cpu_write((fpuemustats).cp1xops, 0);
__this_cpu_write((fpuemustats).errors, 0);
__this_cpu_write((fpuemustats).ieee754_inexact, 0);
__this_cpu_write((fpuemustats).ieee754_underflow, 0);
__this_cpu_write((fpuemustats).ieee754_overflow, 0);
__this_cpu_write((fpuemustats).ieee754_zerodiv, 0);
__this_cpu_write((fpuemustats).ieee754_invalidop, 0);
__this_cpu_write((fpuemustats).ds_emul, 0);
__this_cpu_write((fpuemustats).abs_s, 0);
__this_cpu_write((fpuemustats).abs_d, 0);
__this_cpu_write((fpuemustats).add_s, 0);
__this_cpu_write((fpuemustats).add_d, 0);
__this_cpu_write((fpuemustats).bc1eqz, 0);
__this_cpu_write((fpuemustats).bc1nez, 0);
__this_cpu_write((fpuemustats).ceil_w_s, 0);
__this_cpu_write((fpuemustats).ceil_w_d, 0);
__this_cpu_write((fpuemustats).ceil_l_s, 0);
__this_cpu_write((fpuemustats).ceil_l_d, 0);
__this_cpu_write((fpuemustats).class_s, 0);
__this_cpu_write((fpuemustats).class_d, 0);
__this_cpu_write((fpuemustats).cmp_af_s, 0);
__this_cpu_write((fpuemustats).cmp_af_d, 0);
__this_cpu_write((fpuemustats).cmp_eq_s, 0);
__this_cpu_write((fpuemustats).cmp_eq_d, 0);
__this_cpu_write((fpuemustats).cmp_le_s, 0);
__this_cpu_write((fpuemustats).cmp_le_d, 0);
__this_cpu_write((fpuemustats).cmp_lt_s, 0);
__this_cpu_write((fpuemustats).cmp_lt_d, 0);
__this_cpu_write((fpuemustats).cmp_ne_s, 0);
__this_cpu_write((fpuemustats).cmp_ne_d, 0);
__this_cpu_write((fpuemustats).cmp_or_s, 0);
Annotation
- Immediate include surface: `linux/cpumask.h`, `linux/debugfs.h`, `linux/fs.h`, `linux/init.h`, `linux/percpu.h`, `linux/types.h`, `asm/debug.h`, `asm/fpu_emulator.h`.
- Detected declarations: `function fpuemu_stat_get`, `function for_each_online_cpu`, `function adjust_instruction_counter_name`, `function fpuemustats_clear_show`, `function debugfs_fpuemu`.
- Atlas domain: Architecture Layer / arch/mips.
- 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.