kernel: add support for getting percpu variables that belong to other CPUs

This commit is contained in:
2023-05-04 21:42:51 +01:00
parent 3f91c96050
commit bb524c1576
6 changed files with 49 additions and 4 deletions

View File

@@ -24,7 +24,7 @@ extern kern_status_t init_per_cpu_areas(void)
return KERN_OK;
}
extern void *__percpu_get(void *var)
extern void *__percpu_get(unsigned int cpu, void *var)
{
uintptr_t pvar = (uintptr_t)var;
uintptr_t percpu_start = (uintptr_t)__percpu_start;
@@ -36,5 +36,5 @@ extern void *__percpu_get(void *var)
size_t var_offset = pvar - percpu_start;
return (char *)percpu_buffer + (this_cpu() * percpu_stride) + var_offset;
return (char *)percpu_buffer + (cpu * percpu_stride) + var_offset;
}