Files
mango/include/socks/cpu.h

49 lines
948 B
C

#ifndef SOCKS_CPU_H_
#define SOCKS_CPU_H_
#include <socks/machine/cpu.h>
#include <socks/sched.h>
#ifdef __cplusplus
extern "C" {
#endif
enum cpu_flags {
CPU_ONLINE = 0x01u,
};
struct cpu_data {
enum cpu_flags c_flags;
unsigned int c_id;
unsigned int c_preempt_count;
struct thread *c_current_thread;
struct runqueue c_rq;
};
/* maximum number of processor cores that the kernel can support.
TODO move to build config option */
#define CPU_MAX 128
#define this_cpu() (ml_cpu_block_get_id(ml_this_cpu()))
extern struct cpu_data *get_this_cpu(void);
extern void put_cpu(struct cpu_data *cpu);
extern void cpu_set_available(unsigned int cpu_id);
extern void cpu_set_online(unsigned int cpu_id);
#define irq_enable() ml_int_enable()
#define irq_disable() ml_int_disable()
extern void preempt_disable(void);
extern void preempt_enable(void);
extern unsigned int cpu_get_highest_available(void);
#ifdef __cplusplus
}
#endif
#endif