x86: Fix cpuid family/model composition

Fixes a bug where previously MODEL_ID() was defined as:
    `#define MODEL_ID(x) ( ((x & 0xf0000) >> 16) + (x & 0xf0) )`

This was incorrect because (1) it didn't take into account the conditional
nature of the extended_model_ID, and (2) it's actually shifting the
extended_model_ID into the low bits and keeping the model_ID in the high bits,
when it should be the other way around.

This patch also introduces a foundation for more sane testing of CPU vendor,
family, model and brand_ID.
This commit is contained in:
Kofi Doku Atuah
2016-07-07 11:09:14 +10:00
parent d97603bd84
commit 56030fc3cc
7 changed files with 282 additions and 10 deletions

View File

@@ -39,6 +39,7 @@
#define USED __attribute__((used))
#define FASTCALL __attribute__((fastcall))
#define UNREACHABLE() __builtin_unreachable()
#define MAY_ALIAS __attribute__((may_alias))
#define OFFSETOF(type, member) \
__builtin_offsetof(type, member)