kernel: add header files

This commit is contained in:
2026-02-19 19:13:44 +00:00
parent f2e128c57e
commit 85006411bd
42 changed files with 3335 additions and 0 deletions

36
include/kernel/percpu.h Normal file
View File

@@ -0,0 +1,36 @@
#ifndef KERNEL_PERCPU_H_
#define KERNEL_PERCPU_H_
#include <mango/status.h>
#include <kernel/compiler.h>
#include <kernel/sched.h>
#ifdef __cplusplus
extern "C" {
#endif
#define DEFINE_PERCPU_VAR(type, name) \
__section(".data.percpu") type name
#define percpu_get(var) \
__extension__({ \
preempt_disable(); \
__percpu_get(this_cpu(), var); \
})
#define percpu_get_from(cpu, var) \
__extension__({ \
preempt_disable(); \
__percpu_get(cpu, var); \
})
#define percpu_put(var) preempt_enable();
extern kern_status_t init_per_cpu_areas(void);
extern void *__percpu_get(unsigned int cpu, void *var);
#ifdef __cplusplus
}
#endif
#endif