Skip to content

Commit 8095f65

Browse files
hdellerrth7680
authored andcommitted
linux-user: Add missing /proc/cpuinfo fields for sparc
Add some missing fields which may be parsed by userspace applications. Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <Z39B1wzNNpndmOxZ@p100>
1 parent ee97eef commit 8095f65

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

linux-user/sparc/target_proc.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,25 @@
88

99
static int open_cpuinfo(CPUArchState *cpu_env, int fd)
1010
{
11-
dprintf(fd, "type\t\t: sun4u\n");
11+
int i, num_cpus;
12+
const char *cpu_type;
13+
14+
num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
15+
if (cpu_env->def.features & CPU_FEATURE_HYPV) {
16+
cpu_type = "sun4v";
17+
} else {
18+
cpu_type = "sun4u";
19+
}
20+
21+
dprintf(fd, "cpu\t\t: %s (QEMU)\n", cpu_env->def.name);
22+
dprintf(fd, "type\t\t: %s\n", cpu_type);
23+
dprintf(fd, "ncpus probed\t: %d\n", num_cpus);
24+
dprintf(fd, "ncpus active\t: %d\n", num_cpus);
25+
dprintf(fd, "State:\n");
26+
for (i = 0; i < num_cpus; i++) {
27+
dprintf(fd, "CPU%d:\t\t: online\n", i);
28+
}
29+
1230
return 0;
1331
}
1432
#define HAVE_ARCH_PROC_CPUINFO

0 commit comments

Comments
 (0)