about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYour Name <you@example.com>2020-06-24 20:27:16 +0200
committerYour Name <you@example.com>2020-06-24 20:27:16 +0200
commitd0129620aeffd0080c4d032a3ec6785d732cbc6a (patch)
treec345d97ef49bb44c9009f132a07cfe73a37fbaff
parentBase: added tty handling of \b and \r (diff)
downloadpOS-d0129620aeffd0080c4d032a3ec6785d732cbc6a.tar.gz
pOS-d0129620aeffd0080c4d032a3ec6785d732cbc6a.tar.bz2
pOS-d0129620aeffd0080c4d032a3ec6785d732cbc6a.zip
ACPI: added halt()
-rw-r--r--TODO1
-rw-r--r--src/pOS/arch/x86/kernel/acpi.cpp7
-rw-r--r--src/pOS/arch/x86/kernel/system.cpp3
-rw-r--r--src/pOS/include/kernel/acpi.h1
-rw-r--r--src/pOS/include/kernel/system.h2
5 files changed, 12 insertions, 2 deletions
diff --git a/TODO b/TODO
index f4aa11a..0f826cf 100644
--- a/TODO
+++ b/TODO
@@ -4,4 +4,3 @@
 [] Add memory management
 [] Add an ACPI interface
 [] Add signals
-[] Add better backspace, as stuff not deleted if getc()
diff --git a/src/pOS/arch/x86/kernel/acpi.cpp b/src/pOS/arch/x86/kernel/acpi.cpp
index 7a8d3cd..cac3b8f 100644
--- a/src/pOS/arch/x86/kernel/acpi.cpp
+++ b/src/pOS/arch/x86/kernel/acpi.cpp
@@ -1,5 +1,12 @@
 #include <kernel/acpi.h>
 
+void ACPI::halt(void)
+{
+    asm volatile("cli   \t\n"
+                 "hlt       ");
+    ASSERT(false);
+}
+
 void ACPI::shutdown(void)
 {
     System::outw(0x604, 0x2000); /* QEMU temp implementation */
diff --git a/src/pOS/arch/x86/kernel/system.cpp b/src/pOS/arch/x86/kernel/system.cpp
index 0ff405a..df1dc72 100644
--- a/src/pOS/arch/x86/kernel/system.cpp
+++ b/src/pOS/arch/x86/kernel/system.cpp
@@ -39,7 +39,8 @@ void System::outl(uint16_t port, uint32_t data)
 int System::idle_loop(void)
 {
     while(1)
-        asm("hlt");
+        ACPI::halt();
 
+    ASSERT(false);
     return 1;
 }
diff --git a/src/pOS/include/kernel/acpi.h b/src/pOS/include/kernel/acpi.h
index 18cf4fa..73eb752 100644
--- a/src/pOS/include/kernel/acpi.h
+++ b/src/pOS/include/kernel/acpi.h
@@ -7,6 +7,7 @@
 class ACPI
 {
 public:
+    static void halt(void);
     static void shutdown(void);
     static void reboot(void);
 };
diff --git a/src/pOS/include/kernel/system.h b/src/pOS/include/kernel/system.h
index 22628c3..29cba94 100644
--- a/src/pOS/include/kernel/system.h
+++ b/src/pOS/include/kernel/system.h
@@ -2,6 +2,8 @@
 #define _SYSTEM_H_
 
 #include <stdint.h>
+#include <assert.h>
+#include <kernel/acpi.h>
 
 class System
 {