2023-03-17 20:07:19 +00:00
|
|
|
#ifndef SOCKS_CPU_H_
|
|
|
|
|
#define SOCKS_CPU_H_
|
|
|
|
|
|
2023-03-18 19:35:00 +00:00
|
|
|
#include <socks/machine/cpu.h>
|
|
|
|
|
#include <socks/sched.h>
|
|
|
|
|
|
|
|
|
|
typedef enum cpu_flags {
|
|
|
|
|
CPU_ONLINE = 0x01u,
|
|
|
|
|
} cpu_flags_t;
|
|
|
|
|
|
|
|
|
|
typedef struct cpu_data {
|
|
|
|
|
cpu_flags_t c_flags;
|
|
|
|
|
unsigned int c_id;
|
|
|
|
|
|
|
|
|
|
task_t *c_current_task;
|
|
|
|
|
runqueue_t c_rq;
|
|
|
|
|
} cpu_data_t;
|
2023-03-17 20:07:19 +00:00
|
|
|
|
|
|
|
|
/* maximum number of processor cores that the kernel can support.
|
|
|
|
|
TODO move to build config option */
|
|
|
|
|
#define CPU_MAX 128
|
|
|
|
|
|
2023-03-18 19:35:00 +00:00
|
|
|
#define this_cpu() (ml_cpu_block_get_id(ml_this_cpu()))
|
|
|
|
|
|
|
|
|
|
extern cpu_data_t *get_this_cpu(void);
|
|
|
|
|
extern void put_cpu(cpu_data_t *cpu);
|
|
|
|
|
|
|
|
|
|
extern void cpu_set_available(unsigned int cpu_id);
|
|
|
|
|
extern void cpu_set_online(unsigned int cpu_id);
|
|
|
|
|
|
|
|
|
|
extern unsigned int cpu_get_highest_available(void);
|
2023-03-17 20:07:19 +00:00
|
|
|
|
|
|
|
|
#endif
|