summaryrefslogtreecommitdiff
path: root/Source/Kernel/Core
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Kernel/Core')
-rw-r--r--Source/Kernel/Core/Sys.ns.cpp17
-rw-r--r--Source/Kernel/Core/Sys.ns.h1
2 files changed, 15 insertions, 3 deletions
diff --git a/Source/Kernel/Core/Sys.ns.cpp b/Source/Kernel/Core/Sys.ns.cpp
index c99544b..1b52c0f 100644
--- a/Source/Kernel/Core/Sys.ns.cpp
+++ b/Source/Kernel/Core/Sys.ns.cpp
@@ -3,6 +3,8 @@
#include <Core/Log.ns.h>
#include <VTManager/SimpleVT.class.h>
#include <SyscallManager/IDT.ns.h>
+#include <Sys.iface.h>
+#include <UserManager/Usr.ns.h>
#define DEBUGVT(x) SimpleVT *x = new SimpleVT(4, 56, 0, 15); x->map(); x->put('\n');
@@ -122,15 +124,18 @@ void panic_assert(char *file, u32int line, char *desc) {
while (1) asm volatile("hlt"); //Enter infinite loop for halt
}
-void reboot() {
+void shutdown_cleanup() {
asm volatile("cli");
Log::close();
+}
+
+void reboot() {
+ shutdown_cleanup();
outb(0x64, 0xFE);
}
void halt() {
- asm volatile("cli");
- Log::close();
+ shutdown_cleanup();
String message("MELON SEZ : KTHXBYE, U CAN NAOW TURNZ OFF UR COMPUTER.");
SimpleVT vt(3, message.size() + 16, 7, 6);
vt.map();
@@ -138,4 +143,10 @@ void halt() {
while (1) asm volatile("cli");
}
+u32int scall(u8int wat, u32int a, u32int b, u32int c, u32int d) {
+ if (wat == SYIF_HALT && ISROOT) halt();
+ if (wat == SYIF_REBOOT && ISROOT) reboot();
+ return (u32int) - 1;
+}
+
}
diff --git a/Source/Kernel/Core/Sys.ns.h b/Source/Kernel/Core/Sys.ns.h
index 6779585..1ed446c 100644
--- a/Source/Kernel/Core/Sys.ns.h
+++ b/Source/Kernel/Core/Sys.ns.h
@@ -32,6 +32,7 @@ namespace Sys {
void bochs_output_hex(u32int i);
void reboot();
void halt();
+ u32int scall(u8int, u32int, u32int, u32int, u32int); //System call handler
}
#endif