xref: /qemu/linux-user/sparc/target_proc.h (revision 513823e7521a09ed7ad1e32e6454bac3b2cbf52d)
1 /*
2  * Sparc specific proc functions for linux-user
3  *
4  * SPDX-License-Identifier: GPL-2.0-or-later
5  */
6 #ifndef SPARC_TARGET_PROC_H
7 #define SPARC_TARGET_PROC_H
8 
9 static int open_cpuinfo(CPUArchState *cpu_env, int fd)
10 {
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 
30     return 0;
31 }
32 #define HAVE_ARCH_PROC_CPUINFO
33 
34 #endif /* SPARC_TARGET_PROC_H */
35