50 lines
959 B
C
50 lines
959 B
C
#ifndef SOCKS_X86_64_CPU_H_
|
|
#define SOCKS_X86_64_CPU_H_
|
|
|
|
#include <arch/gdt.h>
|
|
#include <arch/irq.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define ML_BIG_ENDIAN 0
|
|
|
|
#define ml_cpu_block_get_id(p) ((p)->c_cpu_id)
|
|
#define ml_cpu_block_get_data(p) ((p)->c_data)
|
|
|
|
struct cpu_data;
|
|
|
|
typedef struct ml_cpu_block {
|
|
struct ml_cpu_block *c_this;
|
|
|
|
struct gdt c_gdt;
|
|
struct gdt_ptr c_gdt_ptr;
|
|
|
|
struct idt_ptr c_idt_ptr;
|
|
unsigned int c_cpu_id;
|
|
|
|
struct cpu_data *c_data;
|
|
} ml_cpu_block;
|
|
|
|
#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")
|
|
|
|
extern int ml_init_bootcpu(void);
|
|
|
|
extern int ml_cpu_block_init(ml_cpu_block *p);
|
|
extern int ml_cpu_block_use(ml_cpu_block *p);
|
|
|
|
/* defined in cpu_ctrl.S */
|
|
extern void ml_halt_cpu(void);
|
|
extern ml_cpu_block *ml_this_cpu(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|