refactor: decouple i386 specific instruction invocation
[lunaix-os.git] / lunaix-os / includes / hal / cpu.h
index 2a06f298e2b0e55c277c09b72e4726c3d3668d42..c68bb95b64b584870d044779198ae238f3af944d 100644 (file)
@@ -1,36 +1,83 @@
 #ifndef __LUNAIX_CPU_H
 #define __LUNAIX_CPU_H
 
-typedef unsigned long reg32;
-typedef unsigned short reg16;
+#include <lunaix/types.h>
 
-typedef struct {
-    reg32 edi;
-    reg32 esi;
-    reg32 ebp;
-    reg32 esp;
-    reg32 ebx;
-    reg32 edx;
-    reg32 ecx;
-    reg32 eax;
-} __attribute__((packed)) registers;
+/**
+ * @brief Get processor ID string
+ *
+ * @param id_out
+ */
+void
+cpu_get_id(char* id_out);
 
-reg32 cpu_r_cr0();
+/**
+ * @brief Load current processor state
+ *
+ * @return u32_t
+ */
+u32_t
+cpu_ldstate();
 
-reg32 cpu_r_cr2();
+/**
+ * @brief Load current processor config
+ *
+ * @return u32_t
+ */
+u32_t
+cpu_ldconfig();
 
-reg32 cpu_r_cr3();
+/**
+ * @brief Change current processor state
+ *
+ * @return u32_t
+ */
+void
+cpu_chconfig(u32_t val);
 
-void cpu_w_cr0(reg32 v);
+/**
+ * @brief Load current virtual memory space
+ *
+ * @return u32_t
+ */
+u32_t
+cpu_ldvmspace();
 
-void cpu_w_cr2(reg32 v);
+/**
+ * @brief Change current virtual memory space
+ *
+ * @return u32_t
+ */
+void
+cpu_chvmspace(u32_t val);
 
-void cpu_w_cr3(reg32 v);
+/**
+ * @brief Flush TLB
+ *
+ * @return u32_t
+ */
+void
+cpu_flush_page(ptr_t va);
 
-void cpu_get_model(char* model_out);
+void
+cpu_flush_vmspace();
 
-int cpu_brand_string_supported();
+void
+cpu_enable_interrupt();
 
-void cpu_get_brand(char* brand_out);
+void
+cpu_disable_interrupt();
+
+void
+cpu_trap_sched();
+
+void
+cpu_trap_panic(char* message);
+
+void
+cpu_wait();
+
+ptr_t
+cpu_ldeaddr();
 
 #endif /* __LUNAIX_CPU_H */