about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pOS/arch/x86/kernel/acpi.cpp18
-rw-r--r--src/pOS/include/kernel/acpi.h14
-rw-r--r--src/pOS/include/kernel/kernel.h1
3 files changed, 33 insertions, 0 deletions
diff --git a/src/pOS/arch/x86/kernel/acpi.cpp b/src/pOS/arch/x86/kernel/acpi.cpp
new file mode 100644
index 0000000..7a8d3cd
--- /dev/null
+++ b/src/pOS/arch/x86/kernel/acpi.cpp
@@ -0,0 +1,18 @@
+#include <kernel/acpi.h>
+
+void ACPI::shutdown(void)
+{
+    System::outw(0x604, 0x2000); /* QEMU temp implementation */
+    ASSERT(false);
+}
+
+void ACPI::reboot(void)
+{
+    /* 8042 reset */
+    int8_t good = 0x02;
+    while (good & 0x02)
+        good = System::inb(0x64);
+    System::outb(0x64, 0xFE);
+
+    ASSERT(false);
+}
diff --git a/src/pOS/include/kernel/acpi.h b/src/pOS/include/kernel/acpi.h
new file mode 100644
index 0000000..18cf4fa
--- /dev/null
+++ b/src/pOS/include/kernel/acpi.h
@@ -0,0 +1,14 @@
+#ifndef _ACPI_H_
+#define _ACPI_H_
+
+#include <assert.h>
+#include <kernel/system.h>
+
+class ACPI
+{
+public:
+    static void shutdown(void);
+    static void reboot(void);
+};
+
+#endif
diff --git a/src/pOS/include/kernel/kernel.h b/src/pOS/include/kernel/kernel.h
index 7362374..622ef88 100644
--- a/src/pOS/include/kernel/kernel.h
+++ b/src/pOS/include/kernel/kernel.h
@@ -8,6 +8,7 @@
 #include <kernel/time.h>
 #include <kernel/debug.h>
 #include <kernel/drivers.h>
+#include <kernel/acpi.h>
 #include <kernel/interrupts/gdt.h>
 #include <kernel/interrupts/idt.h>
 #include <kernel/interrupts/isrs.h>