1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2018, Christophe Leroy CS S.I.
6 * This dumps the content of Segment Registers
9 #include <linux/debugfs.h>
11 static void seg_show(struct seq_file *m, int i)
13 u32 val = mfsr(i << 28);
15 seq_printf(m, "0x%01x0000000-0x%01xfffffff ", i, i);
16 seq_printf(m, "Kern key %d ", (val >> 30) & 1);
17 seq_printf(m, "User key %d ", (val >> 29) & 1);
18 if (val & 0x80000000) {
19 seq_printf(m, "Device 0x%03x", (val >> 20) & 0x1ff);
20 seq_printf(m, "-0x%05x", val & 0xfffff);
23 seq_puts(m, "No Exec ");
24 seq_printf(m, "VSID 0x%06x", val & 0xffffff);
29 static int sr_show(struct seq_file *m, void *v)
33 seq_puts(m, "---[ User Segments ]---\n");
34 for (i = 0; i < TASK_SIZE >> 28; i++)
37 seq_puts(m, "\n---[ Kernel Segments ]---\n");
44 DEFINE_SHOW_ATTRIBUTE(sr);
46 static int __init sr_init(void)
48 debugfs_create_file("segment_registers", 0400, arch_debugfs_dir,
52 device_initcall(sr_init);