x86: factorize the code that uses thread or process-binding for cpuid lookups