arch/x86/kernel/cpu/proc.c

Source file repositories/reference/linux-study-clean/arch/x86/kernel/cpu/proc.c

File Facts

System
Linux kernel
Corpus path
arch/x86/kernel/cpu/proc.c
Extension
.c
Size
5229 bytes
Lines
204
Domain
Architecture Layer
Bucket
arch/x86
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.

Dependency Surface

Detected Declarations

Annotated Snippet

if (c->x86_power & (1 << i)) {
			if (i < ARRAY_SIZE(x86_power_flags) &&
			    x86_power_flags[i])
				seq_printf(m, "%s%s",
					   x86_power_flags[i][0] ? " " : "",
					   x86_power_flags[i]);
			else
				seq_printf(m, " [%d]", i);
		}
	}

	seq_puts(m, "\n\n");

	return 0;
}

static void *c_start(struct seq_file *m, loff_t *pos)
{
	*pos = cpumask_next(*pos - 1, cpu_online_mask);
	if ((*pos) < nr_cpu_ids)
		return &cpu_data(*pos);
	return NULL;
}

static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
	(*pos)++;
	return c_start(m, pos);
}

static void c_stop(struct seq_file *m, void *v)
{
}

const struct seq_operations cpuinfo_op = {
	.start	= c_start,
	.next	= c_next,
	.stop	= c_stop,
	.show	= show_cpuinfo,
};

#ifdef CONFIG_X86_USER_SHADOW_STACK
static void dump_x86_features(struct seq_file *m, unsigned long features)
{
	if (features & ARCH_SHSTK_SHSTK)
		seq_puts(m, "shstk ");
	if (features & ARCH_SHSTK_WRSS)
		seq_puts(m, "wrss ");
}

void arch_proc_pid_thread_features(struct seq_file *m, struct task_struct *task)
{
	seq_puts(m, "x86_Thread_features:\t");
	dump_x86_features(m, task->thread.features);
	seq_putc(m, '\n');

	seq_puts(m, "x86_Thread_features_locked:\t");
	dump_x86_features(m, task->thread.features_locked);
	seq_putc(m, '\n');
}
#endif /* CONFIG_X86_USER_SHADOW_STACK */

Annotation

Implementation Notes