From ab1972627e3a4df31df2e6bc79b9d8cf12a5ec7f Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 11 Oct 2022 00:03:45 +0300 Subject: [PATCH] Implemented shutdown & reboot --- Core/Power.cpp | 9 ++------- include/power.hpp | 33 +++++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/Core/Power.cpp b/Core/Power.cpp index f34b1fb..43bea5a 100644 --- a/Core/Power.cpp +++ b/Core/Power.cpp @@ -9,13 +9,8 @@ namespace Power { - void Power::Reboot() - { - } - - void Power::Shutdown() - { - } + void Power::Reboot() { ((ACPI::DSDT *)this->dsdt)->Reboot(); } + void Power::Shutdown() { ((ACPI::DSDT *)this->dsdt)->Shutdown(); } Power::Power() { diff --git a/include/power.hpp b/include/power.hpp index cdd0b11..57ea41e 100644 --- a/include/power.hpp +++ b/include/power.hpp @@ -8,17 +8,42 @@ namespace Power class Power { private: - // specific for 64 and 32 bit - void *acpi; - void *dsdt; - void *madt; + void *acpi = nullptr; + void *dsdt = nullptr; + void *madt = nullptr; public: + /** + * @brief Get Advanced Configuration and Power Interface. (Available only on x32 and x64) + * + * @return void* + */ void *GetACPI() { return this->acpi; } + + /** + * @brief Get Differentiated System Description Table. (Available only on x32 and x64) + * + * @return void* + */ void *GetDSDT() { return this->dsdt; } + + /** + * @brief Get Multiple APIC Description Table. (Available only on x32 and x64) + * + * @return void* + */ void *GetMADT() { return this->madt; } + + /** + * @brief Reboot the system. + */ void Reboot(); + + /** + * @brief Shutdown the system. + */ void Shutdown(); + Power(); ~Power(); };