ihk_mc_get_processor_id(): return -1 for non-McKernel CPUs
Cherry-pick of c45641e97add9fde467844d9272f2626cf4317de
This commit is contained in:
committed by
Masamichi Takagi
parent
7836aa0136
commit
65df9c8084
@ -107,9 +107,17 @@ void init_boot_processor_local(void)
|
|||||||
@ ensures \result == %gs;
|
@ ensures \result == %gs;
|
||||||
@ assigns \nothing;
|
@ assigns \nothing;
|
||||||
*/
|
*/
|
||||||
|
extern int num_processors;
|
||||||
int ihk_mc_get_processor_id(void)
|
int ihk_mc_get_processor_id(void)
|
||||||
{
|
{
|
||||||
int id;
|
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));
|
asm volatile("movl %%gs:0, %0" : "=r"(id));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user