linux-user: Implement /proc/cpuinfo for m68k CPU
Mimic the entries for /proc/cpuinfo to what can be seen on the debian porterbox mitchy.debian.org. Cc: Thomas Huth <th.huth+qemu@posteo.eu> Cc: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Helge Deller <deller@gmx.de>
Helge Deller committed
Jun 16, 2026 at 23:03 UTC
0b0ef9060caf6972cbefeb42dbc729e2ce04673f
1 file changed
+46
linux-user/m68k/target_proc.h
+46
@@ -1,6 +1,8 @@
1
/*
2
* M68K specific proc functions for linux-user
3
*
4
+ * Copyright (c) 2026 Helge Deller
5
+ *
6
* SPDX-License-Identifier: GPL-2.0-or-later
7
*/
8
#ifndef M68K_TARGET_PROC_H
@@ -13,4 +15,48 @@ static int open_hardware(CPUArchState *cpu_env, int fd)
15
}
16
#define HAVE_ARCH_PROC_HARDWARE
17
18
+
19
+static int open_cpuinfo(CPUArchState *cpu_env, int fd)
20
+{
21
+ const char *cpu, *fpu;
22
+ struct timespec res;
23
+ double freq_mhz;
24
+
25
+ if (clock_getres(CLOCK_REALTIME, &res) == -1) {
26
+ res.tv_nsec = 1;
27
+ }
28
+ freq_mhz = 1000.0 / res.tv_nsec;
29
+
30
+ if (m68k_feature(cpu_env, M68K_FEATURE_M68010)) {
31
+ cpu = "68010";
32
+ } else if (m68k_feature(cpu_env, M68K_FEATURE_M68020)) {
33
+ cpu = "68020";
34
+ } else if (m68k_feature(cpu_env, M68K_FEATURE_M68030)) {
35
+ cpu = "68030";
36
+ } else if (m68k_feature(cpu_env, M68K_FEATURE_M68040)) {
37
+ cpu = "68040";
38
+ } else if (m68k_feature(cpu_env, M68K_FEATURE_M68060)) {
39
+ cpu = "68060";
40
+ } else {
41
+ cpu = "680x0";
42
+ }
43
+
44
+ if (m68k_feature(cpu_env, M68K_FEATURE_FPU)) {
45
+ fpu = cpu;
46
+ } else {
47
+ fpu = "none(soft float)";
48
+ }
49
+
50
+ dprintf(fd, "CPU:\t\t%s\n"
51
+ "MMU:\t\t%s\n"
52
+ "FPU:\t\t%s\n"
53
+ "Clocking:\t%.1fMHz\n"
54
+ "Model:\t\tQEMU user v" QEMU_VERSION "\n",
55
+ cpu, cpu, fpu, freq_mhz);
56
+ /* dropped BogoMips and Calibration for now */
57
+
58
+ return 0;
59
+}
60
+#define HAVE_ARCH_PROC_CPUINFO
61
+
62
#endif /* M68K_TARGET_PROC_H */