2022-12-21 08:29:33 +00:00
|
|
|
#ifndef SOCKS_X86_64_CPU_H_
|
|
|
|
|
#define SOCKS_X86_64_CPU_H_
|
|
|
|
|
|
2023-02-05 09:45:17 +00:00
|
|
|
#include <arch/gdt.h>
|
2023-02-08 20:24:40 +00:00
|
|
|
#include <arch/irq.h>
|
2023-02-04 19:03:45 +00:00
|
|
|
|
2023-03-20 20:41:39 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-07-08 22:14:31 +01:00
|
|
|
#define ML_BIG_ENDIAN 0
|
|
|
|
|
|
2023-03-18 19:35:00 +00:00
|
|
|
#define ml_cpu_block_get_id(p) ((p)->c_cpu_id)
|
2023-03-28 21:38:47 +01:00
|
|
|
#define ml_cpu_block_get_data(p) ((p)->c_data)
|
|
|
|
|
|
|
|
|
|
struct cpu_data;
|
2023-03-18 19:35:00 +00:00
|
|
|
|
2022-12-24 10:28:41 +00:00
|
|
|
typedef struct ml_cpu_block {
|
2023-03-18 19:35:00 +00:00
|
|
|
struct ml_cpu_block *c_this;
|
|
|
|
|
|
2022-12-24 10:28:41 +00:00
|
|
|
struct gdt c_gdt;
|
|
|
|
|
struct gdt_ptr c_gdt_ptr;
|
2023-02-08 20:24:40 +00:00
|
|
|
|
|
|
|
|
struct idt_ptr c_idt_ptr;
|
2023-03-18 19:35:00 +00:00
|
|
|
unsigned int c_cpu_id;
|
2023-03-28 21:38:47 +01:00
|
|
|
|
|
|
|
|
struct cpu_data *c_data;
|
2022-12-21 08:29:33 +00:00
|
|
|
} ml_cpu_block;
|
|
|
|
|
|
2023-03-24 14:21:02 +00:00
|
|
|
#define ml_cpu_pause() __asm__ __volatile__("hlt")
|
|
|
|
|
#define ml_cpu_relax() __asm__ __volatile__("pause")
|
|
|
|
|
|
|
|
|
|
#define ml_int_disable() __asm__ __volatile__("cli")
|
|
|
|
|
#define ml_int_enable() __asm__ __volatile__("sti")
|
2023-03-19 20:36:36 +00:00
|
|
|
|
2022-12-24 10:28:41 +00:00
|
|
|
extern int ml_init_bootcpu(void);
|
|
|
|
|
|
2022-12-21 08:29:33 +00:00
|
|
|
extern int ml_cpu_block_init(ml_cpu_block *p);
|
|
|
|
|
extern int ml_cpu_block_use(ml_cpu_block *p);
|
|
|
|
|
|
2023-02-05 10:27:29 +00:00
|
|
|
/* defined in cpu_ctrl.S */
|
|
|
|
|
extern void ml_halt_cpu(void);
|
2023-03-18 19:35:00 +00:00
|
|
|
extern ml_cpu_block *ml_this_cpu(void);
|
2023-02-05 10:27:29 +00:00
|
|
|
|
2023-03-20 20:41:39 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-12-21 08:29:33 +00:00
|
|
|
#endif
|