kernel: add header files
This commit is contained in:
36
include/kernel/percpu.h
Normal file
36
include/kernel/percpu.h
Normal 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
|
||||
Reference in New Issue
Block a user