kernel: add per-cpu data section to kernel image

This commit is contained in:
2023-03-17 20:07:19 +00:00
parent f816b97cf8
commit e1e897c953
3 changed files with 35 additions and 0 deletions

13
include/socks/cpu.h Normal file
View File

@@ -0,0 +1,13 @@
#ifndef SOCKS_CPU_H_
#define SOCKS_CPU_H_
#include <socks/bitmap.h>
/* maximum number of processor cores that the kernel can support.
TODO move to build config option */
#define CPU_MAX 128
DECLARE_BITMAP(cpu_available, CPU_MAX);
DECLARE_BITMAP(cpu_online, CPU_MAX);
#endif

15
include/socks/percpu.h Normal file
View File

@@ -0,0 +1,15 @@
#ifndef SOCKS_PERCPU_H_
#define SOCKS_PERCPU_H_
#include <socks/compiler.h>
#define DEFINE_PERCPU_VAR(type, name) \
__section(".data.percpu") type name
#define percpu_get(var) __percpu_get(var)
#define percpu_put(var)
extern void *__percpu_get(void *var);
#endif