]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
linuxkpi: Define `cpu_data(cpu)`
authorJean-Sébastien Pédron <dumbbell@FreeBSD.org>
Fri, 10 Feb 2023 15:38:43 +0000 (16:38 +0100)
committerJean-Sébastien Pédron <dumbbell@FreeBSD.org>
Mon, 13 Feb 2023 21:09:32 +0000 (22:09 +0100)
commita27902c1838836b3fb00cd660ce37a4f20bd7991
treec9637e453c35e38e68f1120825cba16896d4d563
parentf3490083b731700f2aa7c17ac6fe159826dc59a5
linuxkpi: Define `cpu_data(cpu)`

`cpu_data(cpu)` evaluates to a `struct cpuinfo_x86` filled with
attributes of the given CPU number. The CPU number is an index in the
`__cpu_data[]` array with MAXCPU entries. On FreeBSD, we simply
initialize all of them like we do with `boot_cpu_data`.

While here, we add the `x86_model` field to the `struct cpuinfo_x86`. We
use `CPUID_TO_MODEL()` to set it.

At the same time, we fix the value of `x86` which should have been set
to the CPU family. It was using the same implementation as
`CPUID_TO_MODEL()` before. It now uses `CPUID_TO_FAMILY()`.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38542
sys/compat/linuxkpi/common/include/asm/intel-family.h [new file with mode: 0644]
sys/compat/linuxkpi/common/include/asm/processor.h
sys/compat/linuxkpi/common/src/linux_compat.c