ihk_mc_get_processor_id(): return -1 for non-McKernel CPUs

Cherry-pick of c45641e97add9fde467844d9272f2626cf4317de
This commit is contained in:
Balazs Gerofi
2018-02-19 11:10:34 +09:00
committed by Masamichi Takagi
parent 7836aa0136
commit 65df9c8084

View File

@ -107,9 +107,17 @@ void init_boot_processor_local(void)
@ ensures \result == %gs;
@ assigns \nothing;
*/
extern int num_processors;
int ihk_mc_get_processor_id(void)
{
int id;
void *gs;
gs = (void *)rdmsr(MSR_GS_BASE);
if (gs < (void *)locals ||
gs > ((void *)locals + LOCALS_SPAN * num_processors)) {
return -1;
}
asm volatile("movl %%gs:0, %0" : "=r"(id));