kernel: add per-cpu data section to kernel image
This commit is contained in:
@@ -31,6 +31,13 @@ SECTIONS {
|
|||||||
*(.data)
|
*(.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.data.percpu ALIGN(4K) : AT(ADDR(.data.percpu) - KERNEL_VMA)
|
||||||
|
{
|
||||||
|
__percpu_start = .;
|
||||||
|
*(.data.percpu)
|
||||||
|
__percpu_end = .;
|
||||||
|
}
|
||||||
|
|
||||||
.initcall ALIGN(4K) : AT(ADDR(.initcall) - KERNEL_VMA) {
|
.initcall ALIGN(4K) : AT(ADDR(.initcall) - KERNEL_VMA) {
|
||||||
__initcall0_start = .;
|
__initcall0_start = .;
|
||||||
*(.initcall0.init)
|
*(.initcall0.init)
|
||||||
|
|||||||
13
include/socks/cpu.h
Normal file
13
include/socks/cpu.h
Normal 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
15
include/socks/percpu.h
Normal 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
|
||||||
Reference in New Issue
Block a user