Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142705774
D42820.id130706.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D42820.id130706.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/asm/processor.h b/sys/compat/linuxkpi/common/include/asm/processor.h
--- a/sys/compat/linuxkpi/common/include/asm/processor.h
+++ b/sys/compat/linuxkpi/common/include/asm/processor.h
@@ -33,11 +33,24 @@
#include <machine/cpu.h>
#if defined(__i386__) || defined(__amd64__)
+#define X86_VENDOR_INTEL 0
+#define X86_VENDOR_CYRIX 1
+#define X86_VENDOR_AMD 2
+#define X86_VENDOR_UMC 3
+#define X86_VENDOR_CENTAUR 5
+#define X86_VENDOR_TRANSMETA 7
+#define X86_VENDOR_NSC 8
+#define X86_VENDOR_HYGON 9
+#define X86_VENDOR_NUM 12
+
+#define X86_VENDOR_UNKNOWN 0xff
+
struct cpuinfo_x86 {
uint8_t x86;
uint8_t x86_model;
uint16_t x86_clflush_size;
uint16_t x86_max_cores;
+ uint8_t x86_vendor;
};
extern struct cpuinfo_x86 boot_cpu_data;
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -63,6 +63,7 @@
#include <machine/stdarg.h>
#if defined(__i386__) || defined(__amd64__)
+#include <machine/cputypes.h>
#include <machine/md_var.h>
#endif
@@ -2812,17 +2813,37 @@
int i;
#if defined(__i386__) || defined(__amd64__)
+ static const uint32_t x86_vendors[X86_VENDOR_NUM] = {
+ [X86_VENDOR_INTEL] = CPU_VENDOR_INTEL,
+ [X86_VENDOR_CYRIX] = CPU_VENDOR_CYRIX,
+ [X86_VENDOR_AMD] = CPU_VENDOR_AMD,
+ [X86_VENDOR_UMC] = CPU_VENDOR_UMC,
+ [X86_VENDOR_CENTAUR] = CPU_VENDOR_CENTAUR,
+ [X86_VENDOR_TRANSMETA] = CPU_VENDOR_TRANSMETA,
+ [X86_VENDOR_NSC] = CPU_VENDOR_NSC,
+ [X86_VENDOR_HYGON] = CPU_VENDOR_HYGON,
+ };
+ uint8_t x86_vendor = X86_VENDOR_UNKNOWN;
+
+ for (i = 0; i < X86_VENDOR_NUM; i++) {
+ if (cpu_vendor_id != 0 && cpu_vendor_id == x86_vendors[i]) {
+ x86_vendor = i;
+ break;
+ }
+ }
linux_cpu_has_clflush = (cpu_feature & CPUID_CLFSH);
boot_cpu_data.x86_clflush_size = cpu_clflush_line_size;
boot_cpu_data.x86_max_cores = mp_ncpus;
boot_cpu_data.x86 = CPUID_TO_FAMILY(cpu_id);
boot_cpu_data.x86_model = CPUID_TO_MODEL(cpu_id);
+ boot_cpu_data.x86_vendor = x86_vendor;
for (i = 0; i < MAXCPU; i++) {
__cpu_data[i].x86_clflush_size = cpu_clflush_line_size;
__cpu_data[i].x86_max_cores = mp_ncpus;
__cpu_data[i].x86 = CPUID_TO_FAMILY(cpu_id);
__cpu_data[i].x86_model = CPUID_TO_MODEL(cpu_id);
+ __cpu_data[i].x86_vendor = x86_vendor;
}
#endif
rw_init(&linux_vma_lock, "lkpi-vma-lock");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 23, 12:04 PM (1 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27882750
Default Alt Text
D42820.id130706.diff (2 KB)
Attached To
Mode
D42820: LinuxKPI: Add x86_vendor field to struct cpuinfo_x86
Attached
Detach File
Event Timeline
Log In to Comment